summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-08-12 21:06:49 +0000
committerGerald Carter <jerry@samba.org>2005-08-12 21:06:49 +0000
commit8097b6916dccad45f8b1007c57bf1ec6f7d05d8f (patch)
tree75fbec5b66ff7318838f0f6a679c19d38420a746
parent01ab3f01a81ccfccd68bf62214cb151ae1eaac9b (diff)
downloadsamba-8097b6916dccad45f8b1007c57bf1ec6f7d05d8f.tar.gz
r9273: merge jra's fix for non-enlish characters in strncmp_w()
-rw-r--r--WHATSNEW.txt2
-rw-r--r--source/lib/util_str.c10
-rw-r--r--source/lib/util_unistr.c8
3 files changed, 11 insertions, 9 deletions
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 073c40269fb..887ca02b797 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -47,6 +47,8 @@ commits
o Jeremy Allison <jra@samba.org>
* Fix minor compiler warnings in printing/printing.c.
* Merge new DOS error code from SAMBA_4.
+ * Fix issue when non-English characters in filenames and
+ directories.
o Gerald (Jerry) Carter <jerry@samba.org>
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index 1401d6d8534..567e70d8c21 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -183,7 +183,7 @@ char **toktocliplist(int *ctok, const char *sep)
int StrCaseCmp(const char *s, const char *t)
{
- const char * ps, * pt;
+ const char *ps, *pt;
size_t size;
smb_ucs2_t *buffer_s, *buffer_t;
int ret;
@@ -211,17 +211,17 @@ int StrCaseCmp(const char *s, const char *t)
return +1;
}
- size = push_ucs2_allocate(&buffer_s, s);
+ size = push_ucs2_allocate(&buffer_s, ps);
if (size == (size_t)-1) {
- return strcmp(s, t);
+ return strcmp(ps, pt);
/* Not quite the right answer, but finding the right one
under this failure case is expensive, and it's pretty close */
}
- size = push_ucs2_allocate(&buffer_t, t);
+ size = push_ucs2_allocate(&buffer_t, pt);
if (size == (size_t)-1) {
SAFE_FREE(buffer_s);
- return strcmp(s, t);
+ return strcmp(ps, pt);
/* Not quite the right answer, but finding the right one
under this failure case is expensive, and it's pretty close */
}
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index 6b29a0d26a7..8ed8c5c37fb 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -568,7 +568,7 @@ int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b)
a++;
b++;
}
- return cpa - cpb;
+ return (*(COPY_UCS2_CHAR(&cpa,a)) - *(COPY_UCS2_CHAR(&cpb,b)));
/* warning: if *a != *b and both are not 0 we return a random
greater or lesser than 0 number not realted to which
string is longer */
@@ -584,7 +584,7 @@ int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len)
b++;
n++;
}
- return (len - n)?(cpa - cpb):0;
+ return (len - n)?(*(COPY_UCS2_CHAR(&cpa,a)) - *(COPY_UCS2_CHAR(&cpb,b))):0;
}
/*******************************************************************
@@ -599,7 +599,7 @@ int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b)
a++;
b++;
}
- return (tolower_w(cpa) - tolower_w(cpb));
+ return (tolower_w(*(COPY_UCS2_CHAR(&cpa,a))) - tolower_w(*(COPY_UCS2_CHAR(&cpb,b))));
}
/*******************************************************************
@@ -616,7 +616,7 @@ int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len)
b++;
n++;
}
- return (len - n)?(tolower_w(cpa) - tolower_w(cpb)):0;
+ return (len - n)?(tolower_w(*(COPY_UCS2_CHAR(&cpa,a))) - tolower_w(*(COPY_UCS2_CHAR(&cpb,b)))):0;
}
/*******************************************************************