[alsa-devel] Format string warnings on 32 bit platforms

Rolf Eike Beer eb at emlix.com
Tue Jan 21 12:10:26 CET 2020


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"),
      |                     ^

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 313 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20200121/2a14fbbc/attachment.sig>


More information about the Alsa-devel mailing list