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



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13780 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins
2006-04-14 16:45:10 +00:00
parent 4ee1e008a8
commit d9c78bd0fe
5 changed files with 24 additions and 16 deletions

View File

@@ -1,3 +1,16 @@
2006-04-14 Derek Atkins <derek@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@employees.org>
* src/register/ledger-core/gnc-ledger-display.c:

View File

@@ -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;

View File

@@ -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",

View File

@@ -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;})));

View File

@@ -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");