Fix a few more warnings by Clang.

- Apple Clang 17.0.0.
- png, z, jpeg lib integer cast warnings remain
- FLTK callback function cast warnings remain.
This commit is contained in:
Matthias Melcher
2025-11-21 13:37:54 +01:00
parent f57891864b
commit 910c7d18eb
5 changed files with 10 additions and 8 deletions

View File

@@ -886,7 +886,7 @@ int Fl_Help_View::Impl::do_align(
void Fl_Help_View::Impl::format() {
int i; // Looping var
int done; // Are we done yet?
Text_Block *block, // Current block
Text_Block *block = nullptr, // Current block
*cell; // Current table cell
int cells[MAX_COLUMNS],
// Cells in the current row...
@@ -899,7 +899,7 @@ void Fl_Help_View::Impl::format() {
wattr[1024], // Width attribute buffer
hattr[1024], // Height attribute buffer
linkdest[1024]; // Link destination
int xx, yy, ww, hh; // Size of current text fragment
int xx, yy, ww, hh = 0; // Size of current text fragment
int line; // Current line in block
int links; // Links for current line
Fl_Font font;

View File

@@ -423,12 +423,12 @@ int Menu_Window::display_height_ = 0;
*/
Menu_Window::Menu_Window(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
const Fl_Menu_Item* picked, const Fl_Menu_Item* t,
int menubar, int menubar_title, int right_edge)
int menubar, int mb_title, int right_edge)
: Menu_Window_Basetype(X, Y, Wp, Hp, m)
{
int scr_x, scr_y, scr_w, scr_h;
int tx = X, ty = Y;
menubar_title = menubar_title;
menubar_title = mb_title;
int n = (Wp > 0 ? Fl::screen_num(X, Y) : -1);
Fl_Window_Driver::driver(this)->menu_window_area(scr_x, scr_y, scr_w, scr_h, n);
if (!right_edge || right_edge > scr_x+scr_w)

View File

@@ -59,7 +59,9 @@ Fl_XPM_Image::Fl_XPM_Image(const char *name) : Fl_Pixmap((char *const*)0) {
int malloc_size = INITIALLINES;
char buffer[MAXSIZE+20];
int i = 0;
int W,H,ncolors,chars_per_pixel;
int W = 0, H = 0;
int ncolors = 0;
int chars_per_pixel = 0;
while (fgets(buffer,MAXSIZE+20,f)) {
if (buffer[0] != '\"') continue;
char *myp = buffer;

View File

@@ -201,7 +201,7 @@ void fl_draw(
char *linebuf = NULL; // Pointer to a buffer managed by expand_text_
const char* p; // Scratch pointer into text, multiple use
const char* e; // Scratch pointer into text, multiple use
int buflen; // Number of bytes copied into linebuf
int buflen = 0; // Number of bytes copied into linebuf
// by expand_text_
char symbol[2][255]; // Copy of symbol text at start and end of str
int symwidth[2]; // Width and height of symbols (always square)
@@ -211,7 +211,7 @@ void fl_draw(
int imgvert = ((align&FL_ALIGN_IMAGE_NEXT_TO_TEXT)==0); // True if image is
// above or below text
int lines; // Number of text lines including '\n' and wrapping
double width; // width of the longest text line
double width = 0.0; // width of the longest text line
int height = fl_height(); // Height of a line of text

View File

@@ -97,7 +97,7 @@ extern "C" void* prime_func(void* p) {
// initialize alternate buffers (struct prime) to store primes
struct prime pr[2];
pr[0].idx = pr[1].idx = n/2 - 1;
pr[0].idx = pr[1].idx = ((int)n/2 - 1);
pr[0].done = 0;
pr[1].done = 1;
pr[0].terminal = pr[1].terminal = terminal;