diff --git a/ChangeLog b/ChangeLog index 8f7ef2f16a..19159ec6d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-04-14 Derek Atkins + + * 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 * src/register/ledger-core/gnc-ledger-display.c: diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c index 34eff65190..73872bc671 100644 --- a/src/app-utils/gnc-ui-util.c +++ b/src/app-utils/gnc-ui-util.c @@ -61,15 +61,6 @@ static int auto_decimal_places = 2; /* default, can be changed */ 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 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info) } /* 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 @@ xaccParseAmount (const char * in_str, gboolean monetary, gnc_numeric *result, 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 @@ xaccParseAmountExtended (const char * in_str, gboolean monetary, { *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 @@ xaccParseAmountExtended (const char * in_str, gboolean monetary, 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; diff --git a/src/backend/file/test/test-dom-converters1.c b/src/backend/file/test/test-dom-converters1.c index aeb2baa4c2..8f64ebe6f0 100644 --- a/src/backend/file/test/test-dom-converters1.c +++ b/src/backend/file/test/test-dom-converters1.c @@ -156,7 +156,7 @@ test_dom_tree_to_timespec(void) 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", diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index e1d8d5fd84..5ad3fbf4bc 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1253,7 +1253,7 @@ xaccTransSetDateInternal(Transaction *trans, Timespec *dadate, Timespec val) { 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;}))); diff --git a/src/engine/test/test-date.c b/src/engine/test/test-date.c index 93cf3d9c13..4741ed3d6e 100644 --- a/src/engine/test/test-date.c +++ b/src/engine/test/test-date.c @@ -69,8 +69,8 @@ check_conversion (const char * str, Timespec expected_ts) 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");