[Gnucash-changes] r13780 - gnucash/trunk - Fix a bunch of 64-bit compile issues.

Derek Atkins warlord at cvs.gnucash.org
Fri Apr 14 12:45:12 EDT 2006


Author: warlord
Date: 2006-04-14 12:45:10 -0400 (Fri, 14 Apr 2006)
New Revision: 13780
Trac: http://svn.gnucash.org/trac/changeset/13780

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/app-utils/gnc-ui-util.c
   gnucash/trunk/src/backend/file/test/test-dom-converters1.c
   gnucash/trunk/src/engine/Transaction.c
   gnucash/trunk/src/engine/test/test-date.c
Log:
Fix a bunch of 64-bit compile issues.

	* src/engine/Transaction.c:
	* src/engine/test/test-date.c:
	* src/backend/file/test/test-dom-converters1.c:
	  Fix 64-bit compile: Use G_GUINT64_FORMAT instead of %llu or lld
	  for Timespec seconds.
	* src/app-utils/gnc-ui-util.c:
	  Fix 64-bit compile issues:
	  - Use QOF_SCANF_LLD instead of GNC_SCANF_LLD.
	  - Use QOF_SCANF_LLD and G_GINT64_FORMAT properly.
	  - replace %lld with G_GINT64_FORMAT



Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-04-14 05:37:34 UTC (rev 13779)
+++ gnucash/trunk/ChangeLog	2006-04-14 16:45:10 UTC (rev 13780)
@@ -1,3 +1,16 @@
+2006-04-14  Derek Atkins  <derek at ihtfp.com>
+
+	* src/engine/Transaction.c:
+	* src/engine/test/test-date.c:
+	* src/backend/file/test/test-dom-converters1.c:
+	  Fix 64-bit compile: Use G_GUINT64_FORMAT instead of %llu or lld
+	  for Timespec seconds.
+	* src/app-utils/gnc-ui-util.c:
+	  Fix 64-bit compile issues:
+	  - Use QOF_SCANF_LLD instead of GNC_SCANF_LLD.
+	  - Use QOF_SCANF_LLD and G_GINT64_FORMAT properly.
+	  - replace %lld with G_GINT64_FORMAT
+
 2006-04-13  David Hampton  <hampton at employees.org>
 
 	* src/register/ledger-core/gnc-ledger-display.c:

Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c	2006-04-14 05:37:34 UTC (rev 13779)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c	2006-04-14 16:45:10 UTC (rev 13780)
@@ -61,15 +61,6 @@
 static gboolean reverse_balance_inited = FALSE;
 static gboolean reverse_type[NUM_ACCOUNT_TYPES];
 
-/* FIXME: xaccParseAmountExtended causes test-print-parse-amount 
-to fail if GNC_SCANF_LLD is simply replaced by G_GINT64_FORMAT. Why?
-*/
-#if HAVE_SCANF_LLD
-# define GNC_SCANF_LLD "%lld" /**< \deprecated use G_GINT64_FORMAT instead. */
-#else
-# define GNC_SCANF_LLD "%qd"  /**< \deprecated use G_GINT64_FORMAT instead. */
-#endif
-
 /* Cache currency ISO codes and only look them up in gconf when
  * absolutely necessary. Can't cache a pointer to the data structure
  * as that will change any time the book changes. */
@@ -1254,7 +1245,7 @@
   }
 
   /* print the integer part without separators */
-  sprintf(temp_buf, GNC_SCANF_LLD, whole.num);
+  sprintf(temp_buf, "%" G_GINT64_FORMAT, whole.num);
   num_whole_digits = strlen (temp_buf);
 
   if (!info->use_separators)
@@ -1640,6 +1631,10 @@
 				 group_separator, group, NULL, result, endstr);
 }
 
+/* Note: xaccParseAmountExtended causes test-print-parse-amount 
+to fail if QOF_SCANF_LLD is simply replaced by G_GINT64_FORMAT. Why?
+A: Because scanf and printf use different symbols for 64-bit numbers.
+*/
 gboolean
 xaccParseAmountExtended (const char * in_str, gboolean monetary,
 			 gunichar negative_sign, gunichar decimal_point,
@@ -1931,7 +1926,7 @@
     {
       *out = '\0';
 
-      if (*out_str != '\0' && sscanf(out_str, GNC_SCANF_LLD, &numer) < 1)
+      if (*out_str != '\0' && sscanf(out_str, QOF_SCANF_LLD, &numer) < 1)
       {
         next_state = NO_NUM_ST;
       }
@@ -2024,7 +2019,7 @@
       len = 8;
     }
 
-    if (sscanf (out_str, GNC_SCANF_LLD, &fraction) < 1)
+    if (sscanf (out_str, QOF_SCANF_LLD, &fraction) < 1)
     {
       g_free(out_str);
       return FALSE;

Modified: gnucash/trunk/src/backend/file/test/test-dom-converters1.c
===================================================================
--- gnucash/trunk/src/backend/file/test/test-dom-converters1.c	2006-04-14 05:37:34 UTC (rev 13779)
+++ gnucash/trunk/src/backend/file/test/test-dom-converters1.c	2006-04-14 16:45:10 UTC (rev 13780)
@@ -156,7 +156,7 @@
             printf("Node looks like:\n");
             xmlElemDump(stdout, NULL, test_node);
             printf("\n");
-            printf("Secs are %lld vs %lld :: ",
+            printf("Secs are %" G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT " :: ",
                    test_spec1->tv_sec,
                    test_spec2.tv_sec);
             printf("NSecs are %ld vs %ld\n",

Modified: gnucash/trunk/src/engine/Transaction.c
===================================================================
--- gnucash/trunk/src/engine/Transaction.c	2006-04-14 05:37:34 UTC (rev 13779)
+++ gnucash/trunk/src/engine/Transaction.c	2006-04-14 16:45:10 UTC (rev 13780)
@@ -1253,7 +1253,7 @@
 {
     qof_begin_edit(QOF_INSTANCE(trans));
 
-    PINFO ("addr=%p set date to %llu.%09ld %s",
+    PINFO ("addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s",
            trans, val.tv_sec, val.tv_nsec, 
            ctime (({time_t secs = (time_t) val.tv_sec; &secs;})));
     

Modified: gnucash/trunk/src/engine/test/test-date.c
===================================================================
--- gnucash/trunk/src/engine/test/test-date.c	2006-04-14 05:37:34 UTC (rev 13779)
+++ gnucash/trunk/src/engine/test/test-date.c	2006-04-14 16:45:10 UTC (rev 13780)
@@ -69,8 +69,8 @@
   if ((expected_ts.tv_sec != ts.tv_sec) || (expected_ts.tv_nsec != ts.tv_nsec)) 
   {
     fprintf (stderr, 
-             "\nmis-converted \"%s\" to %lld.%09ld seconds\n"
-             "\twas expecting %lld.%09ld seconds\n", 
+             "\nmis-converted \"%s\" to %" G_GUINT64_FORMAT ".%09ld seconds\n"
+             "\twas expecting %" G_GUINT64_FORMAT ".%09ld seconds\n", 
              str, ts.tv_sec, ts.tv_nsec, 
              expected_ts.tv_sec, expected_ts.tv_nsec); 
     failure ("misconverted timespec");



More information about the gnucash-changes mailing list