pixel / hexedit

View and edit files in hexadecimal or in ASCII
http://rigaux.org/hexedit.html
GNU General Public License v2.0
98 stars 41 forks source link

Fix warnings when building #25

Closed eribertomota closed 6 years ago

eribertomota commented 6 years ago

This commit will fix two warnings '[-Wformat=]' when building.

This pull request will solve #3

eribertomota commented 6 years ago

The following warnings will be fixed:

display.c: In function ‘get_number’:
display.c:309:42: warning: format ‘%llx’ expects argument of type ‘long long unsigned int *’, but argument 3 has type ‘off_t * {aka long int *}’ [-Wformat=]
     err = sscanf(tmp + strlen("0x"), "%llx", i);
                                       ~~~^
                                       %lx
display.c:311:27: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 3 has type ‘off_t * {aka long int *}’ [-Wformat=]
     err = sscanf(tmp, "%lld", i);
                        ~~~^
                        %ld

Thanks

prigaux commented 6 years ago

Hum, "i" is type INT = off_t. So changing to "l" will fail on 32 bits where long is 32 bits but off_t is 64 bits (afaik). I'd rather add an explicit cast to (long long unsigned) so silence the warning.

eribertomota commented 6 years ago

2017-09-14 11:47 GMT-03:00 Pascal Rigaux notifications@github.com:

Hum, "i" is type INT = off_t. So changing to "l" will fail on 32 bits where long is 32 bits but off_t is 64 bits (afaik). I'd rather add an explicit cast to (long long unsigned) so silence the warning.

You are right. Thanks.

eribertomota commented 6 years ago

I am closing this pull request. Thanks.