Skip to content

Commit f15145b

Browse files
authored
Merge pull request #1155 from jan-cerny/more_warnings
Fix some warnings in maint-1.2
2 parents 95a0625 + 6a67ac6 commit f15145b

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

src/OVAL/probes/independent/sql.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,8 @@ static void __clearmem(void *ptr, int len)
124124
register int l = len % sizeof(uint32_t);
125125
register uint8_t *p = (uint8_t *)ptr;
126126

127-
switch (l) {
128-
case 3:
129-
p[2] = (uint8_t)(random() % (1 << 8));
130-
case 2:
131-
p[1] = (uint8_t)(random() % (1 << 8));
132-
case 1:
133-
p[0] = (uint8_t)(random() % (1 << 8));
127+
for (int i = 0; i < l; i++) {
128+
p[i] = (uint8_t)(random() % (1 << 8));
134129
}
135130
} while (0);
136131
}
@@ -191,8 +186,9 @@ static int dbURIInfo_parse(dbURIInfo_t *info, const char *conn)
191186
if (*(tok) != '=') goto __fail; \
192187
else (dst) = strdup((tok) + 1); \
193188
} \
194-
else dE("Unrecognized token: '%s'", (tok)-1); \
195-
while(0)
189+
else { \
190+
dE("Unrecognized token: '%s'", (tok)-1); \
191+
}
196192

197193
#define matchitem2(tok, first, rest1, dst1, rest2, dst2) \
198194
case first: \
@@ -208,8 +204,9 @@ static int dbURIInfo_parse(dbURIInfo_t *info, const char *conn)
208204
if (*(tok) != '=') goto __fail; \
209205
else (dst2) = strdup((tok) + 1); \
210206
} \
211-
else dE("Unrecognized token: '%s'", (tok)); \
212-
while(0)
207+
else { \
208+
dE("Unrecognized token: '%s'", (tok)); \
209+
}
213210

214211
tmp = NULL;
215212

src/OVAL/probes/independent/sql57.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,8 @@ static void __clearmem(void *ptr, int len)
124124
register int l = len % sizeof(uint32_t);
125125
register uint8_t *p = (uint8_t *)ptr;
126126

127-
switch (l) {
128-
case 3:
129-
p[2] = (uint8_t)(random() % (1 << 8));
130-
case 2:
131-
p[1] = (uint8_t)(random() % (1 << 8));
132-
case 1:
133-
p[0] = (uint8_t)(random() % (1 << 8));
127+
for (int i = 0; i < l; i++) {
128+
p[i] = (uint8_t)(random() % (1 << 8));
134129
}
135130
} while (0);
136131
}
@@ -191,8 +186,9 @@ static int dbURIInfo_parse(dbURIInfo_t *info, const char *conn)
191186
if (*(tok) != '=') goto __fail; \
192187
else (dst) = strdup((tok) + 1); \
193188
} \
194-
else dE("Unrecognized token: '%s'", (tok)-1); \
195-
while(0)
189+
else { \
190+
dE("Unrecognized token: '%s'", (tok)-1); \
191+
}
196192

197193
#define matchitem2(tok, first, rest1, dst1, rest2, dst2) \
198194
case first: \
@@ -208,8 +204,9 @@ static int dbURIInfo_parse(dbURIInfo_t *info, const char *conn)
208204
if (*(tok) != '=') goto __fail; \
209205
else (dst2) = strdup((tok) + 1); \
210206
} \
211-
else dE("Unrecognized token: '%s'", (tok)); \
212-
while(0)
207+
else { \
208+
dE("Unrecognized token: '%s'", (tok)); \
209+
}
213210

214211
tmp = NULL;
215212

0 commit comments

Comments
 (0)