[evolution-ews/gnome-3-16] Avoid %ld in printf formats



commit 851184db6793c68936085e209516b7cf43287e8d
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 27 15:24:12 2015 +0200

    Avoid %ld in printf formats
    
    This doesn't work for 32-bit compilation, rather use G_GINT64_FORMAT
    and cast the argument into gint64.

 src/addressbook/e-book-backend-ews.c |    6 +++---
 src/addressbook/mspack/lzxd.c        |    3 ++-
 src/server/e-soap-message.c          |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index c4caca4..f021aa4 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -214,7 +214,7 @@ static gboolean ebews_bump_revision (EBookBackendEws *ebews, GError **error)
 
        /* rev_counter is protected by the EBookSqlite lock. We only ever
         * call ebews_bump_revision() under e_book_sqlite_lock() */
-       prop_value = g_strdup_printf ("%ld(%d)", (long) t, ++ebews->priv->rev_counter);
+       prop_value = g_strdup_printf ("%" G_GINT64_FORMAT "(%d)", (gint64) t, ++ebews->priv->rev_counter);
 
        ret = e_book_sqlite_set_key_value (ebews->priv->summary, "revision",
                                           prop_value, error);
@@ -2626,8 +2626,8 @@ ews_replace_gal_in_db (EBookBackendEws *cbews,
        }
 
        t2 = g_get_monotonic_time ();
-       d (g_print("GAL update completed %ssuccessfully in %ld µs. Added: %d, Changed: %d, Unchanged %d, 
Removed: %d\n",
-                  ret ? "" : "un", t2 - t1,
+       d (g_print("GAL update completed %ssuccessfully in %" G_GINT64_FORMAT " µs. Added: %d, Changed: %d, 
Unchanged %d, Removed: %d\n",
+                  ret ? "" : "un", (gint64) (t2 - t1),
                   data.added, data.changed, data.unchanged, g_slist_length(stale_uids)));
 
        g_slist_free (stale_uids);
diff --git a/src/addressbook/mspack/lzxd.c b/src/addressbook/mspack/lzxd.c
index efb584b..29daeb4 100644
--- a/src/addressbook/mspack/lzxd.c
+++ b/src/addressbook/mspack/lzxd.c
@@ -13,6 +13,7 @@
 /* LZX decompression implementation */
 
 #include "lzx.h"
+#include <glib.h>
 
 /* Microsoft's LZX document (in cab-sdk.exe) and their implementation
  * of the com.ms.util.cab Java package do not concur.
@@ -804,7 +805,7 @@ int ews_lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
 
     /* check that we've used all of the previous frame first */
     if (lzx->o_ptr != lzx->o_end) {
-      D(("%ld avail bytes, new %d frame", lzx->o_end-lzx->o_ptr, frame_size))
+      D(("%" G_GINT64_FORMAT " avail bytes, new %d frame", (gint64) (lzx->o_end - lzx->o_ptr), frame_size))
       return lzx->error = LZX_ERR_DECRUNCH;
     }
 
diff --git a/src/server/e-soap-message.c b/src/server/e-soap-message.c
index 3cb347a..5628077 100644
--- a/src/server/e-soap-message.c
+++ b/src/server/e-soap-message.c
@@ -801,7 +801,7 @@ e_soap_message_write_int (ESoapMessage *msg,
 
        g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
 
-       string = g_strdup_printf ("%ld", i);
+       string = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) i);
        e_soap_message_write_string (msg, string);
        g_free (string);
 }


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