warn about and fix some -Wpointer-sign warnings

This commit is contained in:
Wim Taymans 2020-11-02 09:03:53 +01:00
parent 92c541ea03
commit 94dbd4f9b8
3 changed files with 5 additions and 4 deletions

View file

@ -68,6 +68,7 @@ if cc.get_id() == 'gcc'
add_global_arguments('-fvisibility=hidden',
'-Wsign-compare',
'-Wpointer-arith',
'-Wpointer-sign',
'-Wformat',
'-Wformat-security',
'-Werror=suggest-attribute=format',

View file

@ -471,7 +471,7 @@ static uint32_t collect_port_info(struct pw_manager_object *card, struct card_in
spa_pod_parser_pod(&prs, pi->info);
if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 ||
spa_pod_parser_get_int(&prs, &pi->n_props) < 0)
spa_pod_parser_get_int(&prs, (int32_t*)&pi->n_props) < 0)
break;
for (n = 0; n < pi->n_props; n++) {

View file

@ -180,10 +180,10 @@ static int read_arbitrary(struct message *m, const void **val, size_t length)
static int read_string(struct message *m, char **str)
{
uint32_t n, maxlen = m->length - m->offset;
n = strnlen(m->data + m->offset, maxlen);
n = strnlen(SPA_MEMBER(m->data, m->offset, char), maxlen);
if (n == maxlen)
return -EINVAL;
*str = m->data + m->offset;
*str = SPA_MEMBER(m->data, m->offset, char);
m->offset += n + 1;
return 0;
}
@ -419,7 +419,7 @@ static void write_string(struct message *m, const char *s)
if (s != NULL) {
int len = strlen(s) + 1;
if (ensure_size(m, len) > 0)
strcpy(&m->data[m->length], s);
strcpy(SPA_MEMBER(m->data, m->length, char), s);
m->length += len;
}
}