From 211697ee6cbeb2bbe86b96e17b922dd16d45c0e9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Dec 1999 02:00:38 +0000 Subject: Converted most of the functions in lib/util_str.c to smb_ucs2_t equivalents. Jeremy. (This used to be commit 1ba42aca2163c534f6be4e4a733604e3dffe0ed8) --- source3/include/config.h.in | 1 + source3/include/includes.h | 8 +++--- source3/include/local.h | 3 +++ source3/include/proto.h | 61 ++++++++++++++++++++++++++++++++++++++------- 4 files changed, 60 insertions(+), 13 deletions(-) (limited to 'source3/include') diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 5858d303f5..2761b1e384 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -79,6 +79,7 @@ #undef loff_t #undef offset_t #undef aclent_t +#undef wchar_t #undef HAVE_CONNECT #undef HAVE_SHORT_INO_T #undef WITH_SMBWRAPPER diff --git a/source3/include/includes.h b/source3/include/includes.h index 0dd12bc989..3fcec98f32 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -703,10 +703,10 @@ typedef struct smb_wpasswd { #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1) /* smb_ucs2_t versions of the above. */ -#define wpstrcpy(d,s) safe_wstrcpy((d),(s),sizeof(wpstring)) -#define wpstrcat(d,s) safe_wstrcat((d),(s),sizeof(wpstring)) -#define wfstrcpy(d,s) safe_wstrcpy((d),(s),sizeof(wfstring)) -#define wfstrcat(d,s) safe_wstrcat((d),(s),sizeof(wfstring)) +#define wpstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wpstring)) +#define wpstrcat(d,s) safe_strcat_w((d),(s),sizeof(wpstring)) +#define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring)) +#define wfstrcat(d,s) safe_strcat_w((d),(s),sizeof(wfstring)) #ifdef __COMPAR_FN_T #define QSORT_CAST (__compar_fn_t) diff --git a/source3/include/local.h b/source3/include/local.h index 961670f3a6..9da39fe991 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -74,6 +74,9 @@ /* separators for lists */ #define LIST_SEP " \t,;:\n\r" +/* wchar separators for lists */ +#define LIST_SEP_W wchar_list_sep + #ifndef LOCKDIR /* this should have been set in the Makefile */ #define LOCKDIR "/tmp/samba" diff --git a/source3/include/proto.h b/source3/include/proto.h index 18762c32fb..c45da94f46 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -438,15 +438,58 @@ char *unicode_to_unix(char *dst, const smb_ucs2_t *src, size_t dst_len); smb_ucs2_t *unix_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); char *unicode_to_dos(char *dst, const smb_ucs2_t *src, size_t dst_len); smb_ucs2_t *dos_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); -size_t wstrlen(const smb_ucs2_t *src); -smb_ucs2_t *safe_wstrcpy(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength); -smb_ucs2_t *safe_wstrcat(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); -int wstrcmp(const smb_ucs2_t *s1, const smb_ucs2_t *s2); -int wstrncmp(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len); -smb_ucs2_t *wstrstr(const smb_ucs2_t *s1, const smb_ucs2_t *s2); -smb_ucs2_t *wstrchr(const smb_ucs2_t *s, smb_ucs2_t c); -smb_ucs2_t *wstrrchr(const smb_ucs2_t *s, smb_ucs2_t c); -smb_ucs2_t *wstrtok(smb_ucs2_t *s1, const smb_ucs2_t *s2); +size_t strlen_w(const smb_ucs2_t *src); +smb_ucs2_t *safe_strcpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength); +smb_ucs2_t *safe_strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); +int strcmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +int strncmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len); +smb_ucs2_t *strstr_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *strtok_w(smb_ucs2_t *s1, const smb_ucs2_t *s2); +smb_ucs2_t *strdup_w(const smb_ucs2_t *s); +int isupper_w( smb_ucs2_t val); +int islower_w( smb_ucs2_t val); +int isdigit_w( smb_ucs2_t val); +int isxdigit_w( smb_ucs2_t val); +int isspace_w( smb_ucs2_t val); +smb_ucs2_t toupper_w( smb_ucs2_t val ); +smb_ucs2_t tolower_w( smb_ucs2_t val ); +void set_first_token_w(smb_ucs2_t *ptr); +BOOL next_token_w(smb_ucs2_t **ptr, smb_ucs2_t *buff, smb_ucs2_t *sep, size_t bufsize); +smb_ucs2_t **toktocliplist_w(int *ctok, smb_ucs2_t *sep); +int StrCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t); +int StrnCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t, size_t n); +BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +BOOL strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n); +BOOL strcsequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2); +void strlower_w(smb_ucs2_t *s); +void strupper_w(smb_ucs2_t *s); +void strnorm_w(smb_ucs2_t *s); +BOOL strisnormal_w(smb_ucs2_t *s); +void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc); +smb_ucs2_t *skip_string_w(smb_ucs2_t *buf,size_t n); +size_t str_charnum_w(const smb_ucs2_t *s); +BOOL trim_string_w(smb_ucs2_t *s,const smb_ucs2_t *front,const smb_ucs2_t *back); +BOOL strhasupper_w(const smb_ucs2_t *s); +BOOL strhaslower_w(const smb_ucs2_t *s); +size_t count_chars_w(const smb_ucs2_t *s,smb_ucs2_t c); +BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c); +smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); +smb_ucs2_t *StrnCpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src,size_t n); +smb_ucs2_t *strncpyn_w(smb_ucs2_t *dest, const smb_ucs2_t *src,size_t n, smb_ucs2_t c); +size_t strhex_to_str_w(char *p, size_t len, const smb_ucs2_t *strhex); +BOOL in_list_w(smb_ucs2_t *s,smb_ucs2_t *list,BOOL casesensitive); +BOOL string_init_w(smb_ucs2_t **dest,const smb_ucs2_t *src); +void string_free_w(smb_ucs2_t **s); +BOOL string_set_w(smb_ucs2_t **dest,const smb_ucs2_t *src); +void string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len); +void fstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert); +void pstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,smb_ucs2_t *insert); +void all_string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len); +void split_at_last_component_w(smb_ucs2_t *path, smb_ucs2_t *front, smb_ucs2_t sep, smb_ucs2_t *back); +smb_ucs2_t *octal_string_w(int i); +smb_ucs2_t *string_truncate_w(smb_ucs2_t *s, size_t length); /*The following definitions come from libsmb/clientgen.c */ -- cgit