diff options
Diffstat (limited to 'source4/lib/charset')
-rw-r--r-- | source4/lib/charset/charset.h | 5 | ||||
-rw-r--r-- | source4/lib/charset/iconv.c | 2 | ||||
-rw-r--r-- | source4/lib/charset/util_unistr.c | 17 |
3 files changed, 21 insertions, 3 deletions
diff --git a/source4/lib/charset/charset.h b/source4/lib/charset/charset.h index c49745cd7f..041eaeace7 100644 --- a/source4/lib/charset/charset.h +++ b/source4/lib/charset/charset.h @@ -97,6 +97,7 @@ size_t count_chars_w(const char *s, char c); void strupper_m(char *s); void strlower_m(char *s); char *strupper_talloc(TALLOC_CTX *ctx, const char *src); +char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *src); char *strupper_talloc_n(TALLOC_CTX *ctx, const char *src, size_t n); char *strlower_talloc(TALLOC_CTX *ctx, const char *src); bool strhasupper(const char *string); @@ -146,4 +147,8 @@ struct smb_iconv_convenience *smb_iconv_convenience_init(TALLOC_CTX *mem_ctx, const char *dos_charset, const char *unix_charset, bool native_iconv); + +void load_case_tables(void); +bool charset_register_backend(const void *_funcs); + #endif /* __CHARSET_H__ */ diff --git a/source4/lib/charset/iconv.c b/source4/lib/charset/iconv.c index d4f930b462..150383e7f9 100644 --- a/source4/lib/charset/iconv.c +++ b/source4/lib/charset/iconv.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "lib/util/dlinklist.h" +#include "../lib/util/dlinklist.h" #include "system/iconv.h" #include "system/filesys.h" #include "param/param.h" diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c index 09ec7b0471..e4f4bb551a 100644 --- a/source4/lib/charset/util_unistr.c +++ b/source4/lib/charset/util_unistr.c @@ -37,7 +37,7 @@ static void *lowcase_table; /******************************************************************* load the case handling tables ********************************************************************/ -static void load_case_tables(void) +void load_case_tables(void) { TALLOC_CTX *mem_ctx; @@ -386,6 +386,9 @@ _PUBLIC_ size_t strlen_m_term(const char *s) **/ _PUBLIC_ char *strchr_m(const char *s, char c) { + if (s == NULL) { + return NULL; + } /* characters below 0x3F are guaranteed to not appear in non-initial position in multi-byte charsets */ if ((c & 0xC0) == 0) { @@ -411,6 +414,10 @@ _PUBLIC_ char *strrchr_m(const char *s, char c) { char *ret = NULL; + if (s == NULL) { + return NULL; + } + /* characters below 0x3F are guaranteed to not appear in non-initial position in multi-byte charsets */ if ((c & 0xC0) == 0) { @@ -570,7 +577,13 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) return strupper_talloc_n(ctx, src, src?strlen(src):0); } - +/** + talloc_strdup() a unix string to upper case. +**/ +_PUBLIC_ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *src) +{ + return strupper_talloc(ctx, src); +} /** Convert a string to lower case. |