Subject: | Wrong format specifiers used for croak |
When installing Sort::Key on Ubuntu on Windows Subsystem for Linux (WSL), I get the following warnings:
Key.xs: In function ‘_keysort’:
Key.xs:237:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘IV {aka long int}’ [-Wformat=]
croak("unsupported sort type %d", type);
^~~~~~~~~~~~~~~~~~~~~~~~~~
Key.xs: In function ‘_multikeysort’:
Key.xs:547:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘STRLEN {aka long unsigned int}’ [-Wformat=]
croak("wrong number of results returned "
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Key.xs:547:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘IV {aka long int}’ [-Wformat=]
At Key.xs:237,
croak("unsupported sort type %d", type);
should be
croak("unsupported sort type %" IVdf, type);
At Key.xs:547,
croak("wrong number of results returned "
"from multikey generation sub "
"(%d expected, %d returned)",
nkeys, count);
should be
croak("wrong number of results returned "
"from multikey generation sub "
"(%zu expected, %" IVdf " returned)",
nkeys, count);