From ee34c25c8a989b5a7c0ad59d71bb39f8efff045c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Jul 2011 13:19:29 -0700 Subject: First part of fix for bug 8310 - toupper_ascii() is broken on big-endian systems Remove int toupper_ascii(int c); int tolower_ascii(int c); int isupper_ascii(int c); int islower_ascii(int c); and replace with their _m equivalents, as they are identical. --- source3/smbd/mangle_hash.c | 6 +++--- source3/smbd/mangle_hash2.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index a51ea6b208..0238083e38 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -424,8 +424,8 @@ static bool is_mangled(const char *s, const struct share_params *p) magic = strchr_m( s, magic_char ); while( magic && magic[1] && magic[2] ) { /* 3 chars, 1st is magic. */ if( ('.' == magic[3] || '/' == magic[3] || !(magic[3])) /* Ends with '.' or nul or '/' ? */ - && isbasechar( toupper_ascii(magic[1]) ) /* is 2nd char basechar? */ - && isbasechar( toupper_ascii(magic[2]) ) ) /* is 3rd char basechar? */ + && isbasechar( toupper_m(magic[1]) ) /* is 2nd char basechar? */ + && isbasechar( toupper_m(magic[2]) ) ) /* is 3rd char basechar? */ return( True ); /* If all above, then true, */ magic = strchr_m( magic+1, magic_char ); /* else seek next magic. */ } @@ -479,7 +479,7 @@ static void cache_mangled_name( const char mangled_name[13], s1 = strrchr( mangled_name_key, '.' ); if( s1 && (s2 = strrchr( raw_name, '.' )) ) { size_t i = 1; - while( s1[i] && (tolower_ascii( s1[i] ) == s2[i]) ) + while( s1[i] && (tolower_m( s1[i] ) == s2[i]) ) i++; if( !s1[i] && !s2[i] ) { /* Truncate at the '.' */ diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index 4de80cbe31..09cd44d5af 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -173,10 +173,10 @@ static void init_tables(void) char_flags[c2] |= FLAG_POSSIBLE2; char_flags[c3] |= FLAG_POSSIBLE3; char_flags[c4] |= FLAG_POSSIBLE4; - char_flags[tolower_ascii(c1)] |= FLAG_POSSIBLE1; - char_flags[tolower_ascii(c2)] |= FLAG_POSSIBLE2; - char_flags[tolower_ascii(c3)] |= FLAG_POSSIBLE3; - char_flags[tolower_ascii(c4)] |= FLAG_POSSIBLE4; + char_flags[tolower_m(c1)] |= FLAG_POSSIBLE1; + char_flags[tolower_m(c2)] |= FLAG_POSSIBLE2; + char_flags[tolower_m(c3)] |= FLAG_POSSIBLE3; + char_flags[tolower_m(c4)] |= FLAG_POSSIBLE4; char_flags[(unsigned char)'.'] |= FLAG_POSSIBLE4; } @@ -737,7 +737,7 @@ static bool hash2_name_to_8_3(const char *name, if (! FLAG_CHECK(lead_chars[i], FLAG_ASCII)) { lead_chars[i] = '_'; } - lead_chars[i] = toupper_ascii(lead_chars[i]); + lead_chars[i] = toupper_m(lead_chars[i]); } for (;i