Skip to contentSkip to conversation

Format string warnings on 32 bit platforms

alsa-devel Rolf Eike Beer 1 participant 1 message Jan 21, 2020

lore
Share & tools
lore
#0 lore raw

The first ones can be fixed by either casting to "unsigned long long" and using that specifier or using the proper format specifiers from inttypes.h

Greetings,

Eike

container.c: In function 'container_context_pre_process':
container.c:359:33: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]

  359 |    fprintf(stderr, "  frames: %lu\n",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %llu
  360 |     *frame_count);
      |     ~~~~~~~~~~~~                 
      |     |
      |     uint64_t {aka long long unsigned int}
container.c:362:37: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
  362 |    fprintf(stderr, "  max frames: %lu\n",
      |                                   ~~^
      |                                     |
      |                                     long unsigned int
      |                                   %llu
  363 |     *frame_count);
      |     ~~~~~~~~~~~~                     
      |     |
      |     uint64_t {aka long long unsigned int}
container.c: In function 'container_context_post_process':
container.c:430:39: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
  430 |   fprintf(stderr, "  Handled bytes: %lu\n",
      |                                     ~~^
      |                                       |
      |                                       long unsigned int
      |                                     %llu
  431 |    cntr->handled_byte_count);
      |    ~~~~~~~~~~~~~~~~~~~~~~~~            
      |        |
      |        uint64_t {aka long long unsigned int}
subcmd-transfer.c: In function 'context_process_frames':
subcmd-transfer.c:392:20: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
  392 |    "%s: Expected %lu frames, Actual %lu frames\n",
      |                  ~~^
      |                    |
      |                    long unsigned int
      |                  %llu
  393 |    snd_pcm_stream_name(direction), expected_frame_count,
      |                                    ~~~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    uint64_t {aka long long unsigned int}
subcmd-transfer.c:392:39: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
  392 |    "%s: Expected %lu frames, Actual %lu frames\n",
      |                                     ~~^
      |                                       |
      |                                       long unsigned int
      |                                     %llu
  393 |    snd_pcm_stream_name(direction), expected_frame_count,
  394 |    *actual_frame_count);
      |    ~~~~~~~~~~~~~~~~~~~                 
      |    |
      |    uint64_t {aka long long unsigned int}

alsa.c: In function 'set_snd_pcm_params':
../include/gettext.h:13:25: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'snd_pcm_uframes_t' {aka 'long unsigned int'} [-Wformat=]
13 | # define gettext(msgid) (msgid)
| ^~~~~~~
../include/gettext.h:18:18: note: in expansion of macro 'gettext'
18 | #define _(msgid) gettext (msgid)

      |                  ^~~~~~~

alsa.c:256:21: note: in expansion of macro '_'
256 | fprintf(bat->err, _("period size: %zd %s: %s(%d)\n"),
| ^
../include/gettext.h:13:25: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'snd_pcm_uframes_t' {aka 'long unsigned int'} [-Wformat=]
13 | # define gettext(msgid) (msgid)
| ^~~~~~~
../include/gettext.h:18:18: note: in expansion of macro 'gettext'
18 | #define _(msgid) gettext (msgid)

      |                  ^~~~~~~

alsa.c:265:21: note: in expansion of macro '_'
265 | fprintf(bat->err, _("buffer size: %zd %s: %s(%d)\n"),
| ^
../include/gettext.h:13:25: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'snd_pcm_uframes_t' {aka 'long unsigned int'} [-Wformat=]
13 | # define gettext(msgid) (msgid)
| ^~~~~~~
../include/gettext.h:18:18: note: in expansion of macro 'gettext'
18 | #define _(msgid) gettext (msgid)

      |                  ^~~~~~~

alsa.c:273:21: note: in expansion of macro '_'
273 | fprintf(bat->err, _("equal to buffer size (%zd)\n"),
| ^

Signature · 10 lines
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source

Besuchen Sie uns auf der Embedded World 2020 in Nürnberg!
-> Halle 4, Stand 368

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel