summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-03-26 03:15:30 +0000
committerGerald Carter <jerry@samba.org>2002-03-26 03:15:30 +0000
commit737423f06ea08c38592b408faa12a55a95b9d696 (patch)
treeb4d9d1ffba0516040a46766f83dfa7ef17d8cc3c /source3/lib
parent8f9d7ebb35f40ab6bda8f1d6d940df8b6aec4126 (diff)
downloadsamba-737423f06ea08c38592b408faa12a55a95b9d696.tar.gz
samba-737423f06ea08c38592b408faa12a55a95b9d696.tar.bz2
samba-737423f06ea08c38592b408faa12a55a95b9d696.zip
OpenPrinter() merge from 2.2
(This used to be commit 619397cc90549d4602ecddc25ee50eb247c913ee)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_unistr.c32
1 files changed, 32 insertions, 0 deletions
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;
+}