Re: [Tuxpaint-devel] Per-locale default font
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2023-06-22 05:58:06
|
On Mon, Jun 19, 2023 at 08:26:46AM +0900, Shin-ichi TOYAMA wrote: > On Sun, 18 Jun 2023 13:38:35 -0700, Bill Kendrick wrote: > >It's doubtful I'll get to it today, as I've got an engagement in a > >bit, but it's nice to get use closer to 'zero warnings' when > >compiling. > > > >At least, that's what it looks like for ME, just doing a plain > >`make` here on my Kubuntu 22.04 system. If anyone else is still > >seeing compiler warnings, please share them so we can try and > >clean up the codebase. It's nice for _real_ errors to not be > >buried in a sea of warnings. :) > > Here are warnings on Windows so far. > I will see them when I have time. > > src/tuxpaint.c:234:2: warning: #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" [-Wcpp] > 234 | #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" > | ^~~~~~~ Oh, this is our own warning. It's informative, and wow it's from forever ago! :^D /* Check if features.h did its 'magic', in which case strcasestr() is likely available; if not using GNU, you can set HAVE_STRCASESTR to avoid trying to redefine it -bjk 2006.06.02 */ #if !defined(__USE_GNU) && !defined(HAVE_STRCASESTR) #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" ... then we declare our own strcasestr() func ... I, uh, don't see a "features.h" in 'tuxpaint' source these days. I'm not sure the best solution here, but I'll ignore it for now. :) > src/tuxpaint.c: In function 'mainloop': > src/tuxpaint.c:3747:21: warning: the comparison will always evaluate as 'true' for the address of 'sizes' will never be NULL [-Waddress] > 3747 | if (magics[magic_group][cur_thing].sizes) > | ^~~~~~ > src/tuxpaint.c:1581:7: note: 'sizes' declared here > 1581 | int sizes[MAX_MODES]; /* Whether magic tool accepts sizes */ > | ^~~~~ <snip repeats of similar warnigns> Ah whoops wow yes, these are places where I forgot to change the reference from "sizes" to "sizes[...]", when I turned it into an array. My 'gcc' shows no complaints, unless I actually make it explicitly test whether it == 1, in which case I get warning: comparison between pointer and integer Just committed an attempt to mend this. :whew: > src/tuxpaint.c: In function '_load_svg': > src/tuxpaint.c:21025:5: warning: 'rsvg_handle_close' is deprecated: Use 'rsvg_handle_read_stream_sync' instead [-Wdeprecated-declarations] > 21025 | rsvg_handle_close(rsvg_handle, &gerr); > | ^~~~~~~~~~~~~~~~~ > In file included from src/tuxpaint.c:517: > C:/msys64/mingw64/include/librsvg-2.0/librsvg/rsvg.h:605:10: note: declared here > 605 | gboolean rsvg_handle_close (RsvgHandle *handle, GError **error); > | ^~~~~~~~~~~~~~~~~ <snip> Same for me; see https://sourceforge.net/p/tuxpaint/bugs/278/ :) I still need to work on it. > src/tuxpaint.c:26894:15: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] > 26894 | ttffont = TTF_FontFaceFamilyName(getfonthandle(i)->ttf_font); > | ^ > src/tuxpaint.c: In function 'load_embedded_data': Casting to (char *); see if that helps. > src/tuxpaint.c:27585:15: warning: pointer 'unc_buff' used after 'free' [-Wuse-after-free] > 27585 | free(unc_buff); > | ^~~~~~~~~~~~~~ > src/tuxpaint.c:27581:15: note: call to 'free' here > 27581 | free(unc_buff); > | ^~~~~~~~~~~~~~ > src/tuxpaint.c:27646:15: warning: pointer 'unc_buff' used after 'free' [-Wuse-after-free] > 27646 | free(unc_buff); > | ^~~~~~~~~~~~~~ > src/tuxpaint.c:27642:15: note: call to 'free' here > 27642 | free(unc_buff); > | ^~~~~~~~~~~~~~ I think I fixed it; see if that helps. :) > src/fonts.c: In function 'TuxPaint_Font_OpenFont': > src/fonts.c:342:16: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] > 342 | familyname = TTF_FontFaceFamilyName(ttf_font); /* N.B.: I don't believe we're supposed to free() this... -bjk 2021.10.26 */ > | ^ [See above] > src/fonts.c: In function 'getfonthandle': > src/fonts.c:1357:20: warning: the comparison will always evaluate as 'true' for the address of 'filename' will never be NULL [-Waddress] > 1357 | if (fi->filename != NULL) > | ^~ > In file included from src/fonts.c:60: > src/fonts.h:152:9: note: 'filename' declared here > 152 | char *filename[4]; > | ^~~~~~~~ Attempted a fix (was supposed to be indexing into that array). > src/dirwalk.c: In function 'tp_ftw': > src/dirwalk.c:436:2: warning: #warning Failed to see DT_UNKNOWN [-Wcpp] > 436 | #warning Failed to see DT_UNKNOWN > | ^~~~~~~ This is another case of us echoing a warning. The comment here is: // Linux and BSD can often provide file type info w/o the stat() call Then it tests for that existing, and does a 'switch/case' block, testing the "d_type" of the file we see with 'readdir()'. I don't really remember what's supposed to be going on in here (or, in fact, if I had much to do with it! 20 years is a long time!), so I'm going to ignore this one as well. :shrug: Please tell me if it throws fewer warnings now, and hopefully also still builds and runs properly. This goes for everyone! (Mark, Pere, Luc :) ) Thanks! -- -bill! Sent from my computer |