From c6d16eea4394ff1c4d12cb435eebb0686b5ee736 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 11 Feb 1999 18:50:13 +0000 Subject: the UNICODE issue... (This used to be commit 73db80f34183324845407b00f58462ff2d7b47ea) --- source3/lib/util_unistr.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 5e73fe6ada..641f891f83 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -193,6 +193,32 @@ char *buffer2_to_multistr(BUFFER2 *str) return lbuf; } +/******************************************************************* +create a null-terminated unicode string from a null-terminated ascii string. +return number of unicode chars copied, excluding the null character. +only handles ascii strings +Unicode strings created are in little-endian format. +********************************************************************/ +int str_to_unistr16(uint16 *dst, const char *src) +{ + size_t len = 0; + + if (dst == NULL) + return 0; + + if (src != NULL) + { + for (; *src && len < MAXUNI-2; len++, dst++, src++) + { + *dst = *src; + } + } + + *dst = 0; + + return len; +} + /******************************************************************* create a null-terminated unicode string from a null-terminated ascii string. return number of unicode chars copied, excluding the null character. @@ -200,7 +226,7 @@ only handles ascii strings Unicode strings created are in little-endian format. ********************************************************************/ -int struni2(char *dst, const char *src) +int str_to_unistr8(char *dst, const char *src) { size_t len = 0; -- cgit