diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-04-14 12:42:52 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-04-14 12:42:52 +1000 |
commit | 72dcf6d47c53c7f4f9b62567207b7bf38be1f022 (patch) | |
tree | c0a1b05371ea1545ff8b70160ede6d03800e71fe /source3 | |
parent | aad2c19da7609e1a4c08ef11aab03c29a30090d8 (diff) | |
download | samba-72dcf6d47c53c7f4f9b62567207b7bf38be1f022.tar.gz samba-72dcf6d47c53c7f4f9b62567207b7bf38be1f022.tar.xz samba-72dcf6d47c53c7f4f9b62567207b7bf38be1f022.zip |
s3-lib Move unix_strlower and unix_strupper to their only users.
Diffstat (limited to 'source3')
-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. **/ |