[gnome-settings-daemon] color: mbstowcs() returns an unsigned type



commit cc9fd9d3969172086369f25de33a2286f11e486b
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Oct 20 16:33:54 2011 +0100

    color: mbstowcs() returns an unsigned type
    
    So check correctly for (size_t) -1 on error as < 0 will never
    be true.

 plugins/color/gsd-color-manager.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plugins/color/gsd-color-manager.c b/plugins/color/gsd-color-manager.c
index da60dac..bc86553 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -492,12 +492,12 @@ out:
 static wchar_t *
 utf8_to_wchar_t (const char *src)
 {
-        gsize len;
-        gsize converted;
+        size_t len;
+        size_t converted;
         wchar_t *buf = NULL;
 
         len = mbstowcs (NULL, src, 0);
-        if (len < 0) {
+        if (len == (size_t) -1) {
                 g_warning ("Invalid UTF-8 in string %s", src);
                 goto out;
         }



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