From e5f60ce0b33787372e24716cb4867f4cb8124471 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 21 Feb 2001 05:50:29 +0000 Subject: 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) --- source3/lib/util_unistr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/lib') 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; -- cgit