diff options
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/lib/charcnv.c | 41 | ||||
-rw-r--r-- | source3/lib/util_str.c | 41 |
3 files changed, 41 insertions, 43 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 0881edba9a7..eebc25f38b2 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -83,10 +83,8 @@ bool convert_string_error(charset_t from, charset_t to, void const *src, size_t srclen, void *dest, size_t destlen, size_t *converted_size); -bool unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen); char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s); char *strupper_talloc(TALLOC_CTX *ctx, const char *s); -bool unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen); char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s); char *strlower_talloc(TALLOC_CTX *ctx, const char *s); size_t ucs2_align(const void *base_ptr, const void *p, int flags); diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 5c01052d210..bde6510314a 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -56,26 +56,6 @@ void init_iconv(void) true, global_iconv_handle); } -bool unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) -{ - size_t size; - smb_ucs2_t *buffer; - bool ret; - - if (!push_ucs2_talloc(talloc_tos(), &buffer, src, &size)) { - return (size_t)-1; - } - - if (!strupper_w(buffer) && (dest == src)) { - TALLOC_FREE(buffer); - return srclen; - } - - ret = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen, &size); - TALLOC_FREE(buffer); - return ret; -} - /** talloc_strdup() a unix string to upper case. **/ @@ -141,27 +121,6 @@ char *strupper_talloc(TALLOC_CTX *ctx, const char *s) { } -bool unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) -{ - size_t size; - smb_ucs2_t *buffer = NULL; - bool ret; - - if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF16LE, src, srclen, - (void **)(void *)&buffer, &size)) - { - smb_panic("failed to create UCS2 buffer"); - } - if (!strlower_w(buffer) && (dest == src)) { - TALLOC_FREE(buffer); - return srclen; - } - ret = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen, &size); - TALLOC_FREE(buffer); - return ret; -} - - char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s) { size_t converted_size; diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index a57a53fce29..797e61e40ce 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1060,6 +1060,27 @@ char *strstr_m(const char *src, const char *findstr) return retp; } +static bool unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) +{ + size_t size; + smb_ucs2_t *buffer = NULL; + bool ret; + + if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF16LE, src, srclen, + (void **)(void *)&buffer, &size)) + { + smb_panic("failed to create UCS2 buffer"); + } + if (!strlower_w(buffer) && (dest == src)) { + TALLOC_FREE(buffer); + return srclen; + } + ret = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen, &size); + TALLOC_FREE(buffer); + return ret; +} + + /** Convert a string to lower case. **/ @@ -1094,6 +1115,26 @@ void strlower_m(char *s) errno = errno_save; } +static bool unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) +{ + size_t size; + smb_ucs2_t *buffer; + bool ret; + + if (!push_ucs2_talloc(talloc_tos(), &buffer, src, &size)) { + return (size_t)-1; + } + + if (!strupper_w(buffer) && (dest == src)) { + TALLOC_FREE(buffer); + return srclen; + } + + ret = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen, &size); + TALLOC_FREE(buffer); + return ret; +} + /** Convert a string to upper case. **/ |