diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-08-24 12:38:06 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:22:06 +0100 |
commit | c5cab062fc6ef2ccdbaf39f8583242a6a398a282 (patch) | |
tree | 3a711dfa60d1fc49f10e6e30aba2cee453eb138a | |
parent | 696fad1853ae83c71c9716bcf7302b3be49207ff (diff) |
gobex: Fix build on 32 bits systems
GUINT_TO_POINTER does not cast properly in older version of GLib (< 2.31)
causing the following errors:
cc1: warnings being treated as errors
gobex/gobex-apparam.c: In function ‘g_obex_apparam_set_bytes’:
gobex/gobex-apparam.c:176:38: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint8’:
gobex/gobex-apparam.c:243:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint16’:
gobex/gobex-apparam.c:261:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint32’:
gobex/gobex-apparam.c:282:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint64’:
gobex/gobex-apparam.c:303:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_string’:
gobex/gobex-apparam.c:324:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_bytes’:
gobex/gobex-apparam.c:342:43: error: cast to pointer from integer of
different size
make[1]: *** [gobex/gobex-apparam.o] Error 1
make: *** [all] Error 2
-rw-r--r-- | gobex/gobex-apparam.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/gobex/gobex-apparam.c b/gobex/gobex-apparam.c index 8f72aa7c0..442a3f140 100644 --- a/gobex/gobex-apparam.c +++ b/gobex/gobex-apparam.c @@ -112,12 +112,14 @@ GObexApparam *g_obex_apparam_decode(const void *data, gsize size) while (count < size) { struct apparam_tag *tag; gsize parsed; + guint id; tag = apparam_tag_decode(data + count, size - count, &parsed); if (tag == NULL) break; - g_hash_table_insert(tags, GUINT_TO_POINTER(tag->id), tag); + id = tag->id; + g_hash_table_insert(tags, GUINT_TO_POINTER(id), tag); count += parsed; } @@ -167,12 +169,13 @@ GObexApparam *g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id, const void *value, gsize len) { struct apparam_tag *tag; + guint uid = id; if (apparam == NULL) apparam = g_obex_apparam_new(); tag = tag_new(id, len, value); - g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(id), tag); + g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(uid), tag); return apparam; } @@ -232,6 +235,12 @@ GObexApparam *g_obex_apparam_set_string(GObexApparam *apparam, guint8 id, return g_obex_apparam_set_bytes(apparam, id, value, len); } +static struct apparam_tag *g_obex_apparam_find_tag(GObexApparam *apparam, + guint id) +{ + return g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); +} + gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id, guint8 *dest) { @@ -239,7 +248,7 @@ gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id, g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id); - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); + tag = g_obex_apparam_find_tag(apparam, id); if (tag == NULL) return FALSE; @@ -257,7 +266,7 @@ gboolean g_obex_apparam_get_uint16(GObexApparam *apparam, guint8 id, g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id); - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); + tag = g_obex_apparam_find_tag(apparam, id); if (tag == NULL) return FALSE; @@ -278,7 +287,7 @@ gboolean g_obex_apparam_get_uint32(GObexApparam *apparam, guint8 id, g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id); - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); + tag = g_obex_apparam_find_tag(apparam, id); if (tag == NULL) return FALSE; @@ -299,7 +308,7 @@ gboolean g_obex_apparam_get_uint64(GObexApparam *apparam, guint8 id, g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id); - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); + tag = g_obex_apparam_find_tag(apparam, id); if (tag == NULL) return FALSE; @@ -320,7 +329,7 @@ char *g_obex_apparam_get_string(GObexApparam *apparam, guint8 id) g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id); - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); + tag = g_obex_apparam_find_tag(apparam, id); if (tag == NULL) return NULL; @@ -338,7 +347,7 @@ gboolean g_obex_apparam_get_bytes(GObexApparam *apparam, guint8 id, g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id); - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id)); + tag = g_obex_apparam_find_tag(apparam, id); if (tag == NULL) return FALSE; |