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

Compilation warnings #57

Open jospezial opened 2 years ago

jospezial commented 2 years ago

With 1.5 and current master I see in Gentoo:

In file included from display.c:17:
display.c: In function ‘display’:
display.c:179:13: warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
  179 |     PRINTW(("%08lX", (int) (base + i)));
      |             ^~~~~~~  ~~~~~~~~~~~~~~~~
      |                      |
      |                      int
hexedit.h:54:97: note: in definition of macro ‘ATTRPRINTW’
   54 | #define ATTRPRINTW(attr, a) do { if (oldattr != (attr)) attrset(attr), oldattr = (attr); printw a; } while (0)
      |                                                                                                 ^
display.c:179:5: note: in expansion of macro ‘PRINTW’
  179 |     PRINTW(("%08lX", (int) (base + i)));
      |     ^~~~~~
display.c:179:18: note: format string is defined here
  179 |     PRINTW(("%08lX", (int) (base + i)));
      |              ~~~~^
      |                  |
      |                  long unsigned int
      |              %08X
display.c:192:14: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
  192 |   printw("--%i%%", fsize == 0 ? 0 : 100 * (base + cursor + fsize/200) / fsize );
      |             ~^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |              |                    |
      |              int                  long long int
      |             %lli
In file included from display.c:17:
display.c: In function ‘displayLine’:
display.c:204:11: warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
  204 |   PRINTW(("%08lX   ", (int) (base + offset)));
      |           ^~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       int
hexedit.h:54:97: note: in definition of macro ‘ATTRPRINTW’
   54 | #define ATTRPRINTW(attr, a) do { if (oldattr != (attr)) attrset(attr), oldattr = (attr); printw a; } while (0)
      |                                                                                                 ^
display.c:204:3: note: in expansion of macro ‘PRINTW’
  204 |   PRINTW(("%08lX   ", (int) (base + offset)));
      |   ^~~~~~
display.c:204:16: note: format string is defined here
  204 |   PRINTW(("%08lX   ", (int) (base + offset)));
      |            ~~~~^
      |                |
      |                long unsigned int
      |            %08X

I wanted to try if https://github.com/pixel/hexedit/pull/38 fixes these but that PR has to be rebased to be merged into master.