1 Copyright (C) 2008 Rémi Denis-Courmont, adaptation by Felix Kühne (C) 2009.
2 Licensed under GNU General Public License version 2 or higher.
3 diff -urN live.orig/liveMedia/include/Locale.hh live/liveMedia/include/Locale.hh
4 --- live.orig/liveMedia/include/Locale.hh 2009-03-23 01:26:16 +0300
5 +++ live/liveMedia/include/Locale.hh 2009-03-26 19:17:43 +0300
8 #ifndef LOCALE_NOT_USED
17 +#define LC_ALL_MASK 0
21 +#ifndef LC_NUMERIC_MASK
22 +#define LC_NUMERIC_MASK 0
24 +typedef int locale_t;
29 - Locale(char const* newLocale, int category = LC_ALL);
30 + Locale(char const* newLocale, int category = LC_ALL_MASK);
36 + locale_t fLocale, fPrevLocale;
40 diff -urN live.orig/liveMedia/Locale.cpp live/liveMedia/Locale.cpp
41 --- live.orig/liveMedia/Locale.cpp 2009-03-23 01:26:16 +0300
42 +++ live/liveMedia/Locale.cpp 2009-03-26 19:17:43 +0300
47 -Locale::Locale(char const* newLocale, int category)
48 - : fCategory(category) {
49 +Locale::Locale(char const* newLocale, int category) {
50 #ifndef LOCALE_NOT_USED
51 - fPrevLocale = strDup(setlocale(category, NULL));
52 - setlocale(category, newLocale);
53 + fLocale = newlocale(category, newLocale, NULL);
54 + fPrevLocale = uselocale(fLocale);
59 #ifndef LOCALE_NOT_USED
60 - if (fPrevLocale != NULL) {
61 - setlocale(fCategory, fPrevLocale);
62 - delete[] fPrevLocale;
63 + if (fLocale != (locale_t)0) {
64 + uselocale(fPrevLocale);
65 + freelocale(fLocale);
69 diff -urN live.orig/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
70 --- live.orig/liveMedia/RTSPClient.cpp 2009-03-23 01:26:16 +0300
71 +++ live/liveMedia/RTSPClient.cpp 2009-03-26 19:29:38 +0300
73 // This is the default value; we don't need a "Scale:" header:
76 - Locale l("C", LC_NUMERIC);
77 + Locale l("C", LC_NUMERIC_MASK);
78 sprintf(buf, "Scale: %f\r\n", scale);
81 @@ -1033,11 +1033,11 @@
84 // There's no end time:
85 - Locale l("C", LC_NUMERIC);
86 + Locale l("C", LC_NUMERIC_MASK);
87 sprintf(buf, "Range: npt=%.3f-\r\n", start);
89 // There's both a start and an end time; include them both in the "Range:" hdr
90 - Locale l("C", LC_NUMERIC);
91 + Locale l("C", LC_NUMERIC_MASK);
92 sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
96 if (_strncasecmp(line, "Scale: ", 7) != 0) return False;
99 - Locale l("C", LC_NUMERIC);
100 + Locale l("C", LC_NUMERIC_MASK);
101 return sscanf(line, "%f", &scale) == 1;
104 diff -urN live.orig/liveMedia/RTSPCommon.cpp live/liveMedia/RTSPCommon.cpp
105 --- live.orig/liveMedia/RTSPCommon.cpp 2009-03-23 01:26:16 +0300
106 +++ live/liveMedia/RTSPCommon.cpp 2009-03-26 19:23:25 +0300
108 char const* fields = buf + 7;
109 while (*fields == ' ') ++fields;
111 - Locale l("C", LC_NUMERIC);
112 + Locale l("C", LC_NUMERIC_MASK);
113 if (sscanf(fields, "npt = %lf - %lf", &start, &end) == 2) {