summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-21 05:50:29 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-21 05:50:29 +0000
commite5f60ce0b33787372e24716cb4867f4cb8124471 (patch)
tree7b377a39146985d0e949f9f32956d7a8954d6f4d
parentd689f00026541dd2cb87c6949fdc2f8eb3ad919f (diff)
downloadsamba-e5f60ce0b33787372e24716cb4867f4cb8124471.tar.gz
samba-e5f60ce0b33787372e24716cb4867f4cb8124471.tar.bz2
samba-e5f60ce0b33787372e24716cb4867f4cb8124471.zip
make ascii_to_unistr always use little-endian. This fn is never used
except in my code so I know this is safe. otherwise unicode client lib doesn't work on big-endian hosts (This used to be commit 18ede716d10de1ac774cca82b4b8ff5ea1a9650d)
-rw-r--r--source3/lib/util_unistr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 3cbbc6f2da..5e6f6a5945 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -223,6 +223,7 @@ char *dos_unistr2_to_str(UNISTR2 *str)
/*******************************************************************
Put an ASCII string into a UNICODE array (uint16's).
+ use little-endian ucs2
********************************************************************/
void ascii_to_unistr(uint16 *dest, const char *src, int maxlen)
{
@@ -237,7 +238,8 @@ void ascii_to_unistr(uint16 *dest, const char *src, int maxlen)
break;
}
- *(dest++) = (uint16)c;
+ SSVAL(dest, 0, c);
+ dest++;
}
*dest = 0;
@@ -262,7 +264,8 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len)
/* normal code path for a valid 'src' */
while (dest < destend)
{
- c = *(src++);
+ c = SVAL(src, 0);
+ src++;
if (c == 0)
{
break;