diff options
author | Elrond <elrond@samba.org> | 2000-08-05 16:10:57 +0000 |
---|---|---|
committer | Elrond <elrond@samba.org> | 2000-08-05 16:10:57 +0000 |
commit | 41e568317c56eec4be8445b85fca8e3144128ae5 (patch) | |
tree | 3f844c12256557692a14deaa1f3b1d8e24b0a062 | |
parent | 00d3d905a5f3239c147e881ebb047ee68596e85c (diff) | |
download | samba-41e568317c56eec4be8445b85fca8e3144128ae5.tar.gz samba-41e568317c56eec4be8445b85fca8e3144128ae5.tar.xz samba-41e568317c56eec4be8445b85fca8e3144128ae5.zip |
init_unistr2_from_unistr for TNG.
-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 c61b490b164..e330e494241 100644 --- a/source/lib/util_unistr.c +++ b/source/lib/util_unistr.c @@ -414,6 +414,38 @@ UNISTR2 *unistr2_assign_ascii_str(UNISTR2 *str, const char *buf) return unistr2_assign_ascii(str, buf, (buf ? strlen(buf) : 0)); } +void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) +{ + BOOL found; + uint32 i = 0; + + if (from == NULL || from->buffer==NULL) + { + unistr2_assign(to, NULL, 0); + return; + } + + /* get the length; UNISTR **are** NUL terminated */ + found = False; + while (!found) + { + if ((from->buffer)[i]=='\0') + found = True; + else + i++; + } + i++; + + if (!found) + { + DEBUG(0,("init_unistr2_from_unistr: non-null terminiated UNISTR!\n")); + return; + } + + unistr2_assign(to, from->buffer, i); +} + + /******************************************************************* grows the buffer of a UNISTR2. doesn't shrink |