[gnome-disk-utility] Fix format string signedness warnings



commit 0dccda838f05c91788c93a16b2fc3f30cc630080
Author: David King <dking redhat com>
Date:   Tue Feb 10 23:01:18 2015 +0000

    Fix format string signedness warnings
    
    GCC 5.0, with its new -Wformat-signedness, warns about the sign being
    different between a type and the format string in printf-format
    messages. Fix the sign of the format strings and types so that they
    match.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744296

 src/disks/gdubenchmarkdialog.c |   10 +++++-----
 src/disks/gdudvdsupport.c      |    6 +++---
 src/disks/gdufstabdialog.c     |    6 +++---
 src/disks/gduvolumegrid.c      |    4 ++--
 src/disks/gduxzdecompressor.c  |    2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/disks/gdubenchmarkdialog.c b/src/disks/gdubenchmarkdialog.c
index 6f751da..726e8ba 100644
--- a/src/disks/gdubenchmarkdialog.c
+++ b/src/disks/gdubenchmarkdialog.c
@@ -416,7 +416,7 @@ on_drawing_area_draw (GtkWidget      *widget,
       x = gx + ceil (n * gw / 10.0);
       y = gy + gh + x_marker_height/2.0;
 
-      s = g_strdup_printf ("%d%%", n * 10);
+      s = g_strdup_printf ("%u%%", n * 10);
 
       cairo_text_extents (cr, s, &te);
 
@@ -652,8 +652,8 @@ format_transfer_rate_and_num_samples (gdouble bytes_per_sec,
 
   s = format_transfer_rate (bytes_per_sec);
   s2 = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
-                                     "%d sample",
-                                     "%d samples",
+                                     "%u sample",
+                                     "%u samples",
                                      num_samples),
                         num_samples);
   ret = g_strdup_printf ("%s <small>(%s)</small>", s, s2);
@@ -861,8 +861,8 @@ update_dialog (DialogData *data)
       /* Translators: %d is number of milliseconds and msec means "milli-second" */
       s2 = g_strdup_printf (C_("benchmark-access-time", "%.2f msec"), access_time_avg * 1000.0);
       s3 = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
-                                         "%d sample",
-                                         "%d samples",
+                                         "%u sample",
+                                         "%u samples",
                                          data->bm_access_time_samples->len),
                             data->bm_access_time_samples->len);
       s = g_strdup_printf ("%s <small>(%s)</small>", s2, s3);
diff --git a/src/disks/gdudvdsupport.c b/src/disks/gdudvdsupport.c
index 2fcabeb..c9ae6c6 100644
--- a/src/disks/gdudvdsupport.c
+++ b/src/disks/gdudvdsupport.c
@@ -207,7 +207,7 @@ gdu_dvd_support_new  (const gchar *device_file,
             }
           else
             {
-              snprintf (vob_filename, sizeof vob_filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, part);
+              snprintf (vob_filename, sizeof vob_filename, "/VIDEO_TS/VTS_%02u_%d.VOB", title, part);
             }
 
           vob_sector_offset = UDFFindFile (support->dvd, vob_filename, &vob_size);
@@ -313,7 +313,7 @@ gdu_dvd_support_new  (const gchar *device_file,
       for (n = 0; n < support->num_ranges; n++)
         {
           Range *range = support->ranges + n;
-          g_print ("range %02d: %10" G_GUINT64_FORMAT " -> %10" G_GUINT64_FORMAT ": scrambled=%d\n",
+          g_print ("range %02u: %10" G_GUINT64_FORMAT " -> %10" G_GUINT64_FORMAT ": scrambled=%d\n",
                    n, range->start, range->end, range->scrambled);
         }
     }
@@ -405,7 +405,7 @@ gdu_dvd_support_read (GduDVDSupport *support,
 
       if (G_UNLIKELY (support->debug))
         {
-          g_print ("reading %" G_GUINT64_FORMAT " from %" G_GUINT64_FORMAT " (scrambled=%d) from range %d\n",
+          g_print ("reading %" G_GUINT64_FORMAT " from %" G_GUINT64_FORMAT " (scrambled=%d) from range %u\n",
                    num_to_read_in_range, cur_offset, r->scrambled, n);
         }
 
diff --git a/src/disks/gdufstabdialog.c b/src/disks/gdufstabdialog.c
index 4432430..9f37a7e 100644
--- a/src/disks/gdufstabdialog.c
+++ b/src/disks/gdufstabdialog.c
@@ -146,12 +146,12 @@ update_device_explanation (FstabDialogData *data)
   part_num = 0;
   s = g_strrstr (fsname, "-part");
   if (s != NULL)
-    sscanf (s, "-part%d", &part_num);
+    sscanf (s, "-part%u", &part_num);
 
   if (g_str_has_prefix (fsname, "/dev/disk/by-id/"))
     {
       if (part_num > 0)
-        explanation = g_strdup_printf (_("Matches partition %d of the device with the given vital product 
data"),
+        explanation = g_strdup_printf (_("Matches partition %u of the device with the given vital product 
data"),
                                        part_num);
       else
         explanation = g_strdup (_("Matches the whole disk of the device with the given vital product data"));
@@ -159,7 +159,7 @@ update_device_explanation (FstabDialogData *data)
   else if (g_str_has_prefix (fsname, "/dev/disk/by-path/"))
     {
       if (part_num > 0)
-        explanation = g_strdup_printf (_("Matches partition %d of any device connected at the given port or 
address"),
+        explanation = g_strdup_printf (_("Matches partition %u of any device connected at the given port or 
address"),
                                        part_num);
       else
         explanation = g_strdup (_("Matches the whole disk of any device connected at the given port or 
address"));
diff --git a/src/disks/gduvolumegrid.c b/src/disks/gduvolumegrid.c
index ffb5d78..af42707 100644
--- a/src/disks/gduvolumegrid.c
+++ b/src/disks/gduvolumegrid.c
@@ -1549,14 +1549,14 @@ maybe_add_partition (GduVolumeGrid   *grid,
       /* Translators: This is shown in the volume grid for a partition with a name/label.
        *              The %d is the partition number. The %s is the name
        */
-      s = g_strdup_printf (C_("volume-grid", "Partition %d: %s"), number, name);
+      s = g_strdup_printf (C_("volume-grid", "Partition %u: %s"), number, name);
     }
   else
     {
       /* Translators: This is shown in the volume grid for a partition with no name/label.
        *              The %d is the partition number
        */
-      s = g_strdup_printf (C_("volume-grid", "Partition %d"), number);
+      s = g_strdup_printf (C_("volume-grid", "Partition %u"), number);
     }
   g_ptr_array_add (lines, s);
 
diff --git a/src/disks/gduxzdecompressor.c b/src/disks/gduxzdecompressor.c
index b20fe9f..338ac9e 100644
--- a/src/disks/gduxzdecompressor.c
+++ b/src/disks/gduxzdecompressor.c
@@ -58,7 +58,7 @@ init_lzma (GduXzDecompressor *decompressor)
                              UINT64_MAX, /* memlimit */
                              0);         /* flags */
   if (ret != LZMA_OK)
-    g_critical ("Error initalizing lzma decoder: %d", ret);
+    g_critical ("Error initalizing lzma decoder: %u", ret);
 }
 
 static void


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