From f9e9f98a4a579f24d8ad1804b22bf36ede250e23 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 22 Jun 2000 01:39:17 +0000 Subject: lib/util_unistr.c: Removed ascii_to_unistr() as it does no codepage. Removed unistr_to_ascii() as it was never used. printing/nt_printing.c: Removed "DUMMY.XX" files. rpc_server/srv_spoolss_nt.c: Use dos_PutUniCode() instead of ascii_to_unistr(). Attempted to fix the "return value" size code based on J.F's comments. This needs looking at. Jeremy. (This used to be commit de99011bf3b2a23bd1854a047382a107aaeb9c68) --- source3/lib/util_unistr.c | 51 +++-------------------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 792cf2384a..d4a159a28e 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -48,13 +48,13 @@ static uint16 *ucs2_to_unixcp; if null_terminate is True then null terminate the packet (adds 2 bytes) - the return value is the length consumed by the string, including the + the return value is the length in bytes consumed by the string, including the null termination if applied ********************************************************************/ -int dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate) +size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate) { - int ret = 0; + size_t ret = 0; while (*src && (len > 2)) { size_t skip = get_character_len(*src); smb_ucs2_t val = (*src & 0xff); @@ -83,51 +83,6 @@ int dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate) return(ret); } -/******************************************************************* - Put an ASCII string into a UNICODE string. - - Warning: doesn't do any codepage !!! BAD !!! - - Help ! Fix Me ! Fix Me ! -********************************************************************/ - -void ascii_to_unistr(char *dest, const char *src, size_t maxlen) -{ - char *destend = dest + maxlen; - char c; - - while (dest < destend) { - c = *(src++); - if (c == 0) break; - - SSVAL(dest, 0, (uint16)c); - dest += 2; - } - SSVAL(dest, 0, 0); -} - -/******************************************************************* - * HORRIBLE HACK! -********************************************************************/ -void unistr_to_ascii(char *dest, const uint16 *src, int len) -{ - char *destend = dest + len; - register uint16 c; - - while (dest < destend) - { - c = *(src++); - if (c == 0) - { - break; - } - - *(dest++) = (char)c; - } - - *dest = 0; -} - /******************************************************************* Pull a DOS codepage string out of a UNICODE array. len is in bytes. ********************************************************************/ -- cgit