From 737423f06ea08c38592b408faa12a55a95b9d696 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 26 Mar 2002 03:15:30 +0000 Subject: OpenPrinter() merge from 2.2 (This used to be commit 619397cc90549d4602ecddc25ee50eb247c913ee) --- source3/lib/util_unistr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 060460bb2c..a1cff26169 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -743,3 +743,35 @@ BOOL trim_string_wa(smb_ucs2_t *s, const char *front, else *b = 0; return trim_string_w(s, f, b); } + +/******************************************************************* + returns the length in number of wide characters + ******************************************************************/ +int unistrlen(uint16 *s) +{ + int len; + + if (!s) + return -1; + + for (len=0; *s; s++,len++); + + return len; +} + +/******************************************************************* + Strcpy for unicode strings. returns length (in num of wide chars) +********************************************************************/ + +int unistrcpy(uint16 *dst, uint16 *src) +{ + int num_wchars = 0; + + while (*src) { + *dst++ = *src++; + num_wchars++; + } + *dst = 0; + + return num_wchars; +} -- cgit