[gnome-desktop] Fix comparisons with differing signedness



commit 5cca208114e7c6255893ac0b092cf1be652c551a
Author: Ernestas Kulik <ernestask gnome org>
Date:   Mon Feb 12 18:03:19 2018 +0200

    Fix comparisons with differing signedness
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793195

 libgnome-desktop/gnome-bg-slide-show.c  |    2 +-
 libgnome-desktop/gnome-rr-config.c      |    2 +-
 libgnome-desktop/gnome-rr-output-info.c |    8 ++++----
 libgnome-desktop/gnome-rr.c             |   16 ++++++++--------
 libgnome-desktop/test-languages.c       |    3 +--
 libgnome-desktop/test-pnp-ids.c         |    2 +-
 6 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg-slide-show.c b/libgnome-desktop/gnome-bg-slide-show.c
index b2c4f9b..4e4f707 100644
--- a/libgnome-desktop/gnome-bg-slide-show.c
+++ b/libgnome-desktop/gnome-bg-slide-show.c
@@ -673,7 +673,7 @@ parse_file_contents (GnomeBGSlideShow  *self,
         g_markup_parse_context_free (context);
 
         if (!failed) {
-                int len;
+                guint len;
 
                 t = mktime (&self->priv->start_tm);
 
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index 4bf4b8d..c3c9d42 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -722,7 +722,7 @@ static gboolean
 can_clone (CrtcInfo *info,
           GnomeRROutput *output)
 {
-    int i;
+    guint i;
 
     for (i = 0; i < info->outputs->len; ++i)
     {
diff --git a/libgnome-desktop/gnome-rr-output-info.c b/libgnome-desktop/gnome-rr-output-info.c
index 833a03a..7f97ecc 100644
--- a/libgnome-desktop/gnome-rr-output-info.c
+++ b/libgnome-desktop/gnome-rr-output-info.c
@@ -106,7 +106,7 @@ static void gnome_rr_output_info_get_tiled_geometry (GnomeRROutputInfo *self,
     GnomeRROutputInfo **outputs;
     gboolean active;
     int i;
-    int ht, vt;
+    guint ht, vt;
     int total_w = 0, total_h = 0;
 
     outputs = gnome_rr_config_get_outputs (self->priv->config);
@@ -198,8 +198,8 @@ static void gnome_rr_output_info_set_tiled_geometry (GnomeRROutputInfo *self, in
 {
     GnomeRROutputInfo **outputs;
     gboolean primary_tile_only = FALSE;
-    int ht, vt, i;
-    int x_off;
+    guint ht, vt;
+    int i, x_off;
 
     primary_tile_only = TRUE;
 
@@ -331,7 +331,7 @@ static void gnome_rr_output_info_set_tiled_rotation (GnomeRROutputInfo *self, Gn
     GnomeRROutputInfo **outputs;
     int x_off;
     int base_x = 0, base_y = 0;
-    int ht, vt;
+    guint ht, vt;
     int i;
 
     outputs = gnome_rr_config_get_outputs (self->priv->config);
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 16670dd..0b7c506 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -271,8 +271,8 @@ has_similar_mode (GnomeRROutput *output, GnomeRRMode *mode)
 {
     int i;
     GnomeRRMode **modes = gnome_rr_output_list_modes (output);
-    int width = gnome_rr_mode_get_width (mode);
-    int height = gnome_rr_mode_get_height (mode);
+    guint width = gnome_rr_mode_get_width (mode);
+    guint height = gnome_rr_mode_get_height (mode);
 
     for (i = 0; modes[i] != NULL; ++i)
     {
@@ -294,8 +294,8 @@ _gnome_rr_output_get_tiled_display_size (GnomeRROutput *output,
                                         int *total_width, int *total_height)
 {
     GnomeRRTile tile;
-    int ht, vt, i;
-    int total_h = 0, total_w = 0;
+    guint ht, vt;
+    int i, total_h = 0, total_w = 0;
 
     if (!_gnome_rr_output_get_tile_info (output, &tile))
        return FALSE;
@@ -430,7 +430,7 @@ fill_screen_info_from_resources (ScreenInfo *info,
                                 int         max_width,
                                 int         max_height)
 {
-    int i;
+    guint i;
     GPtrArray *a;
     GnomeRRCrtc **crtc;
     GnomeRROutput **output;
@@ -1336,8 +1336,8 @@ output_initialize (GnomeRROutput *output, GVariant *info)
     GPtrArray *a;
     GVariantIter *crtcs, *clones, *modes;
     GVariant *properties, *edid, *tile;
-    int current_crtc_id;
-    guint id;
+    gint32 current_crtc_id;
+    guint32 id;
 
     g_variant_get (info, META_OUTPUT_STRUCT,
                   &output->id, &output->winsys_id,
@@ -1356,7 +1356,7 @@ output_initialize (GnomeRROutput *output, GVariant *info)
 
        g_ptr_array_add (a, crtc);
 
-       if (crtc->id == current_crtc_id)
+       if (current_crtc_id != -1 && crtc->id == (guint32) current_crtc_id)
        {
            output->current_crtc = crtc;
            append_output_array (&crtc->current_outputs, output);
diff --git a/libgnome-desktop/test-languages.c b/libgnome-desktop/test-languages.c
index 76f9cc0..f17d267 100644
--- a/libgnome-desktop/test-languages.c
+++ b/libgnome-desktop/test-languages.c
@@ -10,13 +10,12 @@
 int main (int argc, char **argv)
 {
         char **locales;
-        guint i;
+        int i;
 
         setlocale (LC_ALL, "");
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
         if (argc > 1) {
-                guint i;
                 for (i = 1; i < argc; i++) {
                         char *lang, *country, *norm;
                         norm = gnome_normalize_locale (argv[i]);
diff --git a/libgnome-desktop/test-pnp-ids.c b/libgnome-desktop/test-pnp-ids.c
index 36ca7c0..e0defa3 100644
--- a/libgnome-desktop/test-pnp-ids.c
+++ b/libgnome-desktop/test-pnp-ids.c
@@ -37,7 +37,7 @@ int
 main (int argc, char *argv[])
 {
        GnomePnpIds *ids;
-       guint i;
+       int i;
 
        ids = gnome_pnp_ids_new ();
 


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