[gjs/wip/ptomato/warnings: 10/14] tests: Fix format strings



commit 2c1eb214a1fb2831a87db6e0a162ddc6e4ac2a48
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Oct 2 15:49:14 2016 -0700

    tests: Fix format strings
    
    sscanf() needs a pointer to a char array, not a pointer to a pointer to a
    char array; and %lli is not the correct format specifier for gint64 on
    all platforms, but since those struct fields are longs anyway we may as
    well just print longs.

 test/gjs-test-coverage.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index c413c50..6b93874 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -576,7 +576,7 @@ branch_at_line_should_be_taken(const char *line,
     /* Advance past "BRDA:" */
     line += 5;
 
-    nmatches = sscanf(line, "%i,%i,%i,%19s", &line_no, &block_no, &branch_id, &hit_count);
+    nmatches = sscanf(line, "%i,%i,%i,%19s", &line_no, &block_no, &branch_id, hit_count);
     if (nmatches != 4) {
         if (errno != 0)
             g_error("sscanf: %s", strerror(errno));
@@ -1625,7 +1625,7 @@ test_coverage_cache_data_in_expected_format(gpointer      fixture_data,
                                                      &mtime);
     g_assert_true(successfully_got_mtime);
 
-    char    *mtime_string = g_strdup_printf("[%lli,%lli]", (gint64) mtime.tv_sec, (gint64) mtime.tv_usec);
+    char *mtime_string = g_strdup_printf("[%li,%li]", mtime.tv_sec, mtime.tv_usec);
     GString *expected_cache_object_notation = format_expected_cache_object_notation(mtime_string,
                                                                                     "null",
                                                                                     
fixture->base_fixture.temporary_js_script_filename,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]