Clean up some compile-time warnings/errors

Under Xcode with clang, Mark Kim was getting an error:

  src/tuxpaint.c:23125:44: error: use of undeclared identifier 'i'
                   SDL_MapRGB(img_color_btns[i]->format,
                                             ^

Oddly, I was not getting errors no matter what nonsense I put
in there (e.g., changing "->format" to "->formatXYZ"), under
"gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)"
This commit is contained in:
Bill Kendrick 2022-02-05 16:59:59 -08:00
parent 36968b0abf
commit e7d81ef63f
2 changed files with 5 additions and 3 deletions

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - January 25, 2022 June 14, 2002 - February 5, 2022
$Id$ $Id$
*/ */
@ -82,6 +82,8 @@ void do_setcursor(SDL_Cursor * c)
UNUSED(tiny_mask_bits); UNUSED(tiny_mask_bits);
UNUSED(arrow_bits); UNUSED(arrow_bits);
UNUSED(arrow_mask_bits); UNUSED(arrow_mask_bits);
UNUSED(pipette_bits);
UNUSED(pipette_mask_bits);
if (!hide_cursor && !no_fancy_cursors) if (!hide_cursor && !no_fancy_cursors)
SDL_SetCursor(c); SDL_SetCursor(c);

View file

@ -23122,13 +23122,13 @@ static void render_color_button(int the_color, SDL_Surface * decoration, SDL_Sur
{ {
putpixels[img_color_btns[the_color]->format->BytesPerPixel] putpixels[img_color_btns[the_color]->format->BytesPerPixel]
(img_color_btns[the_color], x, y, (img_color_btns[the_color], x, y,
SDL_MapRGB(img_color_btns[i]->format, SDL_MapRGB(img_color_btns[the_color]->format,
linear_to_sRGB(rh * aa + ru * (1.0 - aa)), linear_to_sRGB(rh * aa + ru * (1.0 - aa)),
linear_to_sRGB(gh * aa + gu * (1.0 - aa)), linear_to_sRGB(bh * aa + bu * (1.0 - aa)))); linear_to_sRGB(gh * aa + gu * (1.0 - aa)), linear_to_sRGB(bh * aa + bu * (1.0 - aa))));
putpixels[img_color_btns[the_color + NUM_COLORS]->format->BytesPerPixel] putpixels[img_color_btns[the_color + NUM_COLORS]->format->BytesPerPixel]
(img_color_btns[the_color + NUM_COLORS], x, y, (img_color_btns[the_color + NUM_COLORS], x, y,
SDL_MapRGB(img_color_btns[i + NUM_COLORS]->format, SDL_MapRGB(img_color_btns[the_color + NUM_COLORS]->format,
linear_to_sRGB(rh * aa + rd * (1.0 - aa)), linear_to_sRGB(rh * aa + rd * (1.0 - aa)),
linear_to_sRGB(gh * aa + gd * (1.0 - aa)), linear_to_sRGB(bh * aa + bd * (1.0 - aa)))); linear_to_sRGB(gh * aa + gd * (1.0 - aa)), linear_to_sRGB(bh * aa + bd * (1.0 - aa))));
} }