summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/syntaxes/validate.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-05-19 13:17:11 -0600
committerRich Megginson <rmeggins@redhat.com>2009-05-19 14:05:25 -0600
commitf9db3ac14855eb07e49f2f5797cbb7d338bb614b (patch)
tree4bc8d8283ba975ed2decaa664615548081866679 /ldap/servers/plugins/syntaxes/validate.c
parent47a59378cbf4b48eef492530ebc1c8ea6059a757 (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/validate.c')
-rw-r--r--ldap/servers/plugins/syntaxes/validate.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/ldap/servers/plugins/syntaxes/validate.c b/ldap/servers/plugins/syntaxes/validate.c
index 8367e083..a34830cd 100644
--- a/ldap/servers/plugins/syntaxes/validate.c
+++ b/ldap/servers/plugins/syntaxes/validate.c
@@ -52,8 +52,8 @@
* Returns non-zero if the value is not a valide 'keystring'.
*/
int keystring_validate(
- char *begin,
- char *end
+ const char *begin,
+ const char *end
)
{
int rc = 0; /* assume the value is valid */
@@ -90,13 +90,13 @@ exit:
* Returns non-zero if the value is not a valide 'numericoid'.
*/
int numericoid_validate(
- char *begin,
- char *end
+ const char *begin,
+ const char *end
)
{
int rc = 0; /* assume the value is valid */
int found_separator = 0;
- char *p = NULL;
+ const char *p = NULL;
if ((begin == NULL) || (end == NULL)) {
rc = 1;
@@ -181,13 +181,13 @@ exit:
*
* Returns 0 if it is valid and non-zero otherwise. */
int utf8char_validate(
- char *begin,
- char *end,
- char **last
+ const char *begin,
+ const char *end,
+ const char **last
)
{
int rc = 0; /* Assume char is valid */
- char *p = begin;
+ const char *p = begin;
if ((begin == NULL) || (end == NULL)) {
rc = 1;
@@ -233,14 +233,14 @@ int utf8char_validate(
if (*p == '\xE0') {
/* The next byte must be %xA0-BF. */
p++;
- if ((*p < '\xA0') || (*p > '\xBF')) {
+ if (((unsigned char)*p < (unsigned char)'\xA0') || ((unsigned char)*p > (unsigned char)'\xBF')) {
rc = 1;
goto exit;
}
} else if (*p == '\xED') {
/* The next byte must be %x80-9F. */
p++;
- if ((*p < '\x80') || (*p > '\x9F')) {
+ if (((unsigned char)*p < (unsigned char)'\x80') || ((unsigned char)*p > (unsigned char)'\x9F')) {
rc = 1;
goto exit;
}
@@ -270,13 +270,13 @@ int utf8char_validate(
* the second byte. */
if (*p == '\xF0') {
/* The next byte must be %x90-BF. */
- if ((*p < '\x90') || (*p > '\xBF')) {
+ if (((unsigned char)*p < (unsigned char)'\x90') || ((unsigned char)*p > (unsigned char)'\xBF')) {
rc = 1;
goto exit;
}
} else if (*p == '\xF4') {
/* The next byte must be %x80-BF. */
- if ((*p < '\x80') || (*p > '\xBF')) {
+ if (((unsigned char)*p < (unsigned char)'\x80') || ((unsigned char)*p > (unsigned char)'\xBF')) {
rc = 1;
goto exit;
}
@@ -307,7 +307,7 @@ int utf8char_validate(
exit:
if (last) {
- *last = p;
+ *last = (const char *)p;
}
return(rc);
}
@@ -321,13 +321,13 @@ exit:
*
* Returns 0 if it is valid and non-zero otherwise. */
int utf8string_validate(
- char *begin,
- char *end,
- char **last
+ const char *begin,
+ const char *end,
+ const char **last
)
{
int rc = 0; /* Assume string is valid */
- char *p = NULL;
+ const char *p = NULL;
if ((begin == NULL) || (end == NULL)) {
rc = 1;