rageworx / fltk-custom

A clone of FLTK 1.4.0 for enhance as customized GUI, more functional. This project is belong to https://fltk.org.
https://rageworx.info
Other
8 stars 1 forks source link

PNG compilation warnings fix. #38

Closed rageworx closed 1 year ago

rageworx commented 1 year ago

In MinGW-W64 compilation, these warnings occurs -

pngprefix.h:147:27: warning: 'number_buf' may be used uninitialized [-Wmaybe-uni
nitialized]
  147 | #define png_format_number fltk_png_format_number
      |                           ^~~~~~~~~~~~~~~~~~~~~~
In file included from png.h:335,
                 from pngpriv.h:386:
pngprefix.h:147:27: note: by argument 1 of type 'png_const_charp' {aka 'const ch
ar *'} to 'fltk_png_format_number' declared here
  147 | #define png_format_number fltk_png_format_number
      |                           ^~~~~~~~~~~~~~~~~~~~~~
pngconf.h:287:70: note: in definition of macro 'PNG_FUNCTION'
  287 | #  define PNG_FUNCTION(type, name, args, attributes) attributes type nam
e args
      |                                                                      ^~~
~
pngpriv.h:1744:1: note: in expansion of macro 'PNG_INTERNAL_FUNCTION'
 1744 | PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start
,
      | ^~~~~~~~~~~~~~~~~~~~~
pngpriv.h:1744:33: note: in expansion of macro 'png_format_number'
 1744 | PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start
,
      |                                 ^~~~~~~~~~~~~~~~~
png.c:755:12: note: 'number_buf' declared here
  755 |       char number_buf[5]; /* enough for a four-digit year */
      |            ^~~~~~~~~~
pngprefix.h: In function 'fltk_png_convert_to_rfc1123':
pngprefix.h:147:27: warning: 'number_buf' may be used uninitialized [-Wmaybe-uni
nitialized]
  147 | #define png_format_number fltk_png_format_number
      |                           ^~~~~~~~~~~~~~~~~~~~~~
pngprefix.h:147:27: note: by argument 1 of type 'png_const_charp' {aka 'const ch
ar *'} to 'fltk_png_format_number' declared here
  147 | #define png_format_number fltk_png_format_number
      |                           ^~~~~~~~~~~~~~~~~~~~~~
pngconf.h:287:70: note: in definition of macro 'PNG_FUNCTION'
  287 | #  define PNG_FUNCTION(type, name, args, attributes) attributes type nam
e args
      |                                                                      ^~~
~
pngpriv.h:1744:1: note: in expansion of macro 'PNG_INTERNAL_FUNCTION'
 1744 | PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start
,
      | ^~~~~~~~~~~~~~~~~~~~~
pngpriv.h:1744:33: note: in expansion of macro 'png_format_number'
 1744 | PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start
,
      |                                 ^~~~~~~~~~~~~~~~~
png.c:755:12: note: 'number_buf' declared here
  755 |       char number_buf[5]; /* enough for a four-digit year */
      |            ^~~~~~~~~~

It should be fixed by using initializing each buffer definitions by = {0};

rageworx commented 1 year ago

Issue solved at commit of 314029d..1d5ebd8.