summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-07-19 13:35:45 -0700
committerJeremy Allison <jra@samba.org>2011-07-19 23:48:05 +0200
commit93dcfdea389098fd802cc4f5be8d5d578454d624 (patch)
treebd7b211fa51d285dcd0605483e99db5d2ef9f948 /lib
parentee34c25c8a989b5a7c0ad59d71bb39f8efff045c (diff)
downloadsamba-93dcfdea389098fd802cc4f5be8d5d578454d624.tar.gz
samba-93dcfdea389098fd802cc4f5be8d5d578454d624.tar.xz
samba-93dcfdea389098fd802cc4f5be8d5d578454d624.zip
Second part of fix for bug 8310 - toupper_ascii() is broken on big-endian systems.
Re-add: smb_ucs2_t toupper_w(smb_ucs2_t v); and ensure it is called whenever we are operating on smb_ucs2_t variables. I'd like to make the definition of smb_ucs2_t incompatible with int and codepoint_t so they can't be mixed, but that's a patch for another time. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Jul 19 23:48:05 CEST 2011 on sn-devel-104
Diffstat (limited to 'lib')
-rw-r--r--lib/util/charset/charset.h1
-rw-r--r--lib/util/charset/util_unistr_w.c11
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index 08bb4533d2..ce297d0ddd 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -257,6 +257,7 @@ int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
int strcmp_wa(const smb_ucs2_t *a, const char *b);
+smb_ucs2_t toupper_w(smb_ucs2_t v);
/*
* Define stub for charset module which implements 8-bit encoding with gaps.
diff --git a/lib/util/charset/util_unistr_w.c b/lib/util/charset/util_unistr_w.c
index fc6d3747bd..7e0ece383f 100644
--- a/lib/util/charset/util_unistr_w.c
+++ b/lib/util/charset/util_unistr_w.c
@@ -252,3 +252,14 @@ int strcmp_wa(const smb_ucs2_t *a, const char *b)
}
return (*(COPY_UCS2_CHAR(&cp,a)) - UCS2_CHAR(*b));
}
+
+smb_ucs2_t toupper_w(smb_ucs2_t v)
+{
+ smb_ucs2_t ret;
+ /* LE to native. */
+ codepoint_t cp = SVAL(&v,0);
+ cp = toupper_m(cp);
+ /* native to LE. */
+ SSVAL(&ret,0,cp);
+ return ret;
+}