diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_unistr.c | 28 |
1 files changed, 27 insertions, 1 deletions
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 @@ -199,8 +199,34 @@ 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. +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; |