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
|
The Atom date formating code tries to create a RFC822 date. This date
requires to use the C locale for the date (for weekday-names and month-names).
This patch uses new POSIX functionality to create a C locale and strftime_l
to create a right RFC822 date.
Index: libmrss-0.17/src/mrss.h
===================================================================
--- libmrss-0.17.orig/src/mrss.h 2007-02-02 12:23:49.000000000 +0100
+++ libmrss-0.17/src/mrss.h 2007-04-01 19:46:41.000000000 +0200
@@ -364,6 +364,9 @@
mrss_element_t element;
int allocated;
+ /** For internal use only: */
+ void* c_locale;
+
/* Data: */
char *file;
Index: libmrss-0.17/src/mrss_free.c
===================================================================
--- libmrss-0.17.orig/src/mrss_free.c 2007-02-02 12:47:46.000000000 +0100
+++ libmrss-0.17/src/mrss_free.c 2007-04-01 19:46:41.000000000 +0200
@@ -22,9 +22,14 @@
# error Use configure; make; make install
#endif
+#define _GNU_SOURCE
+
#include "mrss.h"
#include "mrss_internal.h"
+#include <locale.h>
+
+
static void __mrss_free_channel (mrss_t * mrss);
static void __mrss_free_category (mrss_category_t * category);
static void __mrss_free_hour (mrss_hour_t * hour);
@@ -202,6 +207,9 @@
__mrss_free_item ((mrss_item_t *) old);
}
+ if (mrss->c_locale)
+ freelocale (mrss->c_locale);
+
if (mrss->allocated)
free (mrss);
}
Index: libmrss-0.17/src/mrss_parser.c
===================================================================
--- libmrss-0.17.orig/src/mrss_parser.c 2007-04-01 19:46:41.000000000 +0200
+++ libmrss-0.17/src/mrss_parser.c 2007-04-01 20:38:06.000000000 +0200
@@ -22,9 +22,13 @@
# error Use configure; make; make install
#endif
+#define _GNU_SOURCE
+
#include "mrss.h"
#include "mrss_internal.h"
+#include <locale.h>
+
static void
__mrss_parse_tag_insert (mrss_tag_t ** where, mrss_tag_t * what)
{
@@ -133,7 +137,7 @@
}
static char *
-__mrss_atom_prepare_date (char *datestr)
+__mrss_atom_prepare_date (mrss_t *data, char *datestr)
{
char *ret = NULL;
if (datestr)
@@ -150,8 +154,13 @@
stm.tm_year -= 1900;
char datebuf[256];
free (datestr);
- strftime (datebuf, sizeof (datebuf), "%a, %d %b %Y %H:%M:%S %z",
- &stm);
+
+ if (!data->c_locale) {
+ data->c_locale = newlocale(LC_ALL_MASK,"C",NULL);
+ }
+
+ strftime_l (datebuf, sizeof (datebuf), "%a, %d %b %Y %H:%M:%S %z",
+ &stm, data->c_locale);
ret = strdup (datebuf);
}
}
@@ -269,16 +278,16 @@
else if (!strcmp (cur->value, "published") && !item->pubDate
&& data->version == MRSS_VERSION_ATOM_1_0)
item->pubDate =
- __mrss_atom_prepare_date (nxmle_get_string (cur, NULL));
+ __mrss_atom_prepare_date (data, nxmle_get_string (cur, NULL));
else if (!strcmp(cur->value, "updated" ) && !item->pubDate
&& data->version == MRSS_VERSION_ATOM_1_0)
item->pubDate =
- __mrss_atom_prepare_date (nxmle_get_string (cur, NULL));
+ __mrss_atom_prepare_date (data, nxmle_get_string (cur, NULL));
/* issued -> pubDate (Atom 0.3) */
else if (!strcmp (cur->value, "issued") && !item->pubDate)
item->pubDate =
- __mrss_atom_prepare_date (nxmle_get_string (cur, NULL));
+ __mrss_atom_prepare_date (data, nxmle_get_string (cur, NULL));
/* id -> guid */
else if (!strcmp (cur->value, "id") && !item->guid
@@ -701,7 +710,7 @@
/* updated -> lastBuildDate */
else if (!strcmp (cur->value, "updated"))
data->lastBuildDate =
- __mrss_atom_prepare_date (nxmle_get_string (cur, NULL));
+ __mrss_atom_prepare_date (data, nxmle_get_string (cur, NULL));
/* author -> managingeditor */
else if (!strcmp (cur->value, "author"))
|