Sync to trunk head (r47736)
[reactos.git] / base / applications / calc / utl.c
index 599115e..9ec8beb 100644 (file)
@@ -2,7 +2,6 @@
 
 void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
 {
-    TCHAR *ptr, *dst;
     calc_number_t tmp;
     int    width;
 
@@ -21,9 +20,12 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
         /* calculate the width of integer number */
         width = (rpn->f==0) ? 1 : (int)log10(fabs(rpn->f))+1;
         if (calc.sci_out == TRUE || width > MAX_LD_WIDTH || width < -MAX_LD_WIDTH)
-            ptr = buffer + _stprintf(buffer, TEXT("%#e"), rpn->f);
+            _stprintf(buffer, TEXT("%#e"), rpn->f);
         else {
+            TCHAR *ptr, *dst;
+
             ptr = buffer + _stprintf(buffer, TEXT("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
+            /* format sring ensures there is a '.': */
             dst = _tcschr(buffer, TEXT('.'));
             while (--ptr > dst)
                 if (*ptr != TEXT('0'))