libtimezonemap/0009-Remove-the-sun-specific-tzdata-path.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

141 lines
4.2 KiB
Diff

From 380f1f88396e7c08da0d422b3416cb51c15d6a22 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 24 Jun 2016 16:15:51 -0400
Subject: [PATCH 09/24] Remove the sun specific tzdata path.
tz.c no longer uesrs tzdata so this is obsolete.
---
src/tz.c | 65 +---------------------------------------------------------------
src/tz.h | 6 +-----
2 files changed, 2 insertions(+), 69 deletions(-)
diff --git a/src/tz.c b/src/tz.c
index 9aa9e8a..30f688d 100644
--- a/src/tz.c
+++ b/src/tz.c
@@ -36,9 +36,6 @@
/* Forward declarations for private functions */
-#ifdef __sun
-static float convert_pos (gchar *pos, int digits);
-#endif
static int compare_country_names (const void *a, const void *b);
static void sort_locations_by_country (GPtrArray *locations);
static const gchar * tz_data_file_get (const gchar *env, const gchar *defaultfile);
@@ -131,42 +128,10 @@ void parse_cities15000 (gpointer parsed_data,
cc_timezone_location_set_latitude(loc, g_ascii_strtod(parsed_data_v[4], NULL));
cc_timezone_location_set_longitude(loc, g_ascii_strtod(parsed_data_v[5], NULL));
-#ifdef __sun
- gchar *latstr, *lngstr, *p;
-
- latstr = g_strdup (parsed_data_v[1]);
- p = latstr + 1;
- while (*p != '-' && *p != '+') p++;
- lngstr = g_strdup (p);
- *p = '\0';
-
- if (parsed_data_v[3] && *parsed_data_v[3] == '-' && parsed_data_v[4])
- loc->comment = g_strdup (parsed_data_v[4]);
-
- if (parsed_data_v[3] && *parsed_data_v[3] != '-' && !islower(loc->zone)) {
- CcTimezoneLocation *locgrp;
-
- /* duplicate entry */
- locgrp = cc_timezone_location_new ();
- locgrp->country = g_strdup (parsed_data_v[0]);
- locgrp->en_name = NULL;
- locgrp->zone = g_strdup (parsed_data_v[3]);
- locgrp->latitude = convert_pos (latstr, 2);
- locgrp->longitude = convert_pos (lngstr, 3);
- locgrp->comment = (parsed_data_v[4]) ? g_strdup (parsed_data_v[4]) : NULL;
-
- g_ptr_array_add (ptr_array, (gpointer) locgrp);
- }
-#else
cc_timezone_location_set_comment(loc, NULL);
-#endif
g_ptr_array_add (ptr_array, (gpointer) loc);
-#ifdef __sun
- g_free (latstr);
- g_free (lngstr);
-#endif
g_strfreev (parsed_data_v);
return;
@@ -350,7 +315,6 @@ tz_info_from_location (CcTimezoneLocation *loc)
curtime = time (NULL);
curzone = localtime (&curtime);
-#ifndef __sun
/* Currently this solution doesnt seem to work - I get that */
/* America/Phoenix uses daylight savings, which is wrong */
tzinfo->tzname_normal = g_strdup (curzone->tm_zone);
@@ -361,11 +325,6 @@ tz_info_from_location (CcTimezoneLocation *loc)
tzinfo->tzname_daylight = NULL;
tzinfo->utc_offset = curzone->tm_gmtoff;
-#else
- tzinfo->tzname_normal = NULL;
- tzinfo->tzname_daylight = NULL;
- tzinfo->utc_offset = 0;
-#endif
tzinfo->daylight = curzone->tm_isdst;
@@ -397,30 +356,8 @@ tz_data_file_get (const gchar *env, const gchar *defaultfile)
return filename ? filename : defaultfile;
}
-#ifdef __sun
-static float
-convert_pos (gchar *pos, int digits)
-{
- gchar whole[10];
- gchar *fraction;
- gint i;
- float t1, t2;
- if (!pos || strlen(pos) < 4 || digits > 9) return 0.0;
-
- for (i = 0; i < digits + 1; i++) whole[i] = pos[i];
- whole[i] = '\0';
- fraction = pos + digits + 1;
-
- t1 = g_strtod (whole, NULL);
- t2 = g_strtod (fraction, NULL);
-
- if (t1 >= 0.0) return t1 + t2/pow (10.0, strlen(fraction));
- else return t1 - t2/pow (10.0, strlen(fraction));
-}
-#endif
-
- static int
+static int
compare_country_names (const void *a, const void *b)
{
CcTimezoneLocation *tza = * (CcTimezoneLocation **) a;
diff --git a/src/tz.h b/src/tz.h
index 8d033de..b94a886 100644
--- a/src/tz.h
+++ b/src/tz.h
@@ -30,11 +30,7 @@
#include "cc-timezone-location.h"
-#ifndef __sun
-# define TZ_DATA_FILE "/usr/share/libtimezonemap/cities15000.txt"
-#else
-# define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
-#endif
+# define TZ_DATA_FILE "/usr/share/libtimezonemap/cities15000.txt"
# define ADMIN1_FILE "/usr/share/libtimezonemap/admin1Codes.txt"
# define COUNTRY_FILE "/usr/share/libtimezonemap/countryInfo.txt"
--
2.5.5