diff options
Diffstat (limited to 'source/lib/util_unistr.c')
-rw-r--r-- | source/lib/util_unistr.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c index a2bd0cf4913..c044e8f248c 100644 --- a/source/lib/util_unistr.c +++ b/source/lib/util_unistr.c @@ -348,20 +348,6 @@ void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen) *p = 0; } -/******************************************************************* - duplicate a UNISTR2 string into a null terminated char* - using a talloc context -********************************************************************/ -char *unistr2_tdup(TALLOC_CTX *ctx, const UNISTR2 *str) -{ - char *s; - int maxlen = (str->uni_str_len+1)*4; - if (!str->buffer) return NULL; - s = (char *)talloc(ctx, maxlen); /* convervative */ - if (!s) return NULL; - unistr2_to_ascii(s, str, maxlen); - return s; -} /******************************************************************* Return a number stored in a buffer @@ -506,33 +492,20 @@ char *dos_unistr(char *buf) } /******************************************************************* - 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 unistrcpy(char *dst, char *src) { int num_wchars = 0; + uint16 *wsrc = (uint16 *)src; + uint16 *wdst = (uint16 *)dst; - while (*src) { - *dst++ = *src++; + while (*wsrc) { + *wdst++ = *wsrc++; num_wchars++; } - *dst = 0; + *wdst = 0; return num_wchars; } @@ -2080,11 +2053,6 @@ int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags) { if(dest_len==-1) dest_len=MAXUNI-3; - - if (flags & STR_TERMINATE) - src_len = strlen_w(src)*2+2; - - dest_len = MIN((src_len/2), (dest_len-1)); - unistr_to_ascii(dest, src, dest_len); + unistr_to_ascii(dest, src, dest_len - 1); return src_len; } |