[geocode-glib] lib: Fix compiler warnings



commit 925e052ff5fcf89804c88b34c9f8e0b9dab28199
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Aug 7 11:46:41 2013 +0200

    lib: Fix compiler warnings
    
    Declaration in the middle of a block and passing const pointers
    to a GHashTable.

 geocode-glib/geocode-forward.c                |    8 ++++----
 geocode-glib/geocode-ip-server/geoip-lookup.c |    3 +--
 geocode-glib/geocode-ipclient.c               |    2 +-
 geocode-glib/geocode-reverse.c                |    8 ++++----
 4 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/geocode-glib/geocode-forward.c b/geocode-glib/geocode-forward.c
index 127f4e9..b4eb6a2 100644
--- a/geocode-glib/geocode-forward.c
+++ b/geocode-glib/geocode-forward.c
@@ -343,15 +343,15 @@ get_search_query_for_params (GeocodeForward *forward,
 
        /* Prepare the query parameters */
        ht = _geocode_glib_dup_hash_table (forward->priv->ht);
-       g_hash_table_insert (ht, "format", "json");
-       g_hash_table_insert (ht, "email", "zeeshanak gnome org");
-       g_hash_table_insert (ht, "addressdetails", "1");
+       g_hash_table_insert (ht, (gpointer) "format", (gpointer) "json");
+       g_hash_table_insert (ht, (gpointer) "email", (gpointer) "zeeshanak gnome org");
+       g_hash_table_insert (ht, (gpointer) "addressdetails", (gpointer) "1");
 
        lang = NULL;
        if (g_hash_table_lookup (ht, "accept-language") == NULL) {
                lang = _geocode_object_get_lang ();
                if (lang)
-                       g_hash_table_insert (ht, "accept-language", lang);
+                       g_hash_table_insert (ht, (gpointer) "accept-language", lang);
        }
 
         location = g_strdup (g_hash_table_lookup (ht, "location"));
diff --git a/geocode-glib/geocode-ip-server/geoip-lookup.c b/geocode-glib/geocode-ip-server/geoip-lookup.c
index 4ec82c5..76c0b50 100644
--- a/geocode-glib/geocode-ip-server/geoip-lookup.c
+++ b/geocode-glib/geocode-ip-server/geoip-lookup.c
@@ -43,6 +43,7 @@ add_result_attr_to_json_tree (const char *ipaddress,
         const char *timezone = NULL;
         JsonBuilder *builder;
         GeoIPRecord *gir;
+        const char *accuracy = "country";
 
         gir = GeoIP_record_by_addr (gi, ipaddress);
         if (gir == NULL) {
@@ -62,8 +63,6 @@ add_result_attr_to_json_tree (const char *ipaddress,
         json_builder_set_member_name (builder, "longitude");
         json_builder_add_double_value (builder, gir->longitude);
 
-        const char *accuracy = "country";
-
         /* Country level information */
         if (gir->country_name != NULL) {
                 json_builder_set_member_name (builder, "country_name");
diff --git a/geocode-glib/geocode-ipclient.c b/geocode-glib/geocode-ipclient.c
index 7b8a5c4..371f0ff 100644
--- a/geocode-glib/geocode-ipclient.c
+++ b/geocode-glib/geocode-ipclient.c
@@ -228,7 +228,7 @@ get_search_query (GeocodeIpclient *ipclient)
                         g_free (escaped);
                 } else {
                         ht = g_hash_table_new (g_str_hash, g_str_equal);
-                        g_hash_table_insert (ht, "ip", g_strdup (ipaddress));
+                        g_hash_table_insert (ht, (gpointer) "ip", g_strdup (ipaddress));
                         query_string = soup_form_encode_hash (ht);
                         g_hash_table_destroy (ht);
 
diff --git a/geocode-glib/geocode-reverse.c b/geocode-glib/geocode-reverse.c
index 165914d..3342788 100644
--- a/geocode-glib/geocode-reverse.c
+++ b/geocode-glib/geocode-reverse.c
@@ -323,15 +323,15 @@ get_resolve_query_for_params (GHashTable  *orig_ht)
 
        ht = _geocode_glib_dup_hash_table (orig_ht);
 
-       g_hash_table_insert (ht, "format", "json");
-       g_hash_table_insert (ht, "email", "zeeshanak gnome org");
-       g_hash_table_insert (ht, "addressdetails", "1");
+       g_hash_table_insert (ht, (gpointer) "format", (gpointer) "json");
+       g_hash_table_insert (ht, (gpointer) "email", (gpointer) "zeeshanak gnome org");
+       g_hash_table_insert (ht, (gpointer) "addressdetails", (gpointer) "1");
 
        locale = NULL;
        if (g_hash_table_lookup (ht, "accept-language") == NULL) {
                locale = _geocode_object_get_lang ();
                if (locale)
-                       g_hash_table_insert (ht, "accept-language", locale);
+                       g_hash_table_insert (ht, (gpointer) "accept-language", locale);
        }
 
        params = soup_form_encode_hash (ht);


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