Silence compiler warnings found by clang

pull/209/head
Victor Julien 14 years ago
parent b63c2eda6a
commit 84bad6db77

@ -370,15 +370,15 @@ DetectBytejumpData *DetectBytejumpParse(char *optstr, char **offset)
* and *yes* this *is* ugly.
*/
end_ptr = str_ptr;
while (!(isspace(*end_ptr) || (*end_ptr == ','))) end_ptr++;
while (!(isspace((unsigned char)*end_ptr) || (*end_ptr == ','))) end_ptr++;
*(end_ptr++) = '\0';
args[0] = str_ptr;
numargs++;
str_ptr = end_ptr;
while (isspace(*str_ptr) || (*str_ptr == ',')) str_ptr++;
while (isspace((unsigned char)*str_ptr) || (*str_ptr == ',')) str_ptr++;
end_ptr = str_ptr;
while (!(isspace(*end_ptr) || (*end_ptr == ',')) && (*end_ptr != '\0'))
while (!(isspace((unsigned char)*end_ptr) || (*end_ptr == ',')) && (*end_ptr != '\0'))
end_ptr++;
*(end_ptr++) = '\0';
args[1] = str_ptr;
@ -416,7 +416,7 @@ DetectBytejumpData *DetectBytejumpParse(char *optstr, char **offset)
}
/* Offset */
if (args[1][0] != '-' && isalpha(args[1][0])) {
if (args[1][0] != '-' && isalpha((unsigned char)args[1][0])) {
if (offset == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_jump supplied with "
"var name for offset. \"value\" argument supplied to "

@ -339,7 +339,7 @@ DetectBytetestData *DetectBytetestParse(char *optstr, char **value, char **offse
}
/* Value */
if (args[3][0] != '-' && isalpha(args[3][0])) {
if (args[3][0] != '-' && isalpha((unsigned char)args[3][0])) {
if (value == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_test supplied with "
"var name for value. \"value\" argument supplied to "
@ -357,7 +357,7 @@ DetectBytetestData *DetectBytetestParse(char *optstr, char **value, char **offse
}
/* Offset */
if (args[4][0] != '-' && isalpha(args[4][0])) {
if (args[4][0] != '-' && isalpha((unsigned char)args[4][0])) {
if (offset == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_test supplied with "
"var name for offset. \"offset\" argument supplied to "

@ -77,7 +77,7 @@ int DetectContentDataParse(char *keyword, char *contentstr, char** pstr, uint16_
}
/* skip the first spaces */
while (pos < slen && isspace(contentstr[pos]))
while (pos < slen && isspace((unsigned char)contentstr[pos]))
pos++;
if (contentstr[pos] == '!') {
@ -135,7 +135,7 @@ int DetectContentDataParse(char *keyword, char *contentstr, char** pstr, uint16_
escape = 1;
} else {
if (bin) {
if (isdigit(str[i]) ||
if (isdigit((unsigned char)str[i]) ||
str[i] == 'A' || str[i] == 'a' ||
str[i] == 'B' || str[i] == 'b' ||
str[i] == 'C' || str[i] == 'c' ||

@ -148,7 +148,7 @@ static int DetectDepthSetup (DetectEngineCtx *de_ctx, Signature *s, char *depths
goto error;
}
if (str[0] != '-' && isalpha(str[0])) {
if (str[0] != '-' && isalpha((unsigned char)str[0])) {
SigMatch *bed_sm =
DetectByteExtractRetrieveSMVar(str, s,
SigMatchListSMBelongsTo(s, pm));

@ -222,7 +222,7 @@ static int DetectDistanceSetup (DetectEngineCtx *de_ctx, Signature *s,
goto error;
}
if (str[0] != '-' && isalpha(str[0])) {
if (str[0] != '-' && isalpha((unsigned char)str[0])) {
SigMatch *bed_sm =
DetectByteExtractRetrieveSMVar(str, s,
SigMatchListSMBelongsTo(s, pm));

@ -644,7 +644,7 @@ int DetectAddressParseString(DetectAddress *dd, char *str)
/* 1.2.3.4/24 format */
for (u = 0; u < strlen(mask); u++) {
if(!isdigit(mask[u]))
if(!isdigit((unsigned char)mask[u]))
goto error;
}

@ -160,7 +160,7 @@ static int IPOnlyCIDRItemParseSingle(IPOnlyCIDRItem *dd, char *str)
/* 1.2.3.4/24 format */
for (u = 0; u < strlen(mask); u++) {
if(!isdigit(mask[u]))
if(!isdigit((unsigned char)mask[u]))
goto error;
}

@ -549,6 +549,7 @@ static void *DetectEngineLiveRuleSwap(void *arg)
SCLogInfo("===== Live rule swap DONE =====");
pthread_exit(NULL);
return NULL;
}
void DetectEngineSpawnLiveRuleSwapMgmtThread(void)

@ -172,7 +172,7 @@ static int DetectFlowvarSetup (DetectEngineCtx *de_ctx, Signature *s, char *raws
}
} else {
if (bin) {
if (isdigit(str[i]) ||
if (isdigit((unsigned char)str[i]) ||
str[i] == 'A' || str[i] == 'a' ||
str[i] == 'B' || str[i] == 'b' ||
str[i] == 'C' || str[i] == 'c' ||

@ -113,10 +113,10 @@ int DetectFtpbounceMatchArgs(uint8_t *payload, uint16_t payload_len,
i = offset;
/* Search for the first IP octect(Skips "PORT ") */
while (i < payload_len && !isdigit(c[i])) i++;
while (i < payload_len && !isdigit((unsigned char)c[i])) i++;
for (;i < payload_len && octet_ascii_len < 4 ;i++) {
if (isdigit(c[i])) {
if (isdigit((unsigned char)c[i])) {
octet =(c[i] - '0') + octet * 10;
octet_ascii_len++;
} else {
@ -125,8 +125,8 @@ int DetectFtpbounceMatchArgs(uint8_t *payload, uint16_t payload_len,
return 0;
}
if (isspace(c[i]))
while (i < payload_len && isspace(c[i]) ) i++;
if (isspace((unsigned char)c[i]))
while (i < payload_len && isspace((unsigned char)c[i]) ) i++;
if (i < payload_len && c[i] == ',') { /* we have an octet */
noctet++;

@ -140,7 +140,7 @@ static DetectIPProtoData *DetectIPProtoParse(const char *optstr)
}
/* Protocol name/number */
if (!isdigit(*(args[1]))) {
if (!isdigit((unsigned char)*(args[1]))) {
struct protoent *pent = getprotobyname(args[1]);
if (pent == NULL) {
SCLogError(SC_ERR_INVALID_VALUE, "Malformed protocol name: %s",

@ -182,7 +182,7 @@ DetectIsdataatData *DetectIsdataatParse (char *isdataatstr, char **offset)
idad->flags = 0;
idad->dataat = 0;
if (args[0][0] != '-' && isalpha(args[0][0])) {
if (args[0][0] != '-' && isalpha((unsigned char)args[0][0])) {
if (offset == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "isdataat supplied with "
"var name for offset. \"offset\" argument supplied to "

@ -147,7 +147,7 @@ int DetectOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, char *offsetstr)
goto error;
}
if (str[0] != '-' && isalpha(str[0])) {
if (str[0] != '-' && isalpha((unsigned char)str[0])) {
SigMatch *bed_sm =
DetectByteExtractRetrieveSMVar(str, s,
SigMatchListSMBelongsTo(s, pm));

@ -1661,7 +1661,7 @@ int DetectParseContentString (char *contentstr, uint8_t **result, uint16_t *resu
/* skip the first spaces */
slen = strlen(temp);
while (pos < slen && isspace(temp[pos])) {
while (pos < slen && isspace((unsigned char)temp[pos])) {
pos++;
}
@ -1728,7 +1728,7 @@ int DetectParseContentString (char *contentstr, uint8_t **result, uint16_t *resu
escape = 1;
} else {
if (bin) {
if (isdigit(str[i]) ||
if (isdigit((unsigned char)str[i]) ||
str[i] == 'A' || str[i] == 'a' ||
str[i] == 'B' || str[i] == 'b' ||
str[i] == 'C' || str[i] == 'c' ||

@ -269,7 +269,7 @@ DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, char *regexstr)
uint16_t pos = 0;
uint8_t negate = 0;
while (pos < slen && isspace(regexstr[pos])) {
while (pos < slen && isspace((unsigned char)regexstr[pos])) {
pos++;
}

@ -168,7 +168,7 @@ static int DetectPktvarSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawst
}
} else {
if (bin) {
if (isdigit(str[i]) ||
if (isdigit((unsigned char)str[i]) ||
str[i] == 'A' || str[i] == 'a' ||
str[i] == 'B' || str[i] == 'b' ||
str[i] == 'C' || str[i] == 'c' ||

@ -153,7 +153,7 @@ DetectTosData *DetectTosParse(char *arg)
negated = 1;
}
while (isspace(*str_ptr))
while (isspace((unsigned char)*str_ptr))
str_ptr++;
if (*str_ptr == 'x' || *str_ptr == 'X') {

@ -220,7 +220,7 @@ static int DetectWithinSetup (DetectEngineCtx *de_ctx, Signature *s, char *withi
goto error;
}
if (str[0] != '-' && isalpha(str[0])) {
if (str[0] != '-' && isalpha((unsigned char)str[0])) {
SigMatch *bed_sm =
DetectByteExtractRetrieveSMVar(str, s,
SigMatchListSMBelongsTo(s, pm));

@ -303,7 +303,7 @@ int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file, int *sigs_tot) {
continue;
/* Check for multiline rules. */
while (len > 0 && isspace(line[--len]));
while (len > 0 && isspace((unsigned char)line[--len]));
if (line[len] == '\\') {
multiline++;
offset = len;

@ -555,6 +555,7 @@ void *FlowManagerThread(void *td)
TmThreadsSetFlag(th_v, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
/** \brief spawn the flow manager thread */

@ -1057,7 +1057,7 @@ int main(int argc, char **argv)
if (strcmp(pcap_dev, optarg) != 0) {
SCLogInfo("translated %s to pcap device %s", optarg, pcap_dev);
} else if (strlen(pcap_dev) > 0 && isdigit(pcap_dev[0])) {
} else if (strlen(pcap_dev) > 0 && isdigit((unsigned char)pcap_dev[0])) {
SCLogError(SC_ERR_PCAP_TRANSLATE, "failed to find a pcap device for IP %s", optarg);
exit(EXIT_FAILURE);
}

@ -158,6 +158,7 @@ void *TmThreadsSlot1NoIn(void *td)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
@ -220,11 +221,13 @@ void *TmThreadsSlot1NoIn(void *td)
if (r != TM_ECODE_OK) {
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
return NULL;
}
}
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
void *TmThreadsSlot1NoOut(void *td)
@ -257,6 +260,7 @@ void *TmThreadsSlot1NoOut(void *td)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
@ -301,11 +305,13 @@ void *TmThreadsSlot1NoOut(void *td)
if (r != TM_ECODE_OK) {
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
return NULL;
}
}
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
void *TmThreadsSlot1NoInOut(void *td)
@ -339,6 +345,7 @@ void *TmThreadsSlot1NoInOut(void *td)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
@ -377,11 +384,13 @@ void *TmThreadsSlot1NoInOut(void *td)
if (r != TM_ECODE_OK) {
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
return NULL;
}
}
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
void *TmThreadsSlot1(void *td)
@ -416,6 +425,7 @@ void *TmThreadsSlot1(void *td)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
@ -492,12 +502,14 @@ void *TmThreadsSlot1(void *td)
if (r != TM_ECODE_OK) {
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
return NULL;
}
}
SCLogDebug("%s ending", tv->name);
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
/**
@ -623,6 +635,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
for (slot = s; slot != NULL; slot = slot->slot_next) {
@ -634,6 +647,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
(void)SC_ATOMIC_SET(slot->slot_data, slot_data);
}
@ -670,6 +684,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
if (r != TM_ECODE_OK) {
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
return NULL;
}
}
}
@ -677,6 +692,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
SCLogDebug("%s ending", tv->name);
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
@ -712,6 +728,7 @@ void *TmThreadsSlotVar(void *td)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
for (; s != NULL; s = s->slot_next) {
@ -723,6 +740,7 @@ void *TmThreadsSlotVar(void *td)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
@ -807,6 +825,7 @@ void *TmThreadsSlotVar(void *td)
if (r != TM_ECODE_OK) {
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) -1);
return NULL;
}
}
}
@ -814,6 +833,7 @@ void *TmThreadsSlotVar(void *td)
SCLogDebug("%s ending", tv->name);
TmThreadsSetFlag(tv, THV_CLOSED);
pthread_exit((void *) 0);
return NULL;
}
/**

@ -211,7 +211,7 @@ static char *SCClassConfStringToLowercase(const char *str)
temp_str = new_str;
while (*temp_str != '\0') {
*temp_str = tolower(*temp_str);
*temp_str = tolower((unsigned char)*temp_str);
temp_str++;
}
@ -328,7 +328,7 @@ static int SCClassConfIsLineBlankOrComment(char *line)
return 1;
/* this line is neither a comment line, nor a blank line */
if (!isspace(*line))
if (!isspace((unsigned char)*line))
return 0;
line++;
@ -446,7 +446,7 @@ uint32_t SCClassConfClasstypeHashFunc(HashTable *ht, void *data, uint16_t datale
int len = strlen(ct->classtype);
for (i = 0; i < len; i++)
hash += tolower((ct->classtype)[i]);
hash += tolower((unsigned char)(ct->classtype)[i]);
hash = hash % ht->array_size;

@ -58,7 +58,6 @@ SCEnumCharMap sc_hinfo_os_policy_map[ ] = {
/** Radix tree that holds the host OS information */
static SCRadixTree *sc_hinfo_tree = NULL;
static SCRadixTree *sc_hinfo_tree_backup = NULL;
/**
* \brief Validates an IPV4 address and returns the network endian arranged
@ -431,6 +430,7 @@ void SCHInfoLoadFromConfig(void)
/*------------------------------------Unit_Tests------------------------------*/
#ifdef UNITTESTS
static SCRadixTree *sc_hinfo_tree_backup = NULL;
static void SCHInfoCreateContextBackup(void)
{

@ -42,7 +42,7 @@ int PathIsAbsolute(const char *path) {
#if (defined OS_WIN32 || defined __CYGWIN__)
if (strlen(path) > 2) {
if (isalpha(path[0]) && path[1] == ':') {
if (isalpha((unsigned char)path[0]) && path[1] == ':') {
return 1;
}
}

@ -161,7 +161,7 @@ int SCGetUserID(char *user_name, char *group_name, uint32_t *uid, uint32_t *gid)
struct passwd *pw;
/* Get the user ID */
if (isdigit(user_name[0]) != 0) {
if (isdigit((unsigned char)user_name[0]) != 0) {
userid = atoi(user_name);
pw = getpwuid(userid);
if (pw == NULL) {
@ -183,7 +183,7 @@ int SCGetUserID(char *user_name, char *group_name, uint32_t *uid, uint32_t *gid)
if (group_name != NULL) {
struct group *gp;
if (isdigit(group_name[0]) != 0) {
if (isdigit((unsigned char)group_name[0]) != 0) {
groupid = atoi(group_name);
} else {
gp = getgrnam(group_name);
@ -223,7 +223,7 @@ int SCGetGroupID(char *group_name, uint32_t *gid)
struct group *gp;
/* Get the group ID */
if (isdigit(group_name[0]) != 0) {
if (isdigit((unsigned char)group_name[0]) != 0) {
grpid = atoi(group_name);
} else {
gp = getgrnam(group_name);

@ -206,7 +206,7 @@ static char *SCRConfStringToLowercase(const char *str)
temp_str = new_str;
while (*temp_str != '\0') {
*temp_str = tolower(*temp_str);
*temp_str = tolower((unsigned char)*temp_str);
temp_str++;
}
@ -305,7 +305,7 @@ static int SCRConfIsLineBlankOrComment(char *line)
return 1;
/* this line is neither a comment line, nor a blank line */
if (!isspace(*line))
if (!isspace((unsigned char)*line))
return 0;
line++;
@ -418,7 +418,7 @@ uint32_t SCRConfReferenceHashFunc(HashTable *ht, void *data, uint16_t datalen)
int len = strlen(ref->system);
for (i = 0; i < len; i++)
hash += tolower(ref->system[i]);
hash += tolower((unsigned char)ref->system[i]);
hash = hash % ht->array_size;

@ -863,7 +863,7 @@ int SCThresholdConfIsLineBlankOrComment(char *line)
return 1;
/* this line is neither a comment line, nor a blank line */
if (!isspace(*line))
if (!isspace((unsigned char)*line))
return 0;
line++;
@ -892,7 +892,7 @@ int SCThresholdConfLineIsMultiline(char *line)
if (*line == '\\')
flag = line - rline;
else
if (!isspace(*line))
if (!isspace((unsigned char)*line))
flag = 0;
line++;

Loading…
Cancel
Save