gcc 9.1 on x86/64 has reported following issues:
list.c:140:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
file.c:572:51: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
file.c:850:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
file.c:865:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
delta.c:199:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
parse.c:80:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
parse.c:81:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
file.c:572:51: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
file.c:850:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
file.c:865:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
delta.c:199:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
parse.c:80:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
parse.c:81:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
ucimap.c:146:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:151:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:243:34: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:247:9: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:254:39: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:258:9: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:285:34: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:363:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:563:12: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:753:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ucimap.c:879:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
case UCI_CMD_LIST_ADD:
if (!ptr->option)
goto error;
case UCI_CMD_LIST_ADD:
if (!ptr->option)
goto error;
case UCI_CMD_LIST_DEL:
if (!ptr->option)
goto error;
case UCI_CMD_LIST_DEL:
if (!ptr->option)
goto error;
len = end - str;
/* make sure that we have enough room in the buffer */
len = end - str;
/* make sure that we have enough room in the buffer */
- while (ofs + len + sizeof(UCI_QUOTE_ESCAPE) + 1 > ctx->bufsz) {
+ while (ofs + len + (int) sizeof(UCI_QUOTE_ESCAPE) + 1 > ctx->bufsz) {
ctx->bufsz *= 2;
ctx->buf = uci_realloc(ctx, ctx->buf, ctx->bufsz);
}
ctx->bufsz *= 2;
ctx->buf = uci_realloc(ctx, ctx->buf, ctx->bufsz);
}
{
char **configs;
glob_t globbuf;
{
char **configs;
glob_t globbuf;
- int size, i, j, skipped;
+ int size, j, skipped;
+ size_t i;
int i;
/* initial value */
int i;
/* initial value */
hash = 5381;
for(i = 0; i < len; i++) {
hash = 5381;
for(i = 0; i < len; i++) {
/* fix up an unnamed section, e.g. after adding options to it */
static void uci_fixup_section(struct uci_context *ctx, struct uci_section *s)
{
/* fix up an unnamed section, e.g. after adding options to it */
static void uci_fixup_section(struct uci_context *ctx, struct uci_section *s)
{
- unsigned int hash = ~0;
+ unsigned int hash = ~0U;
struct uci_element *e;
char buf[16];
struct uci_element *e;
char buf[16];
int err = UCI_ERR_MEM;
char *s = NULL;
const char *v;
int err = UCI_ERR_MEM;
char *s = NULL;
const char *v;
- int i, nargs, offset = 0;
+ unsigned int i;
+ int nargs, offset = 0;
ctx = find_context(L, &offset);
nargs = lua_gettop(L);
ctx = find_context(L, &offset);
nargs = lua_gettop(L);
switch(len)
{
case 3: h ^= data[2] << 16;
switch(len)
{
case 3: h ^= data[2] << 16;
case 2: h ^= data[1] << 8;
case 2: h ^= data[1] << 8;
case 1: h ^= data[0];
h *= m;
};
case 1: h ^= data[0];
h *= m;
};
ucimap_free_section(struct uci_map *map, struct ucimap_section_data *sd)
{
void *section;
ucimap_free_section(struct uci_map *map, struct ucimap_section_data *sd)
{
void *section;
section = ucimap_section_ptr(sd);
if (sd->ref)
section = ucimap_section_ptr(sd);
if (sd->ref)
struct ucimap_alloc_custom *ac;
struct ucimap_alloc *a;
void *ptr = *((void **) item);
struct ucimap_alloc_custom *ac;
struct ucimap_alloc *a;
void *ptr = *((void **) item);
{
struct ucimap_list *new;
struct ucimap_alloc *a;
{
struct ucimap_list *new;
struct ucimap_alloc *a;
+ unsigned int i;
+ int offset = 0;
int size = sizeof(struct ucimap_list) + items * sizeof(union ucimap_data);
if (!*list) {
int size = sizeof(struct ucimap_list) + items * sizeof(union ucimap_data);
if (!*list) {
switch(om->type & UCIMAP_SUBTYPE) {
case UCIMAP_STRING:
if ((om->data.s.maxlen > 0) &&
switch(om->type & UCIMAP_SUBTYPE) {
case UCIMAP_STRING:
if ((om->data.s.maxlen > 0) &&
- (strlen(str) > om->data.s.maxlen))
+ (strlen(str) > (unsigned) om->data.s.maxlen))
static bool
ucimap_check_optmap_type(struct uci_sectionmap *sm, struct uci_optmap *om)
{
static bool
ucimap_check_optmap_type(struct uci_sectionmap *sm, struct uci_optmap *om)
{
if (unlikely(sm->type_name != om->type_name) &&
unlikely(strcmp(sm->type_name, om->type_name) != 0)) {
if (unlikely(sm->type_name != om->type_name) &&
unlikely(strcmp(sm->type_name, om->type_name) != 0)) {
void *section = ucimap_section_ptr(sd);
struct uci_sectionmap *sm = sd->sm;
struct uci_optmap *om;
void *section = ucimap_section_ptr(sd);
struct uci_sectionmap *sm = sd->sm;
struct uci_optmap *om;
- int ofs = (char *)field - (char *)section;
+ unsigned int ofs = (char *)field - (char *)section;
int i = 0;
ucimap_foreach_option(sm, om) {
int i = 0;
ucimap_foreach_option(sm, om) {
struct uci_element *e;
struct ucimap_section_data *sd, **sd_tail;
struct ucimap_fixup *f;
struct uci_element *e;
struct ucimap_section_data *sd, **sd_tail;
struct ucimap_fixup *f;
sd_tail = map->sdata_tail;
map->parsed = false;
sd_tail = map->sdata_tail;
map->parsed = false;