[Spice-devel] [PATCH spice-gtk 5/7] Fix many -Werror=format warnings

Marc-André Lureau marcandre.lureau at gmail.com
Mon May 30 17:31:19 UTC 2016


Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/channel-base.c                     |  2 +-
 src/channel-cursor.c                   |  2 +-
 src/channel-display-gst.c              |  4 +--
 src/channel-display-mjpeg.c            |  2 +-
 src/channel-display.c                  | 20 +++++++-------
 src/channel-main.c                     | 20 +++++++-------
 src/channel-playback.c                 |  4 +--
 src/channel-record.c                   |  2 +-
 src/channel-smartcard.c                |  8 +++---
 src/decode-glz.c                       |  4 +--
 src/spice-channel.c                    | 50 +++++++++++++++++-----------------
 src/spice-client-glib-usb-acl-helper.c |  2 +-
 src/spice-gstaudio.c                   |  4 +--
 src/spice-gtk-session.c                |  6 ++--
 src/spice-pulse.c                      |  8 +++---
 src/spice-session.c                    |  4 +--
 src/spice-util.c                       |  2 +-
 src/spice-widget-egl.c                 |  5 ++--
 src/spice-widget.c                     | 12 ++++----
 src/spicy-screenshot.c                 |  4 +--
 src/spicy-stats.c                      |  2 +-
 src/spicy.c                            |  2 +-
 src/usb-device-manager.c               |  2 +-
 src/usbutil.c                          |  2 +-
 24 files changed, 87 insertions(+), 86 deletions(-)

diff --git a/src/channel-base.c b/src/channel-base.c
index 20bb0cc..004dba9 100644
--- a/src/channel-base.c
+++ b/src/channel-base.c
@@ -77,7 +77,7 @@ spice_channel_handle_notify(SpiceChannel *channel, SpiceMsgIn *in)
 
     CHANNEL_DEBUG(channel, "%s -- %s%s #%u%s%.*s", __FUNCTION__,
             severity, visibility, notify->what,
-            message_str ? ": " : "", notify->message_len,
+            message_str ? ": " : "", (int)notify->message_len,
             message_str ? message_str : "");
 }
 
diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index 2ae8f86..609243b 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -304,7 +304,7 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor)
     guint8 *rgba;
     guint8 val;
 
-    CHANNEL_DEBUG(channel, "%s: flags %d, size %d", __FUNCTION__,
+    CHANNEL_DEBUG(channel, "%s: flags %x, size %u", __FUNCTION__,
                   scursor->flags, scursor->data_size);
 
     if (scursor->flags & SPICE_CURSOR_FLAGS_NONE)
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index f162078..7a33c49 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -369,7 +369,7 @@ static void spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
     SpiceStreamDataHeader *frame_op = spice_msg_in_parsed(frame_msg);
     if (frame_op->multi_media_time < decoder->last_mm_time) {
         SPICE_DEBUG("new-frame-time < last-frame-time (%u < %u):"
-                    " resetting stream, id %d",
+                    " resetting stream, id %u",
                     frame_op->multi_media_time,
                     decoder->last_mm_time, frame_op->id);
         /* Let GStreamer deal with the frame anyway */
@@ -405,7 +405,7 @@ static void spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
     g_mutex_unlock(&decoder->queues_mutex);
 
     if (gst_app_src_push_buffer(decoder->appsrc, buffer) != GST_FLOW_OK) {
-        SPICE_DEBUG("GStreamer error: unable to push frame of size %d", size);
+        SPICE_DEBUG("GStreamer error: unable to push frame of size %u", size);
         stream_dropped_frame_on_playback(decoder->base.stream);
     }
 }
diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index 1238b41..a2dae82 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -250,7 +250,7 @@ static void mjpeg_decoder_queue_frame(VideoDecoder *video_decoder,
         if (frame_op->multi_media_time < last_op->multi_media_time) {
             /* This should really not happen */
             SPICE_DEBUG("new-frame-time < last-frame-time (%u < %u):"
-                        " resetting stream, id %d",
+                        " resetting stream, id %u",
                         frame_op->multi_media_time,
                         last_op->multi_media_time, frame_op->id);
             mjpeg_decoder_drop_queue(decoder);
diff --git a/src/channel-display.c b/src/channel-display.c
index a1ed493..54bc30e 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1086,7 +1086,7 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
     SpiceMsgDisplayStreamCreate *op = spice_msg_in_parsed(in);
     display_stream *st;
 
-    CHANNEL_DEBUG(channel, "%s: id %d", __FUNCTION__, op->id);
+    CHANNEL_DEBUG(channel, "%s: id %u", __FUNCTION__, op->id);
 
     if (op->id >= c->nstreams) {
         int n = c->nstreams;
@@ -1127,7 +1127,7 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
 #endif
     }
     if (st->video_decoder == NULL) {
-        spice_printerr("could not create a video decoder for codec %d", op->codec_type);
+        spice_printerr("could not create a video decoder for codec %u", op->codec_type);
     }
 }
 
@@ -1349,7 +1349,7 @@ static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer dat
         if (c->streams[i] == NULL) {
             continue;
         }
-        SPICE_DEBUG("%s: stream-id %d", __FUNCTION__, i);
+        SPICE_DEBUG("%s: stream-id %u", __FUNCTION__, i);
         st = c->streams[i];
         st->video_decoder->reschedule(st->video_decoder);
     }
@@ -1374,7 +1374,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
     mmtime = stream_get_time(st);
 
     if (spice_msg_in_type(in) == SPICE_MSG_DISPLAY_STREAM_DATA_SIZED) {
-        CHANNEL_DEBUG(channel, "stream %d contains sized data", op->id);
+        CHANNEL_DEBUG(channel, "stream %u contains sized data", op->id);
     }
 
     if (op->multi_media_time == 0) {
@@ -1465,9 +1465,9 @@ static void destroy_stream(SpiceChannel *channel, int id)
         return;
 
     num_out_frames = st->num_input_frames - st->arrive_late_count - st->num_drops_on_playback;
-    CHANNEL_DEBUG(channel, "%s: id=%d #in-frames=%d out/in=%.2f "
-        "#drops-on-receive=%d avg-late-time(ms)=%.2f "
-        "#drops-on-playback=%d", __FUNCTION__,
+    CHANNEL_DEBUG(channel, "%s: id=%d #in-frames=%u out/in=%.2f "
+        "#drops-on-receive=%u avg-late-time(ms)=%.2f "
+        "#drops-on-playback=%u", __FUNCTION__,
         id,
         st->num_input_frames,
         num_out_frames / (double)st->num_input_frames,
@@ -1523,7 +1523,7 @@ static void display_handle_stream_destroy(SpiceChannel *channel, SpiceMsgIn *in)
     SpiceMsgDisplayStreamDestroy *op = spice_msg_in_parsed(in);
 
     g_return_if_fail(op != NULL);
-    CHANNEL_DEBUG(channel, "%s: id %d", __FUNCTION__, op->id);
+    CHANNEL_DEBUG(channel, "%s: id %u", __FUNCTION__, op->id);
     destroy_stream(channel, op->id);
 }
 
@@ -1665,7 +1665,7 @@ static void display_handle_surface_create(SpiceChannel *channel, SpiceMsgIn *in)
     surface->size   = surface->height * surface->stride;
 
     if (create->flags & SPICE_SURFACE_FLAGS_PRIMARY) {
-        SPICE_DEBUG("primary flags: %d", create->flags);
+        SPICE_DEBUG("primary flags: %x", create->flags);
         surface->primary = true;
         create_canvas(channel, surface);
         if (c->mark_false_event_id != 0) {
@@ -1800,7 +1800,7 @@ static void display_handle_gl_draw(SpiceChannel *channel, SpiceMsgIn *in)
 {
     SpiceMsgDisplayGlDraw *draw = spice_msg_in_parsed(in);
 
-    CHANNEL_DEBUG(channel, "gl draw %dx%d+%d+%d",
+    CHANNEL_DEBUG(channel, "gl draw %ux%u+%u+%u",
                   draw->w, draw->h, draw->x, draw->y);
 
     g_coroutine_signal_emit(channel, signals[SPICE_DISPLAY_GL_DRAW], 0,
diff --git a/src/channel-main.c b/src/channel-main.c
index 2f29312..efe7f4e 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1108,7 +1108,7 @@ static void monitors_align(VDAgentMonConfig *monitors, int nmonitors)
         monitors[j].y = 0;
         x += monitors[j].width;
         if (monitors[j].width || monitors[j].height)
-            SPICE_DEBUG("#%d +%d+%d-%dx%d", j, monitors[j].x, monitors[j].y,
+            SPICE_DEBUG("#%d +%d+%d-%ux%u", j, monitors[j].x, monitors[j].y,
                         monitors[j].width, monitors[j].height);
     }
     g_free(sorted_monitors);
@@ -1171,7 +1171,7 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
         mon->monitors[j].height = c->display[i].height;
         mon->monitors[j].x = c->display[i].x;
         mon->monitors[j].y = c->display[i].y;
-        CHANNEL_DEBUG(channel, "monitor #%d: %dx%d+%d+%d @ %d bpp", j,
+        CHANNEL_DEBUG(channel, "monitor #%d: %ux%u+%d+%d @ %u bpp", j,
                       mon->monitors[j].width, mon->monitors[j].height,
                       mon->monitors[j].x, mon->monitors[j].y,
                       mon->monitors[j].depth);
@@ -1967,7 +1967,7 @@ static void spice_file_transfer_task_handle_status(SpiceFileTransferTask *task,
     GError *error = NULL;
     g_return_if_fail(task != NULL);
 
-    SPICE_DEBUG("task %d received response %d", msg->id, msg->result);
+    SPICE_DEBUG("task %u received response %u", msg->id, msg->result);
 
     switch (msg->result) {
     case VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA:
@@ -2137,7 +2137,7 @@ static void main_agent_handle_msg(SpiceChannel *channel,
     case VD_AGENT_REPLY:
     {
         VDAgentReply *reply = payload;
-        SPICE_DEBUG("%s: reply: type %d, %s", __FUNCTION__, reply->type,
+        SPICE_DEBUG("%s: reply: type %u, %s", __FUNCTION__, reply->type,
                     reply->error == VD_AGENT_SUCCESS ? "success" : "error");
         break;
     }
@@ -2150,7 +2150,7 @@ static void main_agent_handle_msg(SpiceChannel *channel,
         if (task != NULL) {
             spice_file_transfer_task_handle_status(task, msg);
         } else {
-            SPICE_DEBUG("cannot find task %d", msg->id);
+            SPICE_DEBUG("cannot find task %u", msg->id);
         }
         break;
     }
@@ -2173,7 +2173,7 @@ static void main_handle_agent_data_msg(SpiceChannel* channel, int* msg_size, guc
         *msg_size -= n;
         *msg_pos += n;
         if (c->agent_msg_pos == sizeof(VDAgentMessage)) {
-            SPICE_DEBUG("agent msg start: msg_size=%d, protocol=%d, type=%d",
+            SPICE_DEBUG("agent msg start: msg_size=%u, protocol=%u, type=%u",
                         c->agent_msg.size, c->agent_msg.protocol, c->agent_msg.type);
             g_return_if_fail(c->agent_msg_data == NULL);
             c->agent_msg_data = g_malloc0(c->agent_msg.size);
@@ -2314,12 +2314,12 @@ static void migrate_channel_event_cb(SpiceChannel *channel, SpiceChannelEvent ev
             mig->nchannels--;
         }
 
-        SPICE_DEBUG("migration: channel opened chan:%p, left %d", channel, mig->nchannels);
+        SPICE_DEBUG("migration: channel opened chan:%p, left %u", channel, mig->nchannels);
         if (mig->nchannels == 0)
             coroutine_yieldto(mig->from, NULL);
         break;
     default:
-        CHANNEL_DEBUG(channel, "error or unhandled channel event during migration: %d", event);
+        CHANNEL_DEBUG(channel, "error or unhandled channel event during migration: %u", event);
         /* go back to main channel to report error */
         coroutine_yieldto(mig->from, NULL);
     }
@@ -2378,7 +2378,7 @@ static gboolean migrate_connect(gpointer data)
         host = info->host;
     } else {
         SpiceMigrationDstInfo *info = mig->info;
-        SPICE_DEBUG("migrate_begin %d %s %d %d",
+        SPICE_DEBUG("migrate_begin %u %s %d %d",
                     info->host_size, info->host_data, info->port, info->sport);
         port = info->port;
         sport = info->sport;
@@ -3109,7 +3109,7 @@ static void file_xfer_send_start_msg_async(SpiceMainChannel *channel,
         task->callback = callback;
         task->user_data = user_data;
 
-        CHANNEL_DEBUG(channel, "Insert a xfer task:%d to task list", task->id);
+        CHANNEL_DEBUG(channel, "Insert a xfer task:%u to task list", task->id);
         g_hash_table_insert(c->file_xfer_tasks,
                             GUINT_TO_POINTER(task->id),
                             task);
diff --git a/src/channel-playback.c b/src/channel-playback.c
index 8edcb22..39c2178 100644
--- a/src/channel-playback.c
+++ b/src/channel-playback.c
@@ -346,7 +346,7 @@ static void playback_handle_mode(SpiceChannel *channel, SpiceMsgIn *in)
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv;
     SpiceMsgPlaybackMode *mode = spice_msg_in_parsed(in);
 
-    CHANNEL_DEBUG(channel, "%s: time %u mode %d data %p size %d", __FUNCTION__,
+    CHANNEL_DEBUG(channel, "%s: time %u mode %u data %p size %u", __FUNCTION__,
                   mode->time, mode->mode, mode->data, mode->data_size);
 
     c->mode = mode->mode;
@@ -367,7 +367,7 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv;
     SpiceMsgPlaybackStart *start = spice_msg_in_parsed(in);
 
-    CHANNEL_DEBUG(channel, "%s: fmt %d channels %d freq %d time %d", __FUNCTION__,
+    CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u time %u", __FUNCTION__,
                   start->format, start->channels, start->frequency, start->time);
 
     c->frame_count = 0;
diff --git a/src/channel-record.c b/src/channel-record.c
index 09598b7..c1d9afa 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -405,7 +405,7 @@ static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
 
     c->mode = spice_record_desired_mode(channel, start->frequency);
 
-    CHANNEL_DEBUG(channel, "%s: fmt %d channels %d freq %d", __FUNCTION__,
+    CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u", __FUNCTION__,
                   start->format, start->channels, start->frequency);
 
     g_return_if_fail(start->format == SPICE_AUDIO_FMT_S16);
diff --git a/src/channel-smartcard.c b/src/channel-smartcard.c
index 09e784d..e086e92 100644
--- a/src/channel-smartcard.c
+++ b/src/channel-smartcard.c
@@ -316,7 +316,7 @@ static void smartcard_message_send(SpiceSmartcardChannel *channel,
     if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
         return;
 
-    CHANNEL_DEBUG(channel, "send message %d, %s",
+    CHANNEL_DEBUG(channel, "send message %u, %s",
                   msg_type, queue ? "queued" : "now");
     if (!queue) {
         spice_msg_out_send(msg_out);
@@ -496,11 +496,11 @@ static void handle_smartcard_msg(SpiceChannel *channel, SpiceMsgIn *in)
     SpiceMsgSmartcard *msg = spice_msg_in_parsed(in);
     VReader *reader;
 
-    CHANNEL_DEBUG(channel, "handle msg %d", msg->type);
+    CHANNEL_DEBUG(channel, "handle msg %u", msg->type);
     switch (msg->type) {
         case VSC_Error:
             g_return_if_fail(priv->in_flight_message != NULL);
-            CHANNEL_DEBUG(channel, "in flight %d", priv->in_flight_message->message_type);
+            CHANNEL_DEBUG(channel, "in flight %u", priv->in_flight_message->message_type);
             switch (priv->in_flight_message->message_type) {
                 case VSC_ReaderAdd:
                     g_return_if_fail(priv->pending_reader_additions != NULL);
@@ -529,7 +529,7 @@ static void handle_smartcard_msg(SpiceChannel *channel, SpiceMsgIn *in)
                 case VSC_ReaderRemove:
                     break;
                 default:
-                    g_warning("Unexpected message: %d", priv->in_flight_message->message_type);
+                    g_warning("Unexpected message: %u", priv->in_flight_message->message_type);
                     break;
             }
             smartcard_message_complete_in_flight(smartcard_channel);
diff --git a/src/decode-glz.c b/src/decode-glz.c
index b7dd2e6..d5b72ab 100644
--- a/src/decode-glz.c
+++ b/src/decode-glz.c
@@ -92,7 +92,7 @@ static void glz_decoder_window_resize(SpiceGlzDecoderWindow *w)
     struct glz_image  **new_images;
     int i, new_slot;
 
-    SPICE_DEBUG("%s: array resize %d -> %d", __FUNCTION__,
+    SPICE_DEBUG("%s: array resize %u -> %u", __FUNCTION__,
                 w->nimages, w->nimages * 2);
     new_images = g_new0(struct glz_image*, w->nimages * 2);
     for (i = 0; i < w->nimages; i++) {
@@ -367,7 +367,7 @@ static void decode_header(GlibGlzDecoder *d)
     d->image.id = decode_64(d);
     d->image.win_head_dist = decode_32(d);
 
-    SPICE_DEBUG("%s: %dx%d, id %" PRId64 ", ref %" PRId64,
+    SPICE_DEBUG("%s: %ux%u, id %" PRIu64 ", ref %" PRIu64,
             __FUNCTION__,
             d->image.width, d->image.height, d->image.id,
             d->image.id - d->image.win_head_dist);
diff --git a/src/spice-channel.c b/src/spice-channel.c
index c555f75..27144b5 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -568,7 +568,7 @@ void spice_msg_in_hexdump(SpiceMsgIn *in)
 {
     SpiceChannelPrivate *c = in->channel->priv;
 
-    fprintf(stderr, "--\n<< hdr: %s serial %" PRIu64 " type %d size %d sub-list %d\n",
+    fprintf(stderr, "--\n<< hdr: %s serial %" PRIu64 " type %u size %u sub-list %u\n",
             c->name, spice_header_get_in_msg_serial(in),
             spice_header_get_msg_type(in->header, c->use_mini_header),
             spice_header_get_msg_size(in->header, c->use_mini_header),
@@ -581,7 +581,7 @@ void spice_msg_out_hexdump(SpiceMsgOut *out, unsigned char *data, int len)
 {
     SpiceChannelPrivate *c = out->channel->priv;
 
-    fprintf(stderr, "--\n>> hdr: %s serial %" PRIu64 " type %d size %d sub-list %d\n",
+    fprintf(stderr, "--\n>> hdr: %s serial %" PRIu64 " type %u size %u sub-list %u\n",
             c->name,
             spice_header_get_out_msg_serial(out),
             spice_header_get_msg_type(out->header, c->use_mini_header),
@@ -1185,7 +1185,7 @@ static gboolean spice_channel_recv_auth(SpiceChannel *channel)
     }
 
     if (link_res != SPICE_LINK_ERR_OK) {
-        CHANNEL_DEBUG(channel, "link result: reply %d", link_res);
+        CHANNEL_DEBUG(channel, "link result: reply %u", link_res);
         spice_channel_failed_authentication(channel, FALSE);
         return FALSE;
     }
@@ -1209,7 +1209,7 @@ void spice_channel_up(SpiceChannel *channel)
 {
     SpiceChannelPrivate *c = channel->priv;
 
-    CHANNEL_DEBUG(channel, "channel up, state %d", c->state);
+    CHANNEL_DEBUG(channel, "channel up, state %u", c->state);
 
     if (SPICE_CHANNEL_GET_CLASS(channel)->channel_up)
         SPICE_CHANNEL_GET_CLASS(channel)->channel_up(channel);
@@ -1272,7 +1272,7 @@ static void spice_channel_send_link(SpiceChannel *channel)
         *(uint32_t *)p = GUINT32_TO_LE(g_array_index(c->caps, uint32_t, i));
         p += sizeof(uint32_t);
     }
-    CHANNEL_DEBUG(channel, "channel type %d id %d num common caps %d num caps %d",
+    CHANNEL_DEBUG(channel, "channel type %d id %d num common caps %u num caps %u",
                   c->channel_type,
                   c->channel_id,
                   c->common_caps->len,
@@ -1298,11 +1298,11 @@ static gboolean spice_channel_recv_link_hdr(SpiceChannel *channel)
         goto error;
     }
 
-    CHANNEL_DEBUG(channel, "Peer version: %d:%d",
+    CHANNEL_DEBUG(channel, "Peer version: %u:%u",
                   GUINT32_FROM_LE(c->peer_hdr.major_version),
                   GUINT32_FROM_LE(c->peer_hdr.minor_version));
     if (c->peer_hdr.major_version != c->link_hdr.major_version) {
-        g_warning("major mismatch (got %d, expected %d)",
+        g_warning("major mismatch (got %u, expected %u)",
                   c->peer_hdr.major_version, c->link_hdr.major_version);
         goto error;
     }
@@ -1567,7 +1567,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
     if (c->has_error)
         goto error;
     if (len > SASL_MAX_MECHLIST_LEN) {
-        g_critical("mechlistlen %d too long", len);
+        g_critical("mechlistlen %u too long", len);
         goto error;
     }
 
@@ -1602,11 +1602,11 @@ restart:
         goto restart;
     }
 
-    CHANNEL_DEBUG(channel, "Server start negotiation with mech %s. Data %d bytes %p '%s'",
+    CHANNEL_DEBUG(channel, "Server start negotiation with mech %s. Data %u bytes %p '%s'",
                   mechname, clientoutlen, clientout, clientout);
 
     if (clientoutlen > SASL_MAX_DATA_LEN) {
-        g_critical("SASL negotiation data too long: %d bytes",
+        g_critical("SASL negotiation data too long: %u bytes",
                    clientoutlen);
         goto error;
     }
@@ -1635,7 +1635,7 @@ restart:
     if (c->has_error)
         goto error;
     if (len > SASL_MAX_DATA_LEN) {
-        g_critical("SASL negotiation data too long: %d bytes",
+        g_critical("SASL negotiation data too long: %u bytes",
                    len);
         goto error;
     }
@@ -1653,7 +1653,7 @@ restart:
     if (c->has_error)
         goto error;
 
-    CHANNEL_DEBUG(channel, "Client start result complete: %d. Data %d bytes %p '%s'",
+    CHANNEL_DEBUG(channel, "Client start result complete: %d. Data %u bytes %p '%s'",
                 complete, len, serverin, serverin);
 
     /* Loop-the-loop...
@@ -1688,7 +1688,7 @@ restart:
 
         g_clear_pointer(&serverin, g_free);
 
-        CHANNEL_DEBUG(channel, "Client step result %d. Data %d bytes %p '%s'", err, clientoutlen, clientout, clientout);
+        CHANNEL_DEBUG(channel, "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)
@@ -1709,13 +1709,13 @@ restart:
         if (c->has_error)
             goto error;
 
-        CHANNEL_DEBUG(channel, "Server step with %d bytes %p", clientoutlen, clientout);
+        CHANNEL_DEBUG(channel, "Server step with %u bytes %p", clientoutlen, clientout);
 
         spice_channel_read(channel, &len, sizeof(guint32));
         if (c->has_error)
             goto error;
         if (len > SASL_MAX_DATA_LEN) {
-            g_critical("SASL negotiation data too long: %d bytes", len);
+            g_critical("SASL negotiation data too long: %u bytes", len);
             goto error;
         }
 
@@ -1733,7 +1733,7 @@ restart:
         if (c->has_error)
             goto error;
 
-        CHANNEL_DEBUG(channel, "Client step result complete: %d. Data %d bytes %p '%s'",
+        CHANNEL_DEBUG(channel, "Client step result complete: %d. Data %u bytes %p '%s'",
                     complete, len, serverin, serverin);
 
         /* This server call shows complete, and earlier client step was OK */
@@ -1754,9 +1754,9 @@ restart:
             goto error;
         }
         ssf = *(const int *)val;
-        CHANNEL_DEBUG(channel, "SASL SSF value %d", ssf);
+        CHANNEL_DEBUG(channel, "SASL SSF value %u", ssf);
         if (ssf < 56) { /* 56 == DES level, good for Kerberos */
-            g_critical("negotiation SSF %d was not strong enough", ssf);
+            g_critical("negotiation SSF %u was not strong enough", ssf);
             goto error;
         }
     }
@@ -1807,7 +1807,7 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
                             c->peer_hdr.size - c->peer_pos);
     c->peer_pos += rc;
     if (c->peer_pos != c->peer_hdr.size) {
-        g_critical("%s: %s: incomplete link reply (%d/%d)",
+        g_critical("%s: %s: incomplete link reply (%d/%u)",
                   c->name, __FUNCTION__, rc, c->peer_hdr.size);
         goto error;
     }
@@ -1821,7 +1821,7 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
         c->tls = TRUE;
         return FALSE;
     default:
-        g_warning("%s: %s: unhandled error %d",
+        g_warning("%s: %s: unhandled error %u",
                 c->name, __FUNCTION__, c->peer_msg->error);
         goto error;
     }
@@ -1840,13 +1840,13 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
     g_array_set_size(c->remote_common_caps, num_common_caps);
     for (i = 0; i < num_common_caps; i++, caps++) {
         g_array_index(c->remote_common_caps, uint32_t, i) = GUINT32_FROM_LE(*caps);
-        CHANNEL_DEBUG(channel, "got common caps %u:0x%X", i, GUINT32_FROM_LE(*caps));
+        CHANNEL_DEBUG(channel, "got common caps %d:0x%X", i, GUINT32_FROM_LE(*caps));
     }
 
     g_array_set_size(c->remote_caps, num_channel_caps);
     for (i = 0; i < num_channel_caps; i++, caps++) {
         g_array_index(c->remote_caps, uint32_t, i) = GUINT32_FROM_LE(*caps);
-        CHANNEL_DEBUG(channel, "got channel caps %u:0x%X", i, GUINT32_FROM_LE(*caps));
+        CHANNEL_DEBUG(channel, "got channel caps %d:0x%X", i, GUINT32_FROM_LE(*caps));
     }
 
     if (!spice_channel_test_common_capability(channel,
@@ -2680,7 +2680,7 @@ gboolean spice_channel_open_fd(SpiceChannel *channel, int fd)
 
     c = channel->priv;
     if (c->state > SPICE_CHANNEL_STATE_CONNECTING) {
-        g_warning("Invalid channel_connect state: %d", c->state);
+        g_warning("Invalid channel_connect state: %u", c->state);
         return true;
     }
 
@@ -2769,7 +2769,7 @@ void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent reason)
 {
     SpiceChannelPrivate *c;
 
-    CHANNEL_DEBUG(channel, "channel disconnect %d", reason);
+    CHANNEL_DEBUG(channel, "channel disconnect %u", reason);
 
     g_return_if_fail(SPICE_IS_CHANNEL(channel));
     g_return_if_fail(channel->priv != NULL);
@@ -2807,7 +2807,7 @@ static gboolean test_capability(GArray *caps, guint32 cap)
     c = g_array_index(caps, guint32, word_index);
     ret = (c & (1 << (cap % 32))) != 0;
 
-    SPICE_DEBUG("test cap %d in 0x%X: %s", cap, c, ret ? "yes" : "no");
+    SPICE_DEBUG("test cap %u in 0x%X: %s", cap, c, ret ? "yes" : "no");
     return ret;
 }
 
diff --git a/src/spice-client-glib-usb-acl-helper.c b/src/spice-client-glib-usb-acl-helper.c
index 03a0317..80cdced 100644
--- a/src/spice-client-glib-usb-acl-helper.c
+++ b/src/spice-client-glib-usb-acl-helper.c
@@ -286,7 +286,7 @@ static void stdin_read_complete(GObject *src, GAsyncResult *res, gpointer data)
                                             NULL, stdin_read_complete, NULL);
         break;
     default:
-        FATAL_ERROR("Unexpected extra input in state %d: %s\n", state, s);
+        FATAL_ERROR("Unexpected extra input in state %u: %s\n", state, s);
     }
     g_free(s);
 }
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 12e6d66..1d96c77 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -395,7 +395,7 @@ static void playback_mute_changed(GObject *object, GParamSpec *pspec, gpointer d
         return;
 
     g_object_get(object, "mute", &mute, NULL);
-    SPICE_DEBUG("playback mute changed to %u", mute);
+    SPICE_DEBUG("playback mute changed to %d", mute);
 
     if (GST_IS_BIN(p->playback.sink))
         e = gst_bin_get_by_interface(GST_BIN(p->playback.sink), GST_TYPE_STREAM_VOLUME);
@@ -457,7 +457,7 @@ static void record_mute_changed(GObject *object, GParamSpec *pspec, gpointer dat
         return;
 
     g_object_get(object, "mute", &mute, NULL);
-    SPICE_DEBUG("record mute changed to %u", mute);
+    SPICE_DEBUG("record mute changed to %d", mute);
 
     if (GST_IS_BIN(p->record.src))
         e = gst_bin_get_by_interface(GST_BIN(p->record.src), GST_TYPE_STREAM_VOLUME);
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index bbcbeeb..6cdae87 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -183,7 +183,7 @@ static void spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSessio
                                                                   SpiceInputsChannel* inputs,
                                                                   gboolean force)
 {
-    gint guest_modifiers = 0, client_modifiers = 0;
+    guint32 guest_modifiers = 0, client_modifiers = 0;
 
     g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs));
 
@@ -511,7 +511,7 @@ static GtkClipboard* get_clipboard_from_selection(SpiceGtkSessionPrivate *s,
     } else if (selection == VD_AGENT_CLIPBOARD_SELECTION_PRIMARY) {
         return s->clipboard_primary;
     } else {
-        g_warning("Unhandled clipboard selection: %d", selection);
+        g_warning("Unhandled clipboard selection: %u", selection);
         return NULL;
     }
 }
@@ -864,7 +864,7 @@ static gboolean clipboard_grab(SpiceMainChannel *main, guint selection,
             }
         }
         if (!found) {
-            g_warning("clipboard: couldn't find a matching type for: %d",
+            g_warning("clipboard: couldn't find a matching type for: %u",
                       types[n]);
         }
     }
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index fd5fe91..5248bc3 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -644,7 +644,7 @@ static void playback_mute_changed(GObject *object, GParamSpec *pspec, gpointer d
     pa_operation *op;
 
     g_object_get(object, "mute", &mute, NULL);
-    SPICE_DEBUG("playback mute changed %u", mute);
+    SPICE_DEBUG("playback mute changed %d", mute);
 
     if (!p->playback.stream ||
         pa_stream_get_index(p->playback.stream) == PA_INVALID_INDEX)
@@ -687,7 +687,7 @@ static void record_mute_changed(GObject *object, GParamSpec *pspec, gpointer dat
     pa_operation *op;
 
     g_object_get(object, "mute", &mute, NULL);
-    SPICE_DEBUG("record mute changed %u", mute);
+    SPICE_DEBUG("record mute changed %d", mute);
 
     if (!p->record.stream ||
         pa_stream_get_device_index(p->record.stream) == PA_INVALID_INDEX)
@@ -996,7 +996,7 @@ static void spice_pulse_complete_async_task(struct async_task *task, const gchar
     complete_task(task->pulse, task, err_msg);
     if (p->results != NULL) {
         p->results = g_list_remove(p->results, task);
-        SPICE_DEBUG("Number of async task is %d", g_list_length(p->results));
+        SPICE_DEBUG("Number of async task is %u", g_list_length(p->results));
     }
     free_async_task(task);
 }
@@ -1205,7 +1205,7 @@ static void pulse_stream_restore_info_async(gboolean is_playback,
     }
 
     p->results = g_list_append(p->results, task);
-    SPICE_DEBUG ("Number of async task is %d", g_list_length(p->results));
+    SPICE_DEBUG ("Number of async task is %u", g_list_length(p->results));
     return;
 
 fail:
diff --git a/src/spice-session.c b/src/spice-session.c
index e02d684..8b3cdd0 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -1694,7 +1694,7 @@ void spice_session_start_migrating(SpiceSession *session,
 
     g_warn_if_fail(ring_get_length(&s->channels) == ring_get_length(&m->channels));
 
-    SPICE_DEBUG("migration channels left:%d (in migration:%d)",
+    SPICE_DEBUG("migration channels left:%u (in migration:%u)",
                 ring_get_length(&s->channels), ring_get_length(&m->channels));
     s->migration_left = spice_session_get_channels(session);
 }
@@ -1931,7 +1931,7 @@ void spice_session_disconnect(SpiceSession *session)
 
     s = session->priv;
 
-    SPICE_DEBUG("session: disconnecting %d", s->disconnecting);
+    SPICE_DEBUG("session: disconnecting %u", s->disconnecting);
     if (s->disconnecting != 0)
         return;
 
diff --git a/src/spice-util.c b/src/spice-util.c
index 6b1f8e5..7788921 100644
--- a/src/spice-util.c
+++ b/src/spice-util.c
@@ -266,7 +266,7 @@ const gchar* spice_yes_no(gboolean value)
 G_GNUC_INTERNAL
 guint16 spice_make_scancode(guint scancode, gboolean release)
 {
-    SPICE_DEBUG("%s: %s scancode %d",
+    SPICE_DEBUG("%s: %s scancode %u",
                 __FUNCTION__, release ? "release" : "", scancode);
 
     if (release) {
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 1557fdc..0698af3 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -655,10 +655,11 @@ gboolean spice_egl_update_scanout(SpiceDisplay *display,
     attrs[10] = EGL_LINUX_DRM_FOURCC_EXT;
     attrs[11] = format;
     attrs[12] = EGL_NONE;
-    SPICE_DEBUG("fd:%d stride:%d y0:%d %dx%d format:0x%x (%c%c%c%c)",
+    SPICE_DEBUG("fd:%d stride:%u y0:%d %ux%u format:0x%x (%c%c%c%c)",
                 scanout->fd, scanout->stride, scanout->y0top,
                 scanout->width, scanout->height, format,
-                format & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, format >> 24);
+                (int)format & 0xff, (int)(format >> 8) & 0xff,
+                (int)(format >> 16) & 0xff, (int)format >> 24);
 
     d->egl.image = eglCreateImageKHR(d->egl.display,
                                        EGL_NO_CONTEXT,
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 9a4b204..d0fa912 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -304,7 +304,7 @@ void spice_display_widget_update_monitor_area(SpiceDisplay *display)
 
     if (c->surface_id != 0) {
         g_warning("FIXME: only support monitor config with primary surface 0, "
-                  "but given config surface %d", c->surface_id);
+                  "but given config surface %u", c->surface_id);
         goto whole;
     }
 
@@ -808,7 +808,7 @@ static void try_keyboard_grab(SpiceDisplay *display)
     status = gdk_keyboard_grab(gtk_widget_get_window(widget), FALSE,
                                GDK_CURRENT_TIME);
     if (status != GDK_GRAB_SUCCESS) {
-        g_warning("keyboard grab failed %d", status);
+        g_warning("keyboard grab failed %u", status);
         d->keyboard_grab_active = false;
     } else {
         d->keyboard_grab_active = true;
@@ -966,7 +966,7 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
                      GDK_CURRENT_TIME);
     if (status != GDK_GRAB_SUCCESS) {
         d->mouse_grab_active = false;
-        g_warning("pointer grab failed %d", status);
+        g_warning("pointer grab failed %u", status);
     } else {
         d->mouse_grab_active = true;
         g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, true);
@@ -1424,7 +1424,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
     }
 
 #endif
-    SPICE_DEBUG("%s %s: keycode: %d  state: %d  group %d modifier %d",
+    SPICE_DEBUG("%s %s: keycode: %d  state: %u  group %d modifier %d",
             __FUNCTION__, key->type == GDK_KEY_PRESS ? "press" : "release",
             key->hardware_keycode, key->state, key->group, key->is_modifier);
 
@@ -1863,7 +1863,7 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
     SpiceDisplayPrivate *d = display->priv;
     int x, y;
 
-    SPICE_DEBUG("%s %s: button %d, state 0x%x", __FUNCTION__,
+    SPICE_DEBUG("%s %s: button %u, state 0x%x", __FUNCTION__,
             button->type == GDK_BUTTON_PRESS ? "press" : "release",
             button->button, button->state);
 
@@ -2255,7 +2255,7 @@ static void update_mouse_mode(SpiceChannel *channel, gpointer data)
     GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
 
     g_object_get(channel, "mouse-mode", &d->mouse_mode, NULL);
-    SPICE_DEBUG("mouse mode %d", d->mouse_mode);
+    SPICE_DEBUG("mouse mode %u", d->mouse_mode);
 
     switch (d->mouse_mode) {
     case SPICE_MOUSE_MODE_CLIENT:
diff --git a/src/spicy-screenshot.c b/src/spicy-screenshot.c
index ab1f387..68f9335 100644
--- a/src/spicy-screenshot.c
+++ b/src/spicy-screenshot.c
@@ -89,7 +89,7 @@ static void invalidate(SpiceChannel *channel,
         rc = write_ppm_32();
         break;
     default:
-        fprintf(stderr, "unsupported spice surface format %d\n", d_format);
+        fprintf(stderr, "unsupported spice surface format %u\n", d_format);
         rc = -1;
         break;
     }
@@ -105,7 +105,7 @@ static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
     case SPICE_CHANNEL_OPENED:
         break;
     default:
-        g_warning("main channel event: %d", event);
+        g_warning("main channel event: %u", event);
         g_main_loop_quit(mainloop);
     }
 }
diff --git a/src/spicy-stats.c b/src/spicy-stats.c
index 1bed12e..8ca4cc1 100644
--- a/src/spicy-stats.c
+++ b/src/spicy-stats.c
@@ -36,7 +36,7 @@ static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
     case SPICE_CHANNEL_OPENED:
         break;
     default:
-        g_warning("main channel event: %d", event);
+        g_warning("main channel event: %u", event);
         g_main_loop_quit(mainloop);
     }
 }
diff --git a/src/spicy.c b/src/spicy.c
index d984f62..8fc6845 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -1207,7 +1207,7 @@ static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
         break;
     default:
         /* TODO: more sophisticated error handling */
-        g_warning("unknown main channel event: %d", event);
+        g_warning("unknown main channel event: %u", event);
         /* connection_disconnect(conn); */
         break;
     }
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index da7e596..325533d 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1970,7 +1970,7 @@ spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager  *self,
 gchar *spice_usb_device_get_description(SpiceUsbDevice *device, const gchar *format)
 {
 #ifdef USE_USBREDIR
-    int bus, address, vid, pid;
+    guint16 bus, address, vid, pid;
     gchar *description, *descriptor, *manufacturer = NULL, *product = NULL;
 
     g_return_val_if_fail(device != NULL, NULL);
diff --git a/src/usbutil.c b/src/usbutil.c
index 6cd8148..6dcb4de 100644
--- a/src/usbutil.c
+++ b/src/usbutil.c
@@ -106,7 +106,7 @@ static gchar *spice_usbutil_get_sysfs_attribute(int bus, int address,
     if (stat(filename, &stat_buf) != 0)
         return NULL;
 
-    snprintf(filename, sizeof(filename), "/sys/dev/char/%d:%d/%s",
+    snprintf(filename, sizeof(filename), "/sys/dev/char/%u:%u/%s",
              major(stat_buf.st_rdev), minor(stat_buf.st_rdev), attribute);
     if (!g_file_get_contents(filename, &contents, NULL, NULL))
         return NULL;
-- 
2.7.4



More information about the Spice-devel mailing list