gnumeric r17069 - in trunk: . plugins/fn-eng



Author: mortenw
Date: Thu Jan 15 14:45:50 2009
New Revision: 17069
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17069&view=rev

Log:
2009-01-15  Morten Welinder  <terra gnome org>

	* functions.c (val_to_base): Introduce new flag, V2B_NUMBER, to
	determine if an integer result is desired.  Fixes #567252.
	(gnumeric_bin2dec, gnumeric_oct2dec, gnumeric_hex2dec): Use flag
	here.



Modified:
   trunk/NEWS
   trunk/plugins/fn-eng/ChangeLog
   trunk/plugins/fn-eng/functions.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Thu Jan 15 14:45:50 2009
@@ -66,6 +66,7 @@
 	* Fix xls export problem generating extra ()s.  [#567380]
 	* Constify usage of GOFormats.
 	* Fix inconsistentcy in searching with respect to formats.
+	* Fix issue with BASE.   [#567252]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.3

Modified: trunk/plugins/fn-eng/functions.c
==============================================================================
--- trunk/plugins/fn-eng/functions.c	(original)
+++ trunk/plugins/fn-eng/functions.c	Thu Jan 15 14:45:50 2009
@@ -54,6 +54,7 @@
 	V2B_STRINGS_0XH = 2,            /* Allow "4444h" and "0xABCD".  */
 	V2B_STRINGS_MAXLEN = 4,         /* Impose 10 character input length.  */
 	V2B_STRINGS_BLANK_ZERO = 8,     /* Treat "" as "0".  */
+	V2B_NUMBER = 16,                /* Wants a number, not a string.  */
 	V2B_KILLME
 } Val2BaseFlags;
 
@@ -160,7 +161,7 @@
 	if (v >= b10 / 2) /* N's complement */
 		v = v - b10;
 
-	if (dest_base == 10)
+	if (flags & V2B_NUMBER)
 		return value_new_int (v);
 
 	if (v < 0) {
@@ -262,7 +263,9 @@
 	return val_to_base (ei, argv[0], NULL,
 			    2, 10,
 			    0, GNM_const(1111111111.0),
-			    V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO);
+			    V2B_STRINGS_MAXLEN |
+			    V2B_STRINGS_BLANK_ZERO |
+			    V2B_NUMBER);
 }
 
 /***************************************************************************/
@@ -483,7 +486,9 @@
 	return val_to_base (ei, argv[0], NULL,
 			    8, 10,
 			    0, GNM_const(7777777777.0),
-			    V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO);
+			    V2B_STRINGS_MAXLEN |
+			    V2B_STRINGS_BLANK_ZERO |
+			    V2B_NUMBER);
 }
 
 /***************************************************************************/
@@ -640,7 +645,9 @@
 	return val_to_base (ei, argv[0], NULL,
 			    16, 10,
 			    0, GNM_const(9999999999.0),
-			    V2B_STRINGS_MAXLEN | V2B_STRINGS_BLANK_ZERO);
+			    V2B_STRINGS_MAXLEN |
+			    V2B_STRINGS_BLANK_ZERO |
+			    V2B_NUMBER);
 }
 
 /***************************************************************************/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]