From 5e096c1b2bbe7ae4fba9af1b7a55176da34caac5 Mon Sep 17 00:00:00 2001 From: justin1014 Date: Wed, 18 Sep 2002 22:30:59 +0000 Subject: [PATCH] tiny size decrease yay git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1038 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/Ui.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 90d2e018..f2cce300 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -756,10 +756,13 @@ static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l static void NSISCALL inttosizestr(int kb, char *str) { - str += mystrlen(str); - if (kb < 1024) wsprintf(str,"%dKB",kb); - else if (kb < 1024*1024) wsprintf(str,"%d.%dMB",kb>>10,((kb*10)>>10)%10); - else wsprintf(str,"%d.%dGB%s",kb>>20,((kb*10)>>20)%10,(GetVersion()&0x80000000) ? "+":""); + char sh=20; + char c='G'; + char *s=""; + if (kb < 1024) { sh=0; c='K'; } + else if (kb < 1024*1024) { sh=10; c='M'; } + else if (GetVersion()&0x80000000) s="+"; + wsprintf(str+mystrlen(str),"%d.%d%cB%s",kb>>sh,((kb*10)>>sh)%10,c,s); } static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)