Bug 796054 - Display of free space on disk is calculated incorrectly for the stub installer. r=bbondy
authorRobert Strong <robert.bugzilla@gmail.com>
Mon, 01 Oct 2012 15:13:26 -0700
changeset 108790 5065be124c8d8cac8004de6028d35739f603dff1
parent 108789 024f0c7ca3fcc0f6b842fd4e47f8f77cfed20ccd
child 108791 db9dc0e948157291bb8c64868b98c9bb5f8b36ae
push id15693
push userrstrong@mozilla.com
push dateMon, 01 Oct 2012 22:13:34 +0000
treeherdermozilla-inbound@5065be124c8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs796054
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 796054 - Display of free space on disk is calculated incorrectly for the stub installer. r=bbondy
browser/installer/windows/nsis/stub.nsi
--- a/browser/installer/windows/nsis/stub.nsi
+++ b/browser/installer/windows/nsis/stub.nsi
@@ -1043,28 +1043,30 @@ Function UpdateFreeSpaceLabel
       StrCpy $1 "$(MEGA)$(BYTE)"
       ${If} $0 > 10240
       ${OrIf} $0 < 0
         System::Int64Op $0 / 1024
         Pop $0
         StrCpy $1 "$(GIGA)$(BYTE)"
       ${EndIf}
     ${EndIf}
-    StrCpy $4 "$0"
     StrLen $3 "$0"
-    ${If} $3 > 2
-      StrCpy $2 "$0" 2
-      StrCpy $0 "$0" 1 2
-      StrCpy $0 "$2.$0"
-    ${ElseIf} $3 == 2
-      StrCpy $2 "$0" 1
-      StrCpy $0 "$0" -1
-      StrCpy $0 "$2.$0"
+    ${If} $3 > 1
+      StrCpy $2 "$0" -1 ; All characters except the last one
+      StrCpy $0 "$0" "" -1 ; The last character
+      ${If} "$0" == "0"
+        StrCpy $0 "$2" ; Don't display the decimal if it is 0
+      ${Else}
+        StrCpy $0 "$2.$0"
+      ${EndIf}
+    ${ElseIf} $3 == 1
+      StrCpy $0 "0.$0"
     ${Else}
-      System::Int64Op $4 / 10
+      ; This should never happen
+      System::Int64Op $0 / 10
       Pop $0
     ${EndIf}
   ${EndIf}
 
   SendMessage $LabelFreeSpace ${WM_SETTEXT} 0 "STR:$0 $1"
 
 FunctionEnd