Skip to content

window: replace %ld with platform independent format macro

Krassy Boykinov requested to merge chereskata/livi:fix-format-string into main

Hi Guido,

i hope you are doing well :). After trying to package the 0.1.0 version on alpine, i needed to fix the non compiling 32-bit arches. This was done by including the PRId64 out of inttypes.h to let the format string be independent of register sizes.

../src/livi-window.c: In function 'livi_window_resume_pos':
../src/livi-window.c:1179:14: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long int' [-Werror=format=]
 1179 |     g_debug ("Found video %s, resuming at %ld s", self->stream.ref_uri, pos / GST_SECOND);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:362:32: note: in definition of macro 'g_debug'
  362 |                                __VA_ARGS__)
      |                                ^~~~~~~~~~~
../src/livi-window.c:1179:45: note: format string is defined here
 1179 |     g_debug ("Found video %s, resuming at %ld s", self->stream.ref_uri, pos / GST_SECOND);
      |                                           ~~^
      |                                             |
      |                                             long int
      |                                           %lld
cc1: some warnings being treated as errors
ninja: subcommand failed

Thank you very much,

Krassy

Merge request reports