FLTK logo

Re: [fltk/fltk] Compiler warnings with msys2 (current) + fltk-1.4.x current (Issue #296)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Compiler warnings with msys2 (current) + fltk-1.4.x current (Issue #296) Albrecht Schlosser Nov 25, 2021  
 

I'll look into the test/icon.cxx warnings next.

And so did I. buffer is definitely used uninitialized to create an Fl_RGB_Image with undefined pixel data. Then icon.color_average(c, 0.0); overwrites the undefined pixels with the value of c (by "averaging" 100% c, 0% original data). Not nice.

I can see two solutions:

  1. what happens if you move the declaration of buffer above choice_cb? This would init it with zeroes. The code would work but still be weird.
  2. instead of using color_average() we could init buffer[] with appropriate values which would be 32 * 32 * (255, 0, 0) or (0, 255, 0) or (0, 0, 255), respectively.

The code would likely be longer but free of warnings and clear. Using color_average() is cool but hard to understand.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.