mirror of
https://github.com/samba-team/samba.git
synced 2025-02-01 05:47:28 +03:00
Samba now includes a full ucs2 upper to lower case (and vica versa) map table.
Jeremy. (This used to be commit d7b72d4cbfb6bd1925abc7f95c1180d3d65856a5)
This commit is contained in:
parent
63ca6eaff0
commit
7c51c5ddf3
@ -672,6 +672,13 @@ typedef struct smb_wpasswd {
|
||||
wpstring pw_shell;
|
||||
} SMB_STRUCT_WPASSWD;
|
||||
|
||||
/* Defines for wisXXX functions. */
|
||||
#define UNI_UPPER 0x1
|
||||
#define UNI_LOWER 0x2
|
||||
#define UNI_DIGIT 0x4
|
||||
#define UNI_XDIGIT 0x8
|
||||
#define UNI_SPACE 0x10
|
||||
|
||||
/***** automatically generated prototypes *****/
|
||||
#include "proto.h"
|
||||
|
||||
@ -695,6 +702,12 @@ typedef struct smb_wpasswd {
|
||||
#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
|
||||
#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))
|
||||
|
||||
#ifdef __COMPAR_FN_T
|
||||
#define QSORT_CAST (__compar_fn_t)
|
||||
#endif
|
||||
|
@ -905,3 +905,59 @@ smb_ucs2_t *wstrdup(const smb_ucs2_t *s)
|
||||
safe_wstrcpy(newstr, s, newlen);
|
||||
return newstr;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Mapping tables for UNICODE character. Allows toupper/tolower and
|
||||
isXXX functions to work.
|
||||
********************************************************************/
|
||||
|
||||
typedef struct {
|
||||
smb_ucs2_t lower;
|
||||
smb_ucs2_t upper;
|
||||
unsigned char flags;
|
||||
} smb_unicode_table_t;
|
||||
|
||||
static smb_unicode_table_t map_table[] = {
|
||||
#include "unicode_map_table.h"
|
||||
};
|
||||
|
||||
/*******************************************************************
|
||||
Is an upper case wchar.
|
||||
********************************************************************/
|
||||
|
||||
int wisupper( smb_ucs2_t val)
|
||||
{
|
||||
return (map_table[val].flags & UNI_UPPER);
|
||||
}
|
||||
/*******************************************************************
|
||||
Is a lower case wchar.
|
||||
********************************************************************/
|
||||
|
||||
int wislower( smb_ucs2_t val)
|
||||
{
|
||||
return (map_table[val].flags & UNI_LOWER);
|
||||
}
|
||||
/*******************************************************************
|
||||
Is a digit wchar.
|
||||
********************************************************************/
|
||||
|
||||
int wisdigit( smb_ucs2_t val)
|
||||
{
|
||||
return (map_table[val].flags & UNI_DIGIT);
|
||||
}
|
||||
/*******************************************************************
|
||||
Is a hex digit wchar.
|
||||
********************************************************************/
|
||||
|
||||
int wisxdigit( smb_ucs2_t val)
|
||||
{
|
||||
return (map_table[val].flags & UNI_XDIGIT);
|
||||
}
|
||||
/*******************************************************************
|
||||
Is a space wchar.
|
||||
********************************************************************/
|
||||
|
||||
int wisspace( smb_ucs2_t val)
|
||||
{
|
||||
return (map_table[val].flags & UNI_SPACE);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ BEGIN {
|
||||
|
||||
END {
|
||||
while ( val < 65536 ) {
|
||||
printf("{ 0, 0x%04X, 0x%04X }, \t\t\t/* %s NOMAP */\n", val, val, strval);
|
||||
printf("{ 0x%04X, 0x%04X, 0 }, \t\t\t/* %s NOMAP */\n", val, val, strval);
|
||||
val++;
|
||||
strval=sprintf("%04X", val);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user