diff options
| author | Rich Megginson <rmeggins@redhat.com> | 2009-05-19 13:17:11 -0600 |
|---|---|---|
| committer | Rich Megginson <rmeggins@redhat.com> | 2009-05-19 14:05:25 -0600 |
| commit | f9db3ac14855eb07e49f2f5797cbb7d338bb614b (patch) | |
| tree | 4bc8d8283ba975ed2decaa664615548081866679 /ldap/servers/plugins/syntaxes/syntax.h | |
| parent | 47a59378cbf4b48eef492530ebc1c8ea6059a757 (diff) | |
Fix various compiler warnings
1) Make sure we use "const" consistently
2) Make sure we use "unsigned char" consistently
for some reason (unsigned char)*p did not compare to '\xHH' literals unless the literal was also cast to (unsigned char)
3) added some missing function prototypes
4) removed some unused variables/functions, or commented out for use when debugging
5) various other compiler warnings
With all of these, the code compiles cleanly on RHEL5 x86_64 using
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
and
CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic"
The only warning now is the spurious message about %llu or %lld having the wrong format argument.
Reviewed by: nhosoi (Thanks!)
Diffstat (limited to 'ldap/servers/plugins/syntaxes/syntax.h')
| -rw-r--r-- | ldap/servers/plugins/syntaxes/syntax.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ldap/servers/plugins/syntaxes/syntax.h b/ldap/servers/plugins/syntaxes/syntax.h index b9a01370..e673718f 100644 --- a/ldap/servers/plugins/syntaxes/syntax.h +++ b/ldap/servers/plugins/syntaxes/syntax.h @@ -75,13 +75,13 @@ #define IS_LDIGIT(c) ( (c != '0') && isdigit(c) ) #define IS_SHARP(c) ( (c == '#') ) #define IS_ESC(c) ( (c == '\\') ) -#define IS_UTF0(c) ( (c >= '\x80') && (c <= '\xBF') ) -#define IS_UTF1(c) ( !(c & 128) ) +#define IS_UTF0(c) ( ((unsigned char)(c) >= (unsigned char)'\x80') && ((unsigned char)(c) <= (unsigned char)'\xBF') ) +#define IS_UTF1(c) ( !((unsigned char)(c) & 128) ) /* These are only checking the first byte of the multibyte character. They * do not verify that the entire multibyte character is correct. */ -#define IS_UTF2(c) ( (c >= '\xC2') && (c <= '\xDF') ) -#define IS_UTF3(c) ( (c >= '\xE0') && (c <= '\xEF') ) -#define IS_UTF4(c) ( (c >= '\xF0') && (c <= '\xF4') ) +#define IS_UTF2(c) ( ((unsigned char)(c) >= (unsigned char)'\xC2') && ((unsigned char)(c) <= (unsigned char)'\xDF') ) +#define IS_UTF3(c) ( ((unsigned char)(c) >= (unsigned char)'\xE0') && ((unsigned char)(c) <= (unsigned char)'\xEF') ) +#define IS_UTF4(c) ( ((unsigned char)(c) >= (unsigned char)'\xF0') && ((unsigned char)(c) <= (unsigned char)'\xF4') ) #define IS_UTFMB(c) ( IS_UTF2(c) || IS_UTF3(c) || IS_UTF4(c) ) #define IS_UTF8(c) ( IS_UTF1(c) || IS_UTFMB(c) ) @@ -119,9 +119,9 @@ char *next_word( char *s ); char *phonetic( char *s ); /* Validation helper functions */ -int keystring_validate( char *begin, char *end ); -int numericoid_validate( char *begin, char *end ); -int utf8char_validate( char *begin, char *end, char **last ); -int utf8string_validate( char *begin, char *end, char **last ); +int keystring_validate( const char *begin, const char *end ); +int numericoid_validate( const char *begin, const char *end ); +int utf8char_validate( const char *begin, const char *end, const char **last ); +int utf8string_validate( const char *begin, const char *end, const char **last ); #endif |
