1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-18 17:57:55 +03:00

use macros for table boundaries

This commit is contained in:
Andrew Tridgell -
parent 180312c4a6
commit a82a5acff2

View File

@ -1043,6 +1043,9 @@ typedef struct {
unsigned char flags;
} smb_unicode_table_t;
#define TABLE1_BOUNDARY 9450
#define TABLE2_BOUNDARY 64256
static smb_unicode_table_t map_table1[] = {
#include "unicode_map_table1.h"
};
@ -1053,22 +1056,22 @@ static smb_unicode_table_t map_table2[] = {
static unsigned char map_table_flags(smb_ucs2_t v)
{
if (v < 9450) return map_table1[v].flags;
if (v >= 64256) return map_table2[v - 64256].flags;
if (v < TABLE1_BOUNDARY) return map_table1[v].flags;
if (v >= TABLE2_BOUNDARY) return map_table2[v - TABLE2_BOUNDARY].flags;
return 0;
}
static smb_ucs2_t map_table_lower(smb_ucs2_t v)
{
if (v < 9450) return map_table1[v].lower;
if (v >= 64256) return map_table2[v - 64256].lower;
if (v < TABLE1_BOUNDARY) return map_table1[v].lower;
if (v >= TABLE2_BOUNDARY) return map_table2[v - TABLE2_BOUNDARY].lower;
return v;
}
static smb_ucs2_t map_table_upper(smb_ucs2_t v)
{
if (v < 9450) return map_table1[v].upper;
if (v >= 64256) return map_table2[v - 64256].upper;
if (v < TABLE1_BOUNDARY) return map_table1[v].upper;
if (v >= TABLE2_BOUNDARY) return map_table2[v - TABLE2_BOUNDARY].upper;
return v;
}