r14806 - gnucash/trunk - On Windows/mingw32, scanf only accepts %I64d for long long integers.
Christian Stimming
cstim at cvs.gnucash.org
Wed Sep 6 07:46:38 EDT 2006
Author: cstim
Date: 2006-09-06 07:46:36 -0400 (Wed, 06 Sep 2006)
New Revision: 14806
Trac: http://svn.gnucash.org/trac/changeset/14806
Modified:
gnucash/trunk/configure.in
gnucash/trunk/lib/libqof/qof/qofutil.h
gnucash/trunk/macros/legacy_macros.m4
Log:
On Windows/mingw32, scanf only accepts %I64d for long long integers.
Reference that gave me this hint: http://acm.pku.edu.cn/JudgeOnline/faq.htm
Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in 2006-09-06 11:07:57 UTC (rev 14805)
+++ gnucash/trunk/configure.in 2006-09-06 11:46:36 UTC (rev 14806)
@@ -135,7 +135,10 @@
SCANF_QD_CHECK
if test x$am_cv_scanf_qd = "xno"; then
- AC_MSG_ERROR([cannot continue, no long long conversion support in scanf])
+ SCANF_I64D_CHECK
+ if test x$am_cv_scanf_i64d = "xno"; then
+ AC_MSG_ERROR([Cannot continue, no long long conversion support in scanf.])
+ fi
fi
fi
Modified: gnucash/trunk/lib/libqof/qof/qofutil.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofutil.h 2006-09-06 11:07:57 UTC (rev 14805)
+++ gnucash/trunk/lib/libqof/qof/qofutil.h 2006-09-06 11:46:36 UTC (rev 14806)
@@ -48,7 +48,11 @@
# if HAVE_SCANF_QD
# define QOF_SCANF_LLD "%qd"
# else
-# error "No scanf format string is known for LLD. Fix your ./configure so that the correct one is detected!"
+# if HAVE_SCANF_I64D
+# define QOF_SCANF_LLD "%I64d"
+# else
+# error "No scanf format string is known for LLD. Fix your ./configure so that the correct one is detected!"
+# endif
# endif
#endif
Modified: gnucash/trunk/macros/legacy_macros.m4
===================================================================
--- gnucash/trunk/macros/legacy_macros.m4 2006-09-06 11:07:57 UTC (rev 14805)
+++ gnucash/trunk/macros/legacy_macros.m4 2006-09-06 11:46:36 UTC (rev 14806)
@@ -153,6 +153,36 @@
fi
])
+AC_DEFUN([SCANF_I64D_CHECK],
+[
+ AC_CACHE_CHECK([if scanf supports %I64d conversions],
+ am_cv_scanf_i64d,
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ()
+{
+ long long int d;
+ long long int e;
+
+ d = 0;
+ e = 100000;
+ e *= 100000;
+ if ((sscanf ("10000000000", "%I64d", &d) != 1) || (d != e))
+ exit (1);
+
+ exit (0);
+}
+],
+ am_cv_scanf_i64d=yes,
+ am_cv_scanf_i64d=no))
+ if test $am_cv_scanf_i64d = yes; then
+ AC_DEFINE(HAVE_SCANF_I64D, 1,
+ [Define if scanf supports %I64d conversions.])
+ fi
+])
+
AC_DEFUN([LANGINFO_D_FMT_CHECK],
[
AC_CACHE_CHECK([for nl_langinfo and D_FMT], am_cv_langinfo_dfmt,
More information about the gnucash-changes
mailing list