gnucash maint: Use PRIi64 instead of PRIx64

Geert Janssens gjanssens at code.gnucash.org
Thu Mar 17 17:12:01 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/c2ce2044 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a27abf76 (commit)



commit c2ce20443453f8a9f1f1e9b1a26eabfb1a029122
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Thu Mar 17 23:06:52 2016 +0100

    Use PRIi64 instead of PRIx64
    
    We obviously want our business counters to use integral numbers instead of hexadecimal...

diff --git a/src/libqof/qof/qofbook.c b/src/libqof/qof/qofbook.c
index c789ada..b8e5fac 100644
--- a/src/libqof/qof/qofbook.c
+++ b/src/libqof/qof/qofbook.c
@@ -513,7 +513,7 @@ qof_book_get_counter_format(const QofBook *book, const char *counter_name)
     if (!norm_format)
     {
         /* Use the default format */
-        norm_format = g_strdup ("%.6" PRIx64);
+        norm_format = g_strdup ("%.6" PRIi64);
     }
     return norm_format;
 }
@@ -525,7 +525,7 @@ qof_book_normalize_counter_format(const gchar *p, gchar **err_msg)
             G_GINT64_FORMAT,
             "lli",
             "I64i",
-            PRIx64,
+            PRIi64,
             "li",
             NULL,
     };
@@ -645,7 +645,7 @@ qof_book_normalize_counter_format_internal(const gchar *p,
 
     /* Copy the string we have so far and add normalized format specifier for long int */
     aux_str = g_strndup (base, p - base);
-    normalized_str = g_strconcat (aux_str, PRIx64, NULL);
+    normalized_str = g_strconcat (aux_str, PRIi64, NULL);
     g_free (aux_str);
 
     /* Skip length modifier / conversion specifier */
diff --git a/src/libqof/qof/test/test-qofbook.c b/src/libqof/qof/test/test-qofbook.c
index c11876c..697c2c6 100644
--- a/src/libqof/qof/test/test-qofbook.c
+++ b/src/libqof/qof/test/test-qofbook.c
@@ -147,7 +147,7 @@ test_book_normalize_counter( void )
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
@@ -157,7 +157,7 @@ test_book_normalize_counter( void )
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
@@ -167,47 +167,47 @@ test_book_normalize_counter( void )
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
-    /* Test the posix' PRIx64 */
-    r = qof_book_normalize_counter_format("Test - %" PRIx64, &err_msg);
+    /* Test the posix' PRIi64 */
+    r = qof_book_normalize_counter_format("Test - %" PRIi64, &err_msg);
     if (!r && g_test_verbose())
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
-    /* Test the posix' PRIx64 with precision field */
-    r = qof_book_normalize_counter_format("Test - %.3" PRIx64, &err_msg);
+    /* Test the posix' PRIi64 with precision field */
+    r = qof_book_normalize_counter_format("Test - %.3" PRIi64, &err_msg);
     if (!r && g_test_verbose())
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %.3" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %.3" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
-    /* Test the posix' PRIx64 with width field */
-    r = qof_book_normalize_counter_format("Test - %5" PRIx64, &err_msg);
+    /* Test the posix' PRIi64 with width field */
+    r = qof_book_normalize_counter_format("Test - %5" PRIi64, &err_msg);
     if (!r && g_test_verbose())
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %5" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %5" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
-    /* Test the posix' PRIx64 with width and precision field */
-    r = qof_book_normalize_counter_format("Test - %5.4" PRIx64, &err_msg);
+    /* Test the posix' PRIi64 with width and precision field */
+    r = qof_book_normalize_counter_format("Test - %5.4" PRIi64, &err_msg);
     if (!r && g_test_verbose())
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %5.4" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %5.4" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
@@ -217,7 +217,7 @@ test_book_normalize_counter( void )
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
@@ -227,7 +227,7 @@ test_book_normalize_counter( void )
     {
         g_test_message("Counter format normalization erroneously failed: %s", err_msg);
     }
-    g_assert_cmpstr( r, == , "Test - %" PRIx64);
+    g_assert_cmpstr( r, == , "Test - %" PRIi64);
     g_assert(err_msg == NULL);
     g_free(r);
 
@@ -366,11 +366,11 @@ test_book_get_counter_format ( Fixture *fixture, gconstpointer pData )
 
     g_test_message( "Testing counter format with existing counter" );
     r = qof_book_get_counter_format( fixture->book, counter_name );
-    g_assert_cmpstr( r, == , "%.6" PRIx64);
+    g_assert_cmpstr( r, == , "%.6" PRIi64);
 
     g_test_message( "Testing counter format for default value" );
     r = qof_book_get_counter_format( fixture->book, counter_name );
-    g_assert_cmpstr( r, == , "%.6" PRIx64);
+    g_assert_cmpstr( r, == , "%.6" PRIi64);
 }
 
 static void



Summary of changes:
 src/libqof/qof/qofbook.c           |  6 +++---
 src/libqof/qof/test/test-qofbook.c | 38 +++++++++++++++++++-------------------
 2 files changed, 22 insertions(+), 22 deletions(-)



More information about the gnucash-changes mailing list