summaryrefslogtreecommitdiffstats
path: root/source/lib/util_unistr.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/util_unistr.c')
-rw-r--r--source/lib/util_unistr.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index a0015c265fb..cf040a2dfc0 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -88,10 +88,12 @@ void load_case_tables(void)
}
initialised = 1;
- upcase_table = map_file(lib_path("upcase.dat"), 0x20000);
+ upcase_table = (smb_ucs2_t *)map_file(lib_path("upcase.dat"),
+ 0x20000);
upcase_table_use_unmap = ( upcase_table != NULL );
- lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);
+ lowcase_table = (smb_ucs2_t *)map_file(lib_path("lowcase.dat"),
+ 0x20000);
lowcase_table_use_unmap = ( lowcase_table != NULL );
#ifdef HAVE_SETLOCALE
@@ -111,7 +113,7 @@ void load_case_tables(void)
not available */
if (!upcase_table) {
DEBUG(1,("creating lame upcase table\n"));
- upcase_table = SMB_MALLOC(0x20000);
+ upcase_table = (smb_ucs2_t *)SMB_MALLOC(0x20000);
for (i=0;i<0x10000;i++) {
smb_ucs2_t v;
SSVAL(&v, 0, i);
@@ -126,7 +128,7 @@ void load_case_tables(void)
if (!lowcase_table) {
DEBUG(1,("creating lame lowcase table\n"));
- lowcase_table = SMB_MALLOC(0x20000);
+ lowcase_table = (smb_ucs2_t *)SMB_MALLOC(0x20000);
for (i=0;i<0x10000;i++) {
smb_ucs2_t v;
SSVAL(&v, 0, i);
@@ -169,11 +171,11 @@ static int check_dos_char_slowly(smb_ucs2_t c)
smb_ucs2_t c2 = 0;
int len1, len2;
- len1 = convert_string(CH_UCS2, CH_DOS, &c, 2, buf, sizeof(buf),False);
+ len1 = convert_string(CH_UTF16LE, CH_DOS, &c, 2, buf, sizeof(buf),False);
if (len1 == 0) {
return 0;
}
- len2 = convert_string(CH_DOS, CH_UCS2, buf, len1, &c2, 2,False);
+ len2 = convert_string(CH_DOS, CH_UTF16LE, buf, len1, &c2, 2,False);
if (len2 != 2) {
return 0;
}
@@ -228,7 +230,7 @@ void init_valid_table(void)
return;
}
- valid_file = map_file(lib_path("valid.dat"), 0x10000);
+ valid_file = (uint8 *)map_file(lib_path("valid.dat"), 0x10000);
if (valid_file) {
valid_table = valid_file;
mapped_file = 1;
@@ -247,7 +249,7 @@ void init_valid_table(void)
valid_table_use_unmap = False;
DEBUG(2,("creating default valid table\n"));
- valid_table = SMB_MALLOC(0x10000);
+ valid_table = (uint8 *)SMB_MALLOC(0x10000);
for (i=0;i<128;i++) {
valid_table[i] = isalnum(i) || strchr(allowed,i);
}
@@ -482,7 +484,7 @@ size_t strnlen_w(const smb_ucs2_t *src, size_t max)
size_t len;
smb_ucs2_t c;
- for(len = 0; *(COPY_UCS2_CHAR(&c,src)) && (len < max); src++, len++) {
+ for(len = 0; (len < max) && *(COPY_UCS2_CHAR(&c,src)); src++, len++) {
;
}