libtimezonemap/0022-Fix-compiler-warnings.patch
David Shea 51a02b6c80 Update the map data and improve behavior:
- Render the map directly from SVG (#1335158)
- Fix memory leaks in tz.c
- Fix an invalid memory access
- Do not modify TZ in the process environment
- Move all data files to /usr/share/libtimezonemap from .../libtimezonemap/ui
- Add extra city data so all timezone offsets are clickable
- Move Venezuela from -04:30 to -04:00
- Fix the conversion of points just west of 180 longitude
- Remove the out-of-date Olson map data
- Update the "backward" file
- Improve the location selected when setting the timezone by name (#1322648)
- Remove an extra line in the +10:00 layer
- Move Chile back an hour
2016-06-29 14:56:01 -04:00

208 lines
6.2 KiB
Diff

From 730120b2bfb81d2f65c0f8912c39c17ff3b5d2aa Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Wed, 29 Jun 2016 14:01:45 -0400
Subject: [PATCH 22/24] Fix compiler warnings
Remove unused code and cast around libxml signed char nitpickings
---
src/cc-timezone-location.c | 11 +---------
src/cc-timezone-map.c | 1 -
src/test-clickability.c | 23 ++++++++++++++-----
src/tz.c | 55 ----------------------------------------------
4 files changed, 18 insertions(+), 72 deletions(-)
diff --git a/src/cc-timezone-location.c b/src/cc-timezone-location.c
index 31ceb56..6fab52b 100644
--- a/src/cc-timezone-location.c
+++ b/src/cc-timezone-location.c
@@ -181,13 +181,6 @@ cc_timezone_location_dispose (GObject *object)
}
static void
-cc_timezone_location_finalize (GObject *object)
-{
- CcTimezoneLocationPrivate *priv = CC_TIMEZONE_LOCATION (object)->priv;
- G_OBJECT_CLASS (cc_timezone_location_parent_class)->finalize (object);
-}
-
-static void
cc_timezone_location_class_init (CcTimezoneLocationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -196,7 +189,6 @@ cc_timezone_location_class_init (CcTimezoneLocationClass *klass)
object_class->get_property = cc_timezone_location_get_property;
object_class->set_property = cc_timezone_location_set_property;
object_class->dispose = cc_timezone_location_dispose;
- object_class->finalize = cc_timezone_location_finalize;
g_object_class_install_property(object_class,
PROP_COUNTRY,
@@ -271,8 +263,7 @@ cc_timezone_location_class_init (CcTimezoneLocationClass *klass)
static void
cc_timezone_location_init (CcTimezoneLocation *self) {
- CcTimezoneLocationPrivate *priv;
- priv = self->priv = TIMEZONE_LOCATION_PRIVATE (self);
+ self->priv = TIMEZONE_LOCATION_PRIVATE (self);
}
CcTimezoneLocation *
diff --git a/src/cc-timezone-map.c b/src/cc-timezone-map.c
index 5e4c210..1bad664 100644
--- a/src/cc-timezone-map.c
+++ b/src/cc-timezone-map.c
@@ -589,7 +589,6 @@ set_location (CcTimezoneMap *map,
CcTimezoneLocation *location)
{
CcTimezoneMapPrivate *priv = map->priv;
- TzInfo *info;
priv->location = location;
diff --git a/src/test-clickability.c b/src/test-clickability.c
index 2784b60..1fc8007 100644
--- a/src/test-clickability.c
+++ b/src/test-clickability.c
@@ -26,7 +26,6 @@ int main(int argc, char **argv)
const char *pixmap_dir;
gchar *path;
- GError *error = NULL;
gchar *endptr;
gdouble timezone_offset;
int i, j;
@@ -79,10 +78,22 @@ int main(int argc, char **argv)
/* Iterate over each layer, which can be found as <g> element wit
* inkscape:groupmode="layer" */
xpathCtx = xmlXPathNewContext(doc);
- xmlXPathRegisterNs(xpathCtx, "svg", "http://www.w3.org/2000/svg");
- xmlXPathRegisterNs(xpathCtx, "inkscape", "http://www.inkscape.org/namespaces/inkscape");
+ xmlXPathRegisterNs(
+ xpathCtx,
+ (const xmlChar *) "svg",
+ (const xmlChar *) "http://www.w3.org/2000/svg"
+ );
+ xmlXPathRegisterNs(
+ xpathCtx,
+ (const xmlChar *) "inkscape",
+ (const xmlChar *) "http://www.inkscape.org/namespaces/inkscape"
+ );
+
+ xpathObj = xmlXPathEvalExpression(
+ (const xmlChar *)"//svg:g[@inkscape:groupmode = 'layer']",
+ xpathCtx
+ );
- xpathObj = xmlXPathEvalExpression("//svg:g[@inkscape:groupmode = 'layer']", xpathCtx);
if (!xpathObj)
{
g_message("Unable to evaluate xpath");
@@ -101,14 +112,14 @@ int main(int argc, char **argv)
for (i = 0; i < nodes->nodeNr; i++)
{
- char *id = xmlGetProp(nodes->nodeTab[i], "id");
+ xmlChar *id = xmlGetProp(nodes->nodeTab[i], (const xmlChar *) "id");
if (id[0] != 'm' && id[0] != 'p')
{
continue;
}
- timezone_offset = g_ascii_strtod (id+1, &endptr);
+ timezone_offset = g_ascii_strtod ((gchar *) id+1, &endptr);
if (*endptr != '\0')
{
g_message ("Unable to parse layer name %s", id);
diff --git a/src/tz.c b/src/tz.c
index 7c216fa..3ec64a3 100644
--- a/src/tz.c
+++ b/src/tz.c
@@ -146,7 +146,6 @@ tz_load_db (void)
{
const gchar *tz_data_file, *admin1_file, *country_file;
TzDB *tz_db;
- char buf[4096];
tz_data_file = tz_data_file_get ("TZ_DATA_FILE", TZ_DATA_FILE);
if (!tz_data_file)
@@ -206,42 +205,6 @@ tz_db_free (TzDB *db)
g_free (db);
}
-static gdouble
-convert_longtitude_to_x (gdouble longitude, gint map_width)
-{
- const gdouble xdeg_offset = -6;
- gdouble x;
-
- x = (map_width * (180.0 + longitude) / 360.0)
- + (map_width * xdeg_offset / 180.0);
-
- return x;
-}
-
-static gdouble
-radians (gdouble degrees)
-{
- return (degrees / 360.0) * G_PI * 2;
-}
-
-static gdouble
-convert_latitude_to_y (gdouble latitude, gdouble map_height)
-{
- gdouble bottom_lat = -59;
- gdouble top_lat = 81;
- gdouble top_per, y, full_range, top_offset, map_range;
-
- top_per = top_lat / 180.0;
- y = 1.25 * log (tan (G_PI_4 + 0.4 * radians (latitude)));
- full_range = 4.6068250867599998;
- top_offset = full_range * top_per;
- map_range = fabs (1.25 * log (tan (G_PI_4 + 0.4 * radians (bottom_lat))) - top_offset);
- y = fabs (y - top_offset);
- y = y / map_range;
- y = y * map_height;
- return y;
-}
-
GPtrArray *
tz_get_locations (TzDB *db)
{
@@ -263,9 +226,6 @@ tz_location_get_utc_offset (CcTimezoneLocation *loc)
gint
tz_location_set_locally (CcTimezoneLocation *loc)
{
- time_t curtime;
- struct tm *curzone;
- gboolean is_dst = FALSE;
gint correction = 0;
const gchar *zone;
@@ -273,22 +233,7 @@ tz_location_set_locally (CcTimezoneLocation *loc)
zone = cc_timezone_location_get_zone(loc);
g_return_val_if_fail (zone != NULL, 0);
- curtime = time (NULL);
- curzone = localtime (&curtime);
- is_dst = curzone->tm_isdst;
-
setenv ("TZ", zone, 1);
-#if 0
- curtime = time (NULL);
- curzone = localtime (&curtime);
-
- if (!is_dst && curzone->tm_isdst) {
- correction = (60 * 60);
- }
- else if (is_dst && !curzone->tm_isdst) {
- correction = 0;
- }
-#endif
return correction;
}
--
2.5.5