1 Index: SAMBA_3_0/source/lib/util_unistr.c
2 ===================================================================
3 --- SAMBA_3_0/source/lib/util_unistr.c (revision 12521)
4 +++ SAMBA_3_0/source/lib/util_unistr.c (revision 12522)
6 void load_case_tables(void)
8 static int initialised;
9 + char *old_locale = NULL, *saved_locale = NULL;
14 upcase_table = map_file(data_path("upcase.dat"), 0x20000);
15 lowcase_table = map_file(data_path("lowcase.dat"), 0x20000);
17 +#ifdef HAVE_SETLOCALE
18 + /* Get the name of the current locale. */
19 + old_locale = setlocale(LC_ALL, NULL);
21 + /* Save it as it is in static storage. */
22 + saved_locale = SMB_STRDUP(old_locale);
24 + /* We set back the locale to C to get ASCII-compatible toupper/lower functions. */
25 + setlocale(LC_ALL, "C");
28 /* we would like Samba to limp along even if these tables are
32 lowcase_table[v] = UCS2_CHAR(isupper(i)?tolower(i):i);
36 +#ifdef HAVE_SETLOCALE
37 + /* Restore the old locale. */
38 + setlocale (LC_ALL, saved_locale);
39 + SAFE_FREE(saved_locale);
49 +/*************************************************************
50 + ascii only toupper - saves the need for smbd to be in C locale.
51 +*************************************************************/
53 +int toupper_ascii(int c)
55 + smb_ucs2_t uc = toupper_w(UCS2_CHAR(c));
56 + return UCS2_TO_CHAR(uc);
59 +/*************************************************************
60 + ascii only tolower - saves the need for smbd to be in C locale.
61 +*************************************************************/
63 +int tolower_ascii(int c)
65 + smb_ucs2_t uc = tolower_w(UCS2_CHAR(c));
66 + return UCS2_TO_CHAR(uc);
69 +/*************************************************************
70 + ascii only isupper - saves the need for smbd to be in C locale.
71 +*************************************************************/
73 +int isupper_ascii(int c)
75 + return isupper_w(UCS2_CHAR(c));
78 +/*************************************************************
79 + ascii only islower - saves the need for smbd to be in C locale.
80 +*************************************************************/
82 +int islower_ascii(int c)
84 + return islower_w(UCS2_CHAR(c));
86 Index: SAMBA_3_0/source/lib/charcnv.c
87 ===================================================================
88 --- SAMBA_3_0/source/lib/charcnv.c (revision 12521)
89 +++ SAMBA_3_0/source/lib/charcnv.c (revision 12522)
94 -#ifdef HAVE_SETLOCALE
95 - /* We set back the locale to C to get ASCII-compatible toupper/lower functions.
96 - For now we do not need any other POSIX localisations anyway. When we should
97 - really need localized string functions one day we need to write our own
100 - setlocale(LC_ALL, "C");
105 if (!ret || !*ret) ret = "ASCII";
106 Desc: Back out changes made to 3_0_RELEASE branch that disabled the above hacks
107 ===============================================================================
108 --- SAMBA_3_0/source/include/smb_macros.h 2006-01-25 10:46:39.000000000 +1100
109 +++ SAMBA_3_0/source/include/smb_macros.h 2006-04-10 21:16:13.000000000 +1000
111 #ifndef _SMB_MACROS_H
112 #define _SMB_MACROS_H
114 -/* no ops to help reduce the diff between the current 3.0 and release branch */
116 -#define toupper_ascii(x) toupper(x)
117 -#define tolower_ascii(x) tolower(x)
118 -#define isupper_ascii(x) isupper(x)
119 -#define islower_ascii(x) islower(x)
122 /* Misc bit macros */
123 #define BOOLSTR(b) ((b) ? "Yes" : "No")
124 #define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)