[gtk-vnc] Fix many %d vs %u format warnings



commit 5c0cf32af9474a9b14f184fae2bacca35a9e396e
Author: Daniel P. Berrange <berrange redhat com>
Date:   Tue Aug 16 11:01:14 2016 +0100

    Fix many %d vs %u format warnings
    
    Newer gcc warning flags are better at catching misuse of
    %d vs %u
    
    Signed-off-by: Daniel P. Berrange <berrange redhat com>

 examples/gvncviewer.c     |    2 +-
 src/vncconnection.c       |   67 +++++++++++++++++++++++----------------------
 src/vncdisplay.c          |    4 +-
 src/vncimageframebuffer.c |    2 +-
 4 files changed, 38 insertions(+), 37 deletions(-)
---
diff --git a/examples/gvncviewer.c b/examples/gvncviewer.c
index 2ec8e0e..8dc2ab7 100644
--- a/examples/gvncviewer.c
+++ b/examples/gvncviewer.c
@@ -529,7 +529,7 @@ static void vnc_credential(GtkWidget *vncdisplay, GValueArray *credList)
     unsigned int i, prompt = 0;
     const char **data;
 
-    printf("Got credential request for %d credential(s)\n", credList->n_values);
+    printf("Got credential request for %u credential(s)\n", credList->n_values);
 
     data = g_new0(const char *, credList->n_values);
 
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 64f58dc..89f07d0 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -1440,7 +1440,7 @@ static int vnc_connection_validate_certificate(VncConnection *conn)
 
     for (i = 0 ; i < nCerts ; i++) {
         gnutls_x509_crt_t cert;
-        VNC_DEBUG ("Checking chain %d", i);
+        VNC_DEBUG ("Checking chain %u", i);
         if (gnutls_x509_crt_init (&cert) < 0) {
             vnc_connection_set_error(conn, "%s", "Unable to initialize cert");
             return FALSE;
@@ -1996,7 +1996,7 @@ gboolean vnc_connection_key_event(VncConnection *conn, gboolean down_flag,
     VncConnectionPrivate *priv = conn->priv;
     guint8 pad[2] = {0};
 
-    VNC_DEBUG("Key event %d %d %d Extended: %d", key, scancode, down_flag, priv->has_ext_key_event);
+    VNC_DEBUG("Key event %u %u %d Extended: %d", key, scancode, down_flag, priv->has_ext_key_event);
     if (priv->has_ext_key_event) {
         vnc_connection_buffered_write_u8(conn, VNC_CONNECTION_CLIENT_MESSAGE_QEMU);
         vnc_connection_buffered_write_u8(conn, VNC_CONNECTION_CLIENT_MESSAGE_QEMU_KEY);
@@ -3227,7 +3227,7 @@ static gboolean do_vnc_connection_audio_action(gpointer opaque)
     struct audio_action_data *data = opaque;
     VncConnectionPrivate *priv = data->conn->priv;
 
-    VNC_DEBUG("Audio action main context %d", data->action);
+    VNC_DEBUG("Audio action main context %u", data->action);
 
     switch (data->action) {
     case VNC_AUDIO_PLAYBACK_STOP:
@@ -3358,7 +3358,7 @@ static gboolean vnc_connection_server_message(VncConnection *conn)
         vnc_connection_read(conn, pad, 3);
         n_text = vnc_connection_read_u32(conn);
         if (n_text > (32 << 20)) {
-            vnc_connection_set_error(conn, "Cut text length %u longer than permitted %u",
+            vnc_connection_set_error(conn, "Cut text length %u longer than permitted %d",
                                      n_text, (32 << 20));
             break;
         }
@@ -3389,7 +3389,7 @@ static gboolean vnc_connection_server_message(VncConnection *conn)
                 n_length = vnc_connection_read_u32(conn);
                 if (n_length > (1024*1024)) {
                     vnc_connection_set_error(conn,
-                                             "Audio sample length %d longer than permitted %u",
+                                             "Audio sample length %u longer than permitted %d",
                                              n_length, 1024 * 1024);
                     break;
                 }
@@ -4041,7 +4041,7 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
         }
         ssf *= 8; /* key size is bytes, sasl wants bits */
 
-        VNC_DEBUG("Setting external SSF %d", ssf);
+        VNC_DEBUG("Setting external SSF %d", (int)ssf);
         err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf);
         if (err != SASL_OK) {
             vnc_connection_set_error(conn,
@@ -4074,7 +4074,7 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
         goto error;
     if (mechlistlen > SASL_MAX_MECHLIST_LEN) {
         vnc_connection_set_error(conn,
-                                 "mechlistlen %d too long",
+                                 "mechlistlen %u too long",
                                  mechlistlen);
         goto error;
     }
@@ -4117,12 +4117,12 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
         goto restart;
     }
 
-    VNC_DEBUG("Server start negotiation with mech %s. Data %d bytes %p '%s'",
+    VNC_DEBUG("Server start negotiation with mech %s. Data %u bytes %p '%s'",
               mechname, clientoutlen, clientout, clientout);
 
     if (clientoutlen > SASL_MAX_DATA_LEN) {
         vnc_connection_set_error(conn,
-                                 "SASL negotiation data too long: %d bytes",
+                                 "SASL negotiation data too long: %u bytes",
                                  clientoutlen);
         goto error;
     }
@@ -4150,7 +4150,7 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
         goto error;
     if (serverinlen > SASL_MAX_DATA_LEN) {
         vnc_connection_set_error(conn,
-                                 "SASL negotiation data too long: %d bytes",
+                                 "SASL negotiation data too long: %u bytes",
                                  clientoutlen);
         goto error;
     }
@@ -4168,7 +4168,7 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
     if (priv->coroutine_stop)
         goto error;
 
-    VNC_DEBUG("Client start result complete: %d. Data %d bytes %p '%s'",
+    VNC_DEBUG("Client start result complete: %d. Data %u bytes %p '%s'",
               complete, serverinlen, serverin, serverin);
 
     /* Previous server call showed completion & sasl_client_start() told us
@@ -4210,7 +4210,8 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
             serverin = NULL;
         }
 
-        VNC_DEBUG("Client step result %d. Data %d bytes %p '%s'", err, clientoutlen, clientout, clientout);
+        VNC_DEBUG("Client step result %d. Data %u bytes %p '%s'",
+                  err, clientoutlen, clientout, clientout);
 
         /* Previous server call showed completion & we're now locally complete too */
         if (complete && err == SASL_OK)
@@ -4229,14 +4230,14 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
         if (priv->coroutine_stop)
             goto error;
 
-        VNC_DEBUG("Server step with %d bytes %p", clientoutlen, clientout);
+        VNC_DEBUG("Server step with %u bytes %p", clientoutlen, clientout);
 
         serverinlen = vnc_connection_read_u32(conn);
         if (priv->coroutine_stop)
             goto error;
         if (serverinlen > SASL_MAX_DATA_LEN) {
             vnc_connection_set_error(conn,
-                                     "SASL negotiation data too long: %d bytes",
+                                     "SASL negotiation data too long: %u bytes",
                                      clientoutlen);
             goto error;
         }
@@ -4254,7 +4255,7 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
         if (priv->coroutine_stop)
             goto error;
 
-        VNC_DEBUG("Client step result complete: %d. Data %d bytes %p '%s'",
+        VNC_DEBUG("Client step result complete: %d. Data %u bytes %p '%s'",
                   complete, serverinlen, serverin, serverin);
 
         /* This server call shows complete, and earlier client step was OK */
@@ -4276,10 +4277,11 @@ static gboolean vnc_connection_perform_auth_sasl(VncConnection *conn)
             goto error;
         }
         ssf = *(const int *)val;
-        VNC_DEBUG("SASL SSF value %d", ssf);
+        VNC_DEBUG("SASL SSF value %d", (int)ssf);
         if (ssf < 56) { /* 56 == DES level, good for Kerberos */
             vnc_connection_set_error(conn,
-                                     "negotiated SSF %d was not strong enough", ssf);
+                                     "negotiated SSF %d was not strong enough",
+                                     (int)ssf);
             goto error;
         }
     }
@@ -4446,18 +4448,17 @@ static gboolean vnc_connection_perform_auth_tls(VncConnection *conn)
     VNC_DEBUG("Completed TLS setup");
 
     nauth = vnc_connection_read_u8(conn);
-    VNC_DEBUG("Got %d subauths", nauth);
     if (vnc_connection_has_error(conn))
         return FALSE;
 
-    VNC_DEBUG("Got %d subauths", nauth);
+    VNC_DEBUG("Got %u subauths", nauth);
     if (nauth == 0) {
         VNC_DEBUG("No sub-auth types requested");
         return vnc_connection_check_auth_result(conn);
     }
 
     if (nauth > sizeof(auth)) {
-        vnc_connection_set_error(conn, "Too many (%d) auth types", nauth);
+        vnc_connection_set_error(conn, "Too many (%u) auth types", nauth);
         return FALSE;
     }
     for (i = 0 ; i < nauth ; i++) {
@@ -4465,7 +4466,7 @@ static gboolean vnc_connection_perform_auth_tls(VncConnection *conn)
     }
 
     for (i = 0 ; i < nauth ; i++) {
-        VNC_DEBUG("Possible TLS sub-auth %d", auth[i]);
+        VNC_DEBUG("Possible TLS sub-auth %u", auth[i]);
     }
 
     if (priv->coroutine_stop)
@@ -4479,7 +4480,7 @@ static gboolean vnc_connection_perform_auth_tls(VncConnection *conn)
     if (priv->coroutine_stop)
         return FALSE;
 
-    VNC_DEBUG("Choose auth %d", priv->auth_subtype);
+    VNC_DEBUG("Choose auth %u", priv->auth_subtype);
 
     vnc_connection_write_u8(conn, priv->auth_subtype);
     vnc_connection_flush(conn);
@@ -4496,7 +4497,7 @@ static gboolean vnc_connection_perform_auth_tls(VncConnection *conn)
         return vnc_connection_perform_auth_sasl(conn);
 #endif
     default:
-        vnc_connection_set_error(conn, "Auth subtype %d is not supported",
+        vnc_connection_set_error(conn, "Auth subtype %u is not supported",
                                  priv->auth_subtype);
         return FALSE;
     }
@@ -4531,7 +4532,7 @@ static gboolean vnc_connection_perform_auth_vencrypt(VncConnection *conn)
 
     nauth = vnc_connection_read_u8(conn);
     if (nauth > (sizeof(auth)/sizeof(auth[0]))) {
-        vnc_connection_set_error(conn, "Too many (%d) auth types", nauth);
+        vnc_connection_set_error(conn, "Too many (%u) auth types", nauth);
         return FALSE;
     }
 
@@ -4540,7 +4541,7 @@ static gboolean vnc_connection_perform_auth_vencrypt(VncConnection *conn)
     }
 
     for (i = 0 ; i < nauth ; i++) {
-        VNC_DEBUG("Possible VeNCrypt sub-auth %d", auth[i]);
+        VNC_DEBUG("Possible VeNCrypt sub-auth %u", auth[i]);
     }
 
     if (priv->coroutine_stop)
@@ -4554,7 +4555,7 @@ static gboolean vnc_connection_perform_auth_vencrypt(VncConnection *conn)
     if (priv->coroutine_stop)
         return FALSE;
 
-    VNC_DEBUG("Choose auth %d", priv->auth_subtype);
+    VNC_DEBUG("Choose auth %u", priv->auth_subtype);
 
     if (!vnc_connection_gather_credentials(conn))
         return FALSE;
@@ -4572,7 +4573,7 @@ static gboolean vnc_connection_perform_auth_vencrypt(VncConnection *conn)
     status = vnc_connection_read_u8(conn);
     if (status != 1) {
         vnc_connection_set_error(conn,
-                                 "Server refused VeNCrypt auth %d %d", priv->auth_subtype, status);
+                                 "Server refused VeNCrypt auth %u %d", priv->auth_subtype, status);
         return FALSE;
     }
 
@@ -4590,7 +4591,7 @@ static gboolean vnc_connection_perform_auth_vencrypt(VncConnection *conn)
     if (!vnc_connection_start_tls(conn, anonTLS)) {
         return FALSE;
     }
-    VNC_DEBUG("Completed TLS setup, do subauth %d", priv->auth_subtype);
+    VNC_DEBUG("Completed TLS setup, do subauth %u", priv->auth_subtype);
 
     switch (priv->auth_subtype) {
         /* Plain certificate based auth */
@@ -4614,7 +4615,7 @@ static gboolean vnc_connection_perform_auth_vencrypt(VncConnection *conn)
 #endif
 
     default:
-        vnc_connection_set_error(conn, "Unknown auth subtype %d", priv->auth_subtype);
+        vnc_connection_set_error(conn, "Unknown auth subtype %u", priv->auth_subtype);
         return FALSE;
     }
 }
@@ -4716,7 +4717,7 @@ static gboolean vnc_connection_perform_auth(VncConnection *conn)
             sigdata.params.authUnsupported = priv->auth_type;
             vnc_connection_emit_main_context(conn, VNC_AUTH_UNSUPPORTED, &sigdata);
         }
-        vnc_connection_set_error(conn, "Unsupported auth type %d", priv->auth_type);
+        vnc_connection_set_error(conn, "Unsupported auth type %u", priv->auth_type);
         return FALSE;
     }
 
@@ -5651,7 +5652,7 @@ gboolean vnc_connection_set_auth_type(VncConnection *conn, unsigned int type)
         type != VNC_CONNECTION_AUTH_TLS &&
         type != VNC_CONNECTION_AUTH_VENCRYPT &&
         type != VNC_CONNECTION_AUTH_SASL) {
-        vnc_connection_set_error(conn, "Auth type %d is not supported",
+        vnc_connection_set_error(conn, "Auth type %u is not supported",
                                  type);
         g_signal_emit(conn, VNC_AUTH_UNSUPPORTED, 0, type);
         return !vnc_connection_has_error(conn);
@@ -5678,10 +5679,10 @@ gboolean vnc_connection_set_auth_subtype(VncConnection *conn, unsigned int type)
 {
     VncConnectionPrivate *priv = conn->priv;
 
-    VNC_DEBUG("Requested auth subtype %d", type);
+    VNC_DEBUG("Requested auth subtype %u", type);
     if (priv->auth_type != VNC_CONNECTION_AUTH_VENCRYPT &&
         priv->auth_type != VNC_CONNECTION_AUTH_TLS) {
-        vnc_connection_set_error(conn, "Auth type %d does not support subauth",
+        vnc_connection_set_error(conn, "Auth type %u does not support subauth",
                                  priv->auth_type);
         return !vnc_connection_has_error(conn);
     }
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 00714bd..070ab6c 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -968,7 +968,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
     if (priv->read_only)
         return FALSE;
 
-    VNC_DEBUG("%s keycode: %d  state: %d  group %d, keyval: %d",
+    VNC_DEBUG("%s keycode: %d  state: %u  group %d, keyval: %d",
               key->type == GDK_KEY_PRESS ? "press" : "release",
               key->hardware_keycode, key->state, key->group, keyval);
 
@@ -1509,7 +1509,7 @@ static void on_auth_choose_subtype(VncConnection *conn,
     } else if (type == VNC_CONNECTION_AUTH_VENCRYPT) {
         l = priv->preferable_vencrypt_subauths;
     } else {
-        VNC_DEBUG("Unexpected stackable auth type %d", type);
+        VNC_DEBUG("Unexpected stackable auth type %u", type);
         vnc_connection_shutdown(conn);
         return;
     }
diff --git a/src/vncimageframebuffer.c b/src/vncimageframebuffer.c
index 2bb7401..8fb015c 100644
--- a/src/vncimageframebuffer.c
+++ b/src/vncimageframebuffer.c
@@ -177,7 +177,7 @@ VncImageFramebuffer *vnc_image_framebuffer_new(GdkImage *image,
     pixels = image->mem;
 #endif
 
-    VNC_DEBUG("Visual mask: %3d %3d %3d\n      shift: %3d %3d %3d",
+    VNC_DEBUG("Visual mask: %3u %3u %3u\n      shift: %3d %3d %3d",
               red_mask,
               green_mask,
               blue_mask,


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