Skip to content

Compilation warnings #57

@jospezial

Description

@jospezial

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 #38 fixes these but that PR has to be rebased to be merged into master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions