Update ROSCalc to version 1.09 to fix some bugs.
authorDaniel Reimer <reimer.daniel@freenet.de>
Mon, 30 Jun 2008 13:47:42 +0000 (13:47 +0000)
committerDaniel Reimer <reimer.daniel@freenet.de>
Mon, 30 Jun 2008 13:47:42 +0000 (13:47 +0000)
* Fixed bug with Conversion function: "Category" type must be found like "from" and "to" because the combobox sorts its items alphabetically.
* Fixed bug with memory function and GNU multi-precision libraries: the memory must be initialized to zero when the calculator starts, otherwise "MP" will crash.
* Fixed bug when closing an expression with right parentheses.

svn path=/trunk/; revision=34220

reactos/base/applications/calc/calc.h
reactos/base/applications/calc/convert.c
reactos/base/applications/calc/rpn_mpfr.c
reactos/base/applications/calc/whatsnew.txt

index 1fff50e..36e8feb 100644 (file)
@@ -42,7 +42,7 @@
 #define IDC_STATIC  ((DWORD)-1)
 #endif
 
-#define CALC_VERSION        TEXT("1.08")
+#define CALC_VERSION        TEXT("1.09")
 
 /*#define USE_KEYBOARD_HOOK*/
 
index 28c861f..06107c8 100644 (file)
@@ -467,7 +467,7 @@ static const conv_category_t conv_table[] = {
 void ConvExecute(HWND hWnd)
 {
     DWORD         c_cat = (DWORD)SendDlgItemMessage(hWnd, IDC_COMBO_CATEGORY, CB_GETCURSEL, 0, 0);
-    const conv_t *items = conv_table[c_cat].items;
+    const conv_t *items = NULL;
     DWORD         from  = SendDlgItemMessage(hWnd, IDC_COMBO_FROM, CB_GETCURSEL, 0, 0);
     DWORD         to    = SendDlgItemMessage(hWnd, IDC_COMBO_TO,   CB_GETCURSEL, 0, 0);
     TCHAR         txt_cb[128];
@@ -478,6 +478,16 @@ void ConvExecute(HWND hWnd)
     if (from == to)
         return;
 
+    /* Search correct category, since it can be sorted too */
+    SendDlgItemMessage(hWnd, IDC_COMBO_CATEGORY, CB_GETLBTEXT, c_cat, (LPARAM)txt_cb);
+    for (c_cat=0; c_cat < SIZEOF(conv_table); c_cat++) {
+        LoadString(calc.hInstance, conv_table[c_cat].category, txt, SIZEOF(txt));
+        if (!_tcscmp(txt_cb, txt)) {
+            items = conv_table[c_cat].items;
+            break;
+        }
+    }
+    
     /* The units can be sorted, so I must search the exact match */
     item = items;
     SendDlgItemMessage(hWnd, IDC_COMBO_FROM, CB_GETLBTEXT, from, (LPARAM)txt_cb);
@@ -551,3 +561,4 @@ void ConvInit(HWND hWnd)
     ConvAdjust(hWnd, 0);
 }
 
+
index d5a2a93..a6e8d70 100644 (file)
@@ -387,6 +387,7 @@ void exec_closeparent(calc_number_t *number)
 {
     stack_node_t *op, ip;
 
+    rpn_alloc(&ip.node.number);
     rpn_copy(&ip.node.number, number);
     while (!is_stack_empty()) {
         op = pop();
@@ -401,6 +402,7 @@ void exec_closeparent(calc_number_t *number)
         }
     }
     rpn_copy(number, &ip.node.number);
+    rpn_free(&ip.node.number);
 }
 
 int eval_parent_count(void)
@@ -434,6 +436,7 @@ void start_rpn_engine(void)
     mpfr_init(calc.prev.mf);
     mpfr_init(calc.memory.number.mf);
     mpfr_init(temp.node.number.mf);
+    rpn_zero(&calc.memory.number);
 }
 
 void stop_rpn_engine(void)
index 38809c3..b4b7f59 100644 (file)
@@ -1,3 +1,9 @@
+1.09 (20080630)
+=======================
+* Fixed bug with Conversion function: "Category" type must be found like "from" and "to" because the combobox sorts its items alphabetically.
+* Fixed bug with memory function and GNU multi-precision libraries: the memory must be initialized to zero when the calculator starts, otherwise "MP" will crash.
+* Fixed bug when closing an expression with right parentheses.
+
 1.08 (20080520)
 =======================
 * Added macro DISABLE_HTMLHELP_SUPPORT for disabling the compilation of htmlhelp support.