[gnome-settings-daemon/gnome-3-2] color: mbstowcs() returns an unsigned type
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-2] color: mbstowcs() returns an unsigned type
- Date: Thu, 20 Oct 2011 16:00:01 +0000 (UTC)
commit 5ef223b0014f7765178e5e09a1a15e8158192e0e
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 6fe086e..01b20c0 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -495,12 +495,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]