[glib] GSettings strinfo: byteswap integers



commit 61563d5f555f697824cd2ecc17a6687773e6e70e
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Oct 3 23:25:29 2010 -0400

    GSettings strinfo: byteswap integers
    
    strinfo is always strictly little endian, so ensure that we byteswap to
    native when comparing and returning.

 gio/strinfo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/strinfo.c b/gio/strinfo.c
index 84e4acf..6836b59 100644
--- a/gio/strinfo.c
+++ b/gio/strinfo.c
@@ -193,7 +193,7 @@ strinfo_find_integer (const guint32 *strinfo,
   guint i;
 
   for (i = 0; i < length; i++)
-    if (strinfo[i] == value)
+    if (strinfo[i] == GUINT32_TO_LE (value))
       {
         const guchar *charinfo = (const guchar *) &strinfo[i];
 
@@ -226,7 +226,7 @@ strinfo_enum_from_string (const guint32 *strinfo,
   if (index < 0)
     return FALSE;
 
-  *result = strinfo[index];
+  *result = GUINT32_FROM_LE (strinfo[index]);
   return TRUE;
 }
 



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