diff options
author | Gerald Carter <jerry@samba.org> | 2002-03-26 03:15:30 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-03-26 03:15:30 +0000 |
commit | 619397cc90549d4602ecddc25ee50eb247c913ee (patch) | |
tree | af9c305c488201179a598dc60c9e3b768bee91c6 /source/lib/util_unistr.c | |
parent | 4eb29ac559faf29b348a4097a33f9cbf4cf9d057 (diff) | |
download | samba-619397cc90549d4602ecddc25ee50eb247c913ee.tar.gz samba-619397cc90549d4602ecddc25ee50eb247c913ee.tar.xz samba-619397cc90549d4602ecddc25ee50eb247c913ee.zip |
OpenPrinter() merge from 2.2
Diffstat (limited to 'source/lib/util_unistr.c')
-rw-r--r-- | source/lib/util_unistr.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c index 060460bb2ca..a1cff26169a 100644 --- a/source/lib/util_unistr.c +++ b/source/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; +} |