1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
diff -upr libgweather-3.10.2.old//configure libgweather-3.10.2/configure
--- libgweather-3.10.2.old//configure 2014-02-02 16:39:52 +0000
+++ libgweather-3.10.2/configure 2014-04-15 14:05:25 +0000
@@ -15884,16 +15884,16 @@ case "$am__api_version" in
;;
esac
-INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.50.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.40.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
-if test -n "0.50.0"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= 0.50.0" >&5
-$as_echo_n "checking for intltool >= 0.50.0... " >&6; }
+if test -n "0.40.0"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= 0.40.0" >&5
+$as_echo_n "checking for intltool >= 0.40.0... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5
$as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; }
test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
- as_fn_error $? "Your intltool is too old. You need intltool 0.50.0 or later." "$LINENO" 5
+ as_fn_error $? "Your intltool is too old. You need intltool 0.40.0 or later." "$LINENO" 5
fi
# Extract the first word of "intltool-update", so it can be a program name with args.
diff -upr libgweather-3.10.2.old//libgweather/weather-owm.c libgweather-3.10.2/libgweather/weather-owm.c
--- libgweather-3.10.2.old//libgweather/weather-owm.c 2014-04-15 14:03:39 +0000
+++ libgweather-3.10.2/libgweather/weather-owm.c 2014-04-15 13:58:56 +0000
@@ -29,7 +29,6 @@
#include <math.h>
#include <time.h>
#include <unistd.h>
-#include <langinfo.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
@@ -130,32 +129,20 @@ static time_t
date_to_time_t (const xmlChar *str, const char * tzid)
{
struct tm time = { 0 };
- GTimeZone *tz;
GDateTime *dt;
time_t rval;
+ GTimeVal tv;
char *after;
- after = strptime ((const char*) str, "%Y-%m-%dT%T", &time);
- if (after == NULL) {
+ if (!g_time_val_from_iso8601 ((const char*) str, &tv)) {
g_warning ("Cannot parse date string \"%s\"", str);
return 0;
}
- if (*after == 'Z')
- tzid = "UTC";
-
- tz = g_time_zone_new (tzid);
- dt = g_date_time_new (tz,
- time.tm_year + 1900,
- time.tm_mon + 1,
- time.tm_mday,
- time.tm_hour,
- time.tm_min,
- time.tm_sec);
+ dt = g_date_time_new_from_timeval_local (&tv);
rval = g_date_time_to_unix (dt);
- g_time_zone_unref (tz);
g_date_time_unref (dt);
return rval;
diff -upr libgweather-3.10.2.old//libgweather/weather-priv.h libgweather-3.10.2/libgweather/weather-priv.h
--- libgweather-3.10.2.old//libgweather/weather-priv.h 2014-04-15 14:03:39 +0000
+++ libgweather-3.10.2/libgweather/weather-priv.h 2014-04-15 13:58:57 +0000
@@ -32,7 +32,7 @@
#include "gweather-location.h"
#ifdef _WIN32
-#include "gweather-win32.h"
+#define localtime_r(t,tmp) (localtime (t) ? ((*tmp) = *localtime (t), tmp) : NULL)
#endif
void _gweather_gettext_init (void);
diff -upr libgweather-3.10.2.old//libgweather/weather-yahoo.c libgweather-3.10.2/libgweather/weather-yahoo.c
--- libgweather-3.10.2.old//libgweather/weather-yahoo.c 2014-04-15 14:03:39 +0000
+++ libgweather-3.10.2/libgweather/weather-yahoo.c 2014-04-15 13:58:57 +0000
@@ -151,10 +151,35 @@ date_to_time_t (const xmlChar *str)
{
struct tm time = { 0 };
+ #ifdef G_OS_WIN32
+ char mnthname[10] = {0};
+ int day, month, year;
+ const gchar tm_months[][4] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+ if (sscanf ((const char*) str, "%d %3s %4d", &day, mnthname, &year) != 3) {
+ g_warning ("Cannot parse date string \"%s\"", str);
+ return 0;
+ }
+ for (month = 0; month < 12; month++) {
+ if (g_ascii_strcasecmp (tm_months[month], mnthname) == 0) {
+ break;
+ }
+ }
+ if (month == 12) {
+ g_warning ("Cannot parse date string \"%s\"", str);
+ return 0;
+ }
+ time.tm_mday = day;
+ time.tm_mon = month;
+ time.tm_year = year - 1900;
+ #else
if (!strptime ((const char*) str, "%d %b %Y", &time)) {
g_warning ("Cannot parse date string \"%s\"", str);
return 0;
}
+ #endif
return mktime(&time);
}
diff -upr libgweather-3.10.2.old//libgweather/weather-yrno.c libgweather-3.10.2/libgweather/weather-yrno.c
--- libgweather-3.10.2.old//libgweather/weather-yrno.c 2014-04-15 14:03:39 +0000
+++ libgweather-3.10.2/libgweather/weather-yrno.c 2014-04-15 13:58:57 +0000
@@ -91,32 +91,20 @@ static time_t
date_to_time_t (const xmlChar *str, const char * tzid)
{
struct tm time = { 0 };
- GTimeZone *tz;
GDateTime *dt;
time_t rval;
+ GTimeVal tv;
char *after;
- after = strptime ((const char*) str, "%Y-%m-%dT%T", &time);
- if (after == NULL) {
+ if (!g_time_val_from_iso8601 ((const char*) str, &tv)) {
g_warning ("Cannot parse date string \"%s\"", str);
return 0;
}
- if (*after == 'Z')
- tzid = "UTC";
-
- tz = g_time_zone_new (tzid);
- dt = g_date_time_new (tz,
- time.tm_year + 1900,
- time.tm_mon + 1,
- time.tm_mday,
- time.tm_hour,
- time.tm_min,
- time.tm_sec);
+ dt = g_date_time_new_from_timeval_local (&tv);
rval = g_date_time_to_unix (dt);
- g_time_zone_unref (tz);
g_date_time_unref (dt);
return rval;
diff -upr libgweather-3.10.2.old//libgweather/weather.c libgweather-3.10.2/libgweather/weather.c
--- libgweather-3.10.2.old//libgweather/weather.c 2014-04-15 14:03:39 +0000
+++ libgweather-3.10.2/libgweather/weather.c 2014-04-15 13:58:57 +0000
@@ -28,7 +28,10 @@
#include <math.h>
#include <time.h>
#include <unistd.h>
+
+#ifdef HAVE_NL_LANGINFO
#include <langinfo.h>
+#endif
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -701,12 +704,14 @@ gweather_info_get_conditions (GWeatherIn
static gboolean
is_locale_metric (void)
{
+#ifdef HAVE_NL_LANGINFO
const char *fmt;
fmt = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
if (fmt && *fmt == 2)
return FALSE;
else
+#endif /* HAVE_NL_LANGINFO */
return TRUE;
}
|