Hello,

there is %zu that should be used for size_t printing, but as far as I
know, %zu is not widely supported (or used to), the common approach
would be to cast the value to (unsigned long).

Cheers,
Daniel


On 10.04.18 07:41, Henning Westerholt wrote:
> Hi,
>
> I noticed a bunch of db_redis Wformat compile warnings in the jenkins 
> autobuild output:
>
> CC (gcc) [M db_redis.so]                redis_dbase.o
> redis_dbase.c: In function 'db_redis_dump_reply':
> redis_dbase.c:39:9: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>          LM_DBG("printing %lu elements in array reply\n", reply->elements);
>          ^
> redis_dbase.c:39:9: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
> redis_dbase.c: In function 'db_redis_scan_query_keys':
> redis_dbase.c:685:13: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 12 has type 'size_t' [-Wformat=]
>              LM_ERR("Invalid number of reply elements for scan on table 
> '%.*s', expected 2, got %lu\n",
>              ^
> redis_dbase.c:685:13: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
> redis_dbase.c:717:17: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>                  LM_ERR("Invalid null key at cursor result index %lu while 
> scanning table '%.*s'\n",
>                  ^
> redis_dbase.c:717:17: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
> redis_dbase.c:722:17: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>                  LM_ERR("Invalid key type at cursor result index %lu while 
> scanning table '%.*s', expected string\n",
>                  ^
> redis_dbase.c:722:17: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
> redis_dbase.c: In function 'db_redis_convert_row':
> redis_dbase.c:986:17: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>                  LM_DBG("column %lu does not match, ignore row\n", col);
>                  ^
> redis_dbase.c:986:17: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
> redis_dbase.c:1001:9: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 13 has type 'size_t' [-Wformat=]
>          LM_ERR("Invalid number of columns at row %d/%d, expecting %d, got %lu
> \n",
>          ^
> redis_dbase.c:1001:9: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 11 has type 'size_t' [-Wformat=]
> redis_dbase.c:1012:9: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>          LM_DBG("converting column #%lu of row #%d", colidx, RES_ROW_N(_r));
>          ^
> redis_dbase.c:1012:9: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
> redis_dbase.c: In function 'db_redis_perform_delete':
> redis_dbase.c:1317:21: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>                      LM_DBG("column %lu does not match, ignore row\n", col);
>                      ^
> redis_dbase.c:1317:21: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
> redis_dbase.c: In function 'db_redis_perform_update':
> redis_dbase.c:1571:21: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 10 has type 'size_t' [-Wformat=]
>                      LM_DBG("column %lu does not match, ignore row\n", col);
>                      ^
> redis_dbase.c:1571:21: warning: format '%lu' expects argument of type 'long 
> unsigned int', but argument 8 has type 'size_t' [-Wformat=]
>
> Best regards,
>
> Henning
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to