[geocode-glib] geocode-glib: Fix various minor const-correctness issues
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib] geocode-glib: Fix various minor const-correctness issues
- Date: Fri, 6 Jan 2017 23:13:12 +0000 (UTC)
commit 99f6d79fa48b9d1bb43dc0bb2e07e4096cedff37
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Oct 13 13:19:22 2016 +0100
geocode-glib: Fix various minor const-correctness issues
This fixes a load of compiler warnings.
https://bugzilla.gnome.org/show_bug.cgi?id=756311
geocode-glib/geocode-location.c | 2 +-
geocode-glib/geocode-place.c | 6 +++---
geocode-glib/test-geouri.c | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/geocode-glib/geocode-location.c b/geocode-glib/geocode-location.c
index f770042..15db1b7 100644
--- a/geocode-glib/geocode-location.c
+++ b/geocode-glib/geocode-location.c
@@ -860,7 +860,7 @@ geo_uri_from_location (GeocodeLocation *loc)
char *uri;
char *coords;
char *params;
- char *crs = "wgs84";
+ const char *crs = "wgs84";
char lat[G_ASCII_DTOSTR_BUF_SIZE];
char lon[G_ASCII_DTOSTR_BUF_SIZE];
char alt[G_ASCII_DTOSTR_BUF_SIZE];
diff --git a/geocode-glib/geocode-place.c b/geocode-glib/geocode-place.c
index 70a40df..99d287a 100644
--- a/geocode-glib/geocode-place.c
+++ b/geocode-glib/geocode-place.c
@@ -1122,10 +1122,10 @@ geocode_place_get_continent (GeocodePlace *place)
return place->priv->continent;
}
-static char *
+static const char *
get_icon_name (GeocodePlace *place)
{
- char *icon_name;
+ const char *icon_name;
switch (place->priv->place_type) {
@@ -1192,7 +1192,7 @@ get_icon_name (GeocodePlace *place)
GIcon *
geocode_place_get_icon (GeocodePlace *place)
{
- char *icon_name;
+ const char *icon_name;
g_return_val_if_fail (GEOCODE_IS_PLACE (place), NULL);
diff --git a/geocode-glib/test-geouri.c b/geocode-glib/test-geouri.c
index 0bbcd78..03db1b6 100644
--- a/geocode-glib/test-geouri.c
+++ b/geocode-glib/test-geouri.c
@@ -48,7 +48,7 @@ test_parse_uri (void)
{
GeocodeLocation *loc;
GError *error = NULL;
- char *uri = "geo:1.2,2.3,4.5;crs=wgs84;u=67";
+ const char *uri = "geo:1.2,2.3,4.5;crs=wgs84;u=67";
loc = geocode_location_new (0, 0, 0);
@@ -102,7 +102,7 @@ static void
test_unescape_uri (void)
{
GeocodeLocation *loc;
- char *uri = "geo:0,0?q=57.038,12.3982(Parkvägen%202,%20Tvååker)";
+ const char *uri = "geo:0,0?q=57.038,12.3982(Parkvägen%202,%20Tvååker)";
loc = geocode_location_new (0, 0, 0);
g_assert (geocode_location_set_from_uri (loc, uri, NULL));
@@ -122,7 +122,8 @@ test_convert_from_to_location (void)
gdouble altitude = 5;
gdouble accuracy = 40;
/* Karlskirche (from RFC) */
- char *uri = "geo:48.198634,16.371648,5;crs=wgs84;u=40";
+ const char *uri = "geo:48.198634,16.371648,5;crs=wgs84;u=40";
+ g_autofree gchar *returned_uri = NULL;
loc = geocode_location_new (0, 0, 0);
g_assert (geocode_location_set_from_uri (loc, uri, &error));
@@ -141,10 +142,10 @@ test_convert_from_to_location (void)
==,
accuracy);
- uri = geocode_location_to_uri (loc, GEOCODE_LOCATION_URI_SCHEME_GEO);
+ returned_uri = geocode_location_to_uri (loc, GEOCODE_LOCATION_URI_SCHEME_GEO);
g_object_unref (loc);
loc = geocode_location_new (0, 0, 0);
- g_assert (geocode_location_set_from_uri (loc, uri, &error));
+ g_assert (geocode_location_set_from_uri (loc, returned_uri, &error));
g_assert (error == NULL);
g_assert_cmpfloat (geocode_location_get_latitude (loc),
@@ -159,7 +160,6 @@ test_convert_from_to_location (void)
g_assert_cmpfloat (geocode_location_get_accuracy (loc),
==,
accuracy);
- g_free (uri);
g_object_unref (loc);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]