Fix MSVC Level 4 warnings (#1126)

This commit is contained in:
MatthiasWM 2025-10-31 19:15:38 +01:00
parent 7500b3c540
commit 1ba957eb60
14 changed files with 62 additions and 48 deletions

View File

@ -157,7 +157,7 @@ public:
\param[in] b down box type \param[in] b down box type
*/ */
void down_box(Fl_Boxtype b) {down_box_ = b;} void down_box(Fl_Boxtype b) {down_box_ = (uchar)b;}
void shortcut(const char *s); void shortcut(const char *s);

View File

@ -66,7 +66,7 @@ public:
/** Gets the box type used for the navigation bar. */ /** Gets the box type used for the navigation bar. */
Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; } Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
/** Sets the box type to use for the navigation bar. */ /** Sets the box type to use for the navigation bar. */
void down_box(Fl_Boxtype b) { down_box_ = b; } void down_box(Fl_Boxtype b) { down_box_ = (uchar)b; }
/** /**
Gets the current error color. Gets the current error color.

View File

@ -177,15 +177,15 @@ public:
Cell(int row, int col) { // constructor Cell(int row, int col) { // constructor
Cell_(); Cell_();
row_ = row; row_ = (short)row;
col_ = col; col_ = (short)col;
} }
Cell(Fl_Widget *w, int row, int col) { // widget assignment Cell(Fl_Widget *w, int row, int col) { // widget assignment
Cell_(); Cell_();
widget_ = w; widget_ = w;
row_ = row; row_ = (short)row;
col_ = col; col_ = (short)col;
} }
/** /**

View File

@ -232,7 +232,7 @@ public:
*/ */
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;} Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
/** Sets the box type used to surround the currently-selected items in the menus. */ /** Sets the box type used to surround the currently-selected items in the menus. */
void down_box(Fl_Boxtype b) {down_box_ = b;} void down_box(Fl_Boxtype b) {down_box_ = (uchar)b;}
/** Get the box type for the menu popup windows. /** Get the box type for the menu popup windows.
\return the box type, or FL_NO_BOX if Fl_Menu_::box() is to be used instead \return the box type, or FL_NO_BOX if Fl_Menu_::box() is to be used instead

View File

@ -217,7 +217,7 @@ struct FL_EXPORT Fl_Menu_Item {
\see const char* Fl_Menu_Item::label() const \see const char* Fl_Menu_Item::label() const
*/ */
void label(Fl_Labeltype a, const char* b) { void label(Fl_Labeltype a, const char* b) {
labeltype_ = a; labeltype_ = (uchar)a;
text = b; text = b;
} }
@ -273,7 +273,7 @@ struct FL_EXPORT Fl_Menu_Item {
the label() pointer as another form of data such as a bitmap. the label() pointer as another form of data such as a bitmap.
The value FL_NORMAL_LABEL prints the label as text. The value FL_NORMAL_LABEL prints the label as text.
*/ */
void labeltype(Fl_Labeltype a) {labeltype_ = a;} void labeltype(Fl_Labeltype a) {labeltype_ = (uchar)a;}
/** /**
Gets the menu item's label color. Gets the menu item's label color.

View File

@ -99,7 +99,7 @@ public:
Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;} Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
/** Sets the slider box type. */ /** Sets the slider box type. */
void slider(Fl_Boxtype c) {slider_ = c;} void slider(Fl_Boxtype c) {slider_ = (uchar)c;}
}; };
#endif #endif

View File

@ -514,7 +514,7 @@ public:
row_header() must also be enabled to allow resizing. row_header() must also be enabled to allow resizing.
*/ */
void row_resize(int flag) { // enable row resizing void row_resize(int flag) { // enable row resizing
_row_resize = flag; _row_resize = (char)flag;
} }
/** /**
@ -531,7 +531,7 @@ public:
\p col_header() must also be enabled to allow resizing. \p col_header() must also be enabled to allow resizing.
*/ */
void col_resize(int flag) { // enable col resizing void col_resize(int flag) { // enable col resizing
_col_resize = flag; _col_resize = (char)flag;
} }
/** /**
@ -578,7 +578,7 @@ public:
If changed, the table is redrawn. If changed, the table is redrawn.
*/ */
void row_header(int flag) { void row_header(int flag) {
_row_header = flag; _row_header = (char)flag;
table_resized(); table_resized();
redraw(); redraw();
} }
@ -595,7 +595,7 @@ public:
If changed, the table is redrawn. If changed, the table is redrawn.
*/ */
void col_header(int flag) { void col_header(int flag) {
_col_header = flag; _col_header = (char)flag;
table_resized(); table_resized();
redraw(); redraw();
} }

View File

@ -483,14 +483,14 @@ protected:
else bgcolor(defaultbgcolor_); else bgcolor(defaultbgcolor_);
} }
int onoff(bool flag, Attrib a) { return (flag ? (attrib_ | a) : (attrib_ & ~a)); } int onoff(bool flag, Attrib a) { return (flag ? (attrib_ | a) : (attrib_ & ~a)); }
void sgr_bold(bool val) { attrib_ = onoff(val, Fl_Terminal::BOLD); } // e.g. ESC[1m void sgr_bold(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::BOLD); } // e.g. ESC[1m
void sgr_dim(bool val) { attrib_ = onoff(val, Fl_Terminal::DIM); } // e.g. ESC[2m void sgr_dim(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::DIM); } // e.g. ESC[2m
void sgr_italic(bool val) { attrib_ = onoff(val, Fl_Terminal::ITALIC); } // e.g. ESC[3m void sgr_italic(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::ITALIC); } // e.g. ESC[3m
void sgr_underline(bool val) { attrib_ = onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[3m void sgr_underline(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[3m
void sgr_dbl_under(bool val) { attrib_ = onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[21m (TODO!) void sgr_dbl_under(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[21m (TODO!)
void sgr_blink(bool val) { (void)val; /* NOT IMPLEMENTED */ } // e.g. ESC[5m void sgr_blink(bool val) { (void)val; /* NOT IMPLEMENTED */ } // e.g. ESC[5m
void sgr_inverse(bool val) { attrib_ = onoff(val, Fl_Terminal::INVERSE); } // e.g. ESC[7m void sgr_inverse(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::INVERSE); } // e.g. ESC[7m
void sgr_strike(bool val) { attrib_ = onoff(val, Fl_Terminal::STRIKEOUT); } // e.g. ESC[9m void sgr_strike(bool val) { attrib_ = (uchar)onoff(val, Fl_Terminal::STRIKEOUT); } // e.g. ESC[9m
}; };
protected: protected:

View File

@ -349,7 +349,7 @@ public:
} }
/// See if the item is selected. /// See if the item is selected.
char is_selected() const { char is_selected() const {
return(is_flag(SELECTED)); return (char)is_flag(SELECTED);
} }
/// Change the item's activation state to the optionally specified 'val'. /// Change the item's activation state to the optionally specified 'val'.
/// ///
@ -378,7 +378,7 @@ public:
} }
/// See if the item is activated. /// See if the item is activated.
char is_activated() const { char is_activated() const {
return(is_flag(ACTIVE)); return (char)is_flag(ACTIVE);
} }
/// See if the item is activated. Alias for is_activated(). /// See if the item is activated. Alias for is_activated().
char is_active() const { char is_active() const {

View File

@ -361,7 +361,7 @@ public:
/// 0: hides collapse icons. /// 0: hides collapse icons.
/// ///
inline void showcollapse(int val) { inline void showcollapse(int val) {
_showcollapse = val; _showcollapse = (char)val;
} }
/// Get the default sort order value /// Get the default sort order value
inline Fl_Tree_Sort sortorder() const { inline Fl_Tree_Sort sortorder() const {

View File

@ -448,7 +448,7 @@ public:
\param[in] new_box the new box type \param[in] new_box the new box type
\see box(), Fl_Boxtype \see box(), Fl_Boxtype
*/ */
void box(Fl_Boxtype new_box) {box_ = new_box;} void box(Fl_Boxtype new_box) {box_ = (uchar)new_box;}
/** Gets the background color of the widget. /** Gets the background color of the widget.
\return current background color \return current background color
@ -527,7 +527,7 @@ public:
/** Shortcut to set the label text and type in one call. /** Shortcut to set the label text and type in one call.
\see label(const char *), labeltype(Fl_Labeltype) \see label(const char *), labeltype(Fl_Labeltype)
*/ */
void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;} void label(Fl_Labeltype a, const char* b) {label_.type = (uchar)a; label_.value = b;}
/** Gets the label type. /** Gets the label type.
\return the current label type. \return the current label type.
@ -543,7 +543,7 @@ public:
\param[in] a new label type \param[in] a new label type
\see Fl_Labeltype \see Fl_Labeltype
*/ */
void labeltype(Fl_Labeltype a) {label_.type = a;} void labeltype(Fl_Labeltype a) {label_.type = (uchar)a;}
/** Gets the label color. /** Gets the label color.
The default color is FL_FOREGROUND_COLOR. The default color is FL_FOREGROUND_COLOR.

View File

@ -223,7 +223,7 @@ inline void fl_set_object_callback(Fl_Widget*o,Forms_CB c,long a) {o->callback(c
inline void fl_call_object_callback(Fl_Widget* o) {o->do_callback();} inline void fl_call_object_callback(Fl_Widget* o) {o->do_callback();}
inline void fl_trigger_object(Fl_Widget* o) {o->do_callback();} inline void fl_trigger_object(Fl_Widget* o) {o->do_callback();}
inline void fl_set_object_return(Fl_Widget* o, int v) { inline void fl_set_object_return(Fl_Widget* o, int v) {
o->when((Fl_When)(v|FL_WHEN_RELEASE));} o->when((uchar)(v|FL_WHEN_RELEASE));}
inline void fl_redraw_object(Fl_Widget* o) {o->redraw();} inline void fl_redraw_object(Fl_Widget* o) {o->redraw();}
inline void fl_show_object(Fl_Widget* o) {o->show();} inline void fl_show_object(Fl_Widget* o) {o->show();}
@ -490,13 +490,23 @@ forms_constructor(Fl_Round_Button, fl_add_round3dbutton)
#include "Fl_Check_Button.H" #include "Fl_Check_Button.H"
forms_constructor(Fl_Check_Button, fl_add_checkbutton) forms_constructor(Fl_Check_Button, fl_add_checkbutton)
inline Fl_Widget* fl_add_bitmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;} inline Fl_Widget* fl_add_bitmapbutton(int t,int x,int y,int w,int h,const char* l) {
inline void fl_set_bitmapbutton_data(Fl_Widget* o,int a,int b,uchar* c) { Fl_Widget* o = fl_add_button((uchar)t,x,y,w,h,l);
(new Fl_Bitmap(c,a,b))->label(o);} // does not delete old Fl_Bitmap! return o;
}
inline Fl_Widget* fl_add_pixmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;} inline void fl_set_bitmapbutton_data(Fl_Widget *o, int a, int b, uchar *c) {
inline void fl_set_pixmapbutton_data(Fl_Widget* o, const char*const* c) { (new Fl_Bitmap(c, a, b))->label(o); // does not delete old Fl_Bitmap!
(new Fl_Pixmap(c))->label(o);} // does not delete old Fl_Pixmap! }
inline Fl_Widget* fl_add_pixmapbutton(int t,int x,int y,int w,int h,const char* l) {
Fl_Widget* o = fl_add_button((uchar)t,x,y,w,h,l);
return o;
}
inline void fl_set_pixmapbutton_data(Fl_Widget *o, const char *const *c) {
(new Fl_Pixmap(c))->label(o); // does not delete old Fl_Pixmap!
}
// Fl_Canvas object not yet implemented! // Fl_Canvas object not yet implemented!
@ -516,7 +526,8 @@ inline void fl_set_chart_bounds(Fl_Widget* o, double a, double b) {
inline void fl_set_chart_maxnumb(Fl_Widget* o, int v) { inline void fl_set_chart_maxnumb(Fl_Widget* o, int v) {
((Fl_Chart*)o)->maxsize(v);} ((Fl_Chart*)o)->maxsize(v);}
inline void fl_set_chart_autosize(Fl_Widget* o, int v) { inline void fl_set_chart_autosize(Fl_Widget* o, int v) {
((Fl_Chart*)o)->autosize(v);} ((Fl_Chart*)o)->autosize((uchar)v);
}
inline void fl_set_chart_lstyle(Fl_Widget* o, Fl_Font v) { inline void fl_set_chart_lstyle(Fl_Widget* o, Fl_Font v) {
((Fl_Chart*)o)->textfont(v);} ((Fl_Chart*)o)->textfont(v);}
inline void fl_set_chart_lsize(Fl_Widget* o, int v) { inline void fl_set_chart_lsize(Fl_Widget* o, int v) {
@ -575,7 +586,8 @@ inline void fl_set_counter_step(Fl_Widget* o, double a, double b) {
inline void fl_set_counter_precision(Fl_Widget* o, int v) { inline void fl_set_counter_precision(Fl_Widget* o, int v) {
((Fl_Counter*)o)->precision(v);} ((Fl_Counter*)o)->precision(v);}
inline void fl_set_counter_return(Fl_Widget* o, int v) { inline void fl_set_counter_return(Fl_Widget* o, int v) {
((Fl_Counter*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));} ((Fl_Counter*)o)->when((uchar)(v|FL_WHEN_RELEASE));
}
inline double fl_get_counter_value(Fl_Widget* o) { inline double fl_get_counter_value(Fl_Widget* o) {
return ((Fl_Counter*)o)->value();} return ((Fl_Counter*)o)->value();}
inline void fl_get_counter_bounds(Fl_Widget* o, float* a, float* b) { inline void fl_get_counter_bounds(Fl_Widget* o, float* a, float* b) {
@ -606,7 +618,8 @@ inline void fl_get_dial_bounds(Fl_Widget* o, float* a, float* b) {
*b = float(((Fl_Dial*)o)->maximum()); *b = float(((Fl_Dial*)o)->maximum());
} }
inline void fl_set_dial_return(Fl_Widget* o, int i) { inline void fl_set_dial_return(Fl_Widget* o, int i) {
((Fl_Dial*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));} ((Fl_Dial*)o)->when((uchar)(i|FL_WHEN_RELEASE));
}
inline void fl_set_dial_angles(Fl_Widget* o, int a, int b) { inline void fl_set_dial_angles(Fl_Widget* o, int a, int b) {
((Fl_Dial*)o)->angles((short)a, (short)b);} ((Fl_Dial*)o)->angles((short)a, (short)b);}
//inline void fl_set_dial_cross(Fl_Widget* o, int); //inline void fl_set_dial_cross(Fl_Widget* o, int);
@ -628,11 +641,9 @@ inline Fl_Widget* fl_add_labelframe(Fl_Boxtype i,int x,int y,int w,int h,const c
} }
#include "Fl_Free.H" #include "Fl_Free.H"
inline Fl_Free* inline Fl_Free* fl_add_free(int t,double x,double y,double w,double h,const char* l,
fl_add_free(int t,double x,double y,double w,double h,const char* l,
FL_HANDLEPTR hdl) { FL_HANDLEPTR hdl) {
return (Fl_Free*)(fl_add_new( return (Fl_Free*)(fl_add_new(new Fl_Free((uchar)t,int(x),int(y),int(w),int(h),l,hdl)));
new Fl_Free(t,int(x),int(y),int(w),int(h),l,hdl)));
} }
#include "fl_ask.H" #include "fl_ask.H"
@ -676,7 +687,8 @@ forms_constructor(Fl_Input, fl_add_input)
inline void fl_set_input(Fl_Widget* o, const char* v) { inline void fl_set_input(Fl_Widget* o, const char* v) {
((Fl_Input*)o)->value(v);} ((Fl_Input*)o)->value(v);}
inline void fl_set_input_return(Fl_Widget* o, int x) { inline void fl_set_input_return(Fl_Widget* o, int x) {
((Fl_Input*)o)->when((Fl_When)(x | FL_WHEN_RELEASE));} ((Fl_Input*)o)->when((uchar)(x | FL_WHEN_RELEASE));
}
inline void fl_set_input_color(Fl_Widget* o, Fl_Color a, Fl_Color b) { inline void fl_set_input_color(Fl_Widget* o, Fl_Color a, Fl_Color b) {
((Fl_Input*)o)->textcolor(a); ((Fl_Input*)o)->textcolor(a);
((Fl_Input*)o)->cursor_color(b); ((Fl_Input*)o)->cursor_color(b);
@ -765,7 +777,8 @@ inline void fl_set_positioner_xstep(Fl_Widget* o, double v) {
inline void fl_set_positioner_ystep(Fl_Widget* o, double v) { inline void fl_set_positioner_ystep(Fl_Widget* o, double v) {
((Fl_Positioner*)o)->ystep(v);} ((Fl_Positioner*)o)->ystep(v);}
inline void fl_set_positioner_return(Fl_Widget* o, int v) { inline void fl_set_positioner_return(Fl_Widget* o, int v) {
((Fl_Positioner*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));} ((Fl_Positioner*)o)->when((uchar)(v|FL_WHEN_RELEASE));
}
#include "Fl_Slider.H" #include "Fl_Slider.H"
@ -785,7 +798,8 @@ inline void fl_get_slider_bounds(Fl_Widget* o, float* a, float* b) {
*b = float(((Fl_Slider*)o)->maximum()); *b = float(((Fl_Slider*)o)->maximum());
} }
inline void fl_set_slider_return(Fl_Widget* o, int i) { inline void fl_set_slider_return(Fl_Widget* o, int i) {
((Fl_Slider*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));} ((Fl_Slider*)o)->when((uchar)(i|FL_WHEN_RELEASE));
}
inline void fl_set_slider_step(Fl_Widget* o, double v) { inline void fl_set_slider_step(Fl_Widget* o, double v) {
((Fl_Slider*)o)->step(v);} ((Fl_Slider*)o)->step(v);}
// inline void fl_set_slider_increment(Fl_Widget* o, double v, double); // inline void fl_set_slider_increment(Fl_Widget* o, double v, double);

View File

@ -188,7 +188,7 @@ public:
Snap_Action() : ex(0x7fff), ey(0x7fff), dx(128), dy(128), type(0), mask(0) { } Snap_Action() : ex(0x7fff), ey(0x7fff), dx(128), dy(128), type(0), mask(0) { }
virtual ~Snap_Action() { } virtual ~Snap_Action() { }
virtual void check(Snap_Data &d) = 0; virtual void check(Snap_Data &d) = 0;
virtual void draw(Snap_Data &d) { } virtual void draw(Snap_Data &d) { (void)d; }
virtual bool matches(Snap_Data &d); virtual bool matches(Snap_Data &d);
public: public:
static int eex, eey; static int eex, eey;

View File

@ -240,8 +240,8 @@ public:
virtual Node* click_test(int,int) { return nullptr; } virtual Node* click_test(int,int) { return nullptr; }
virtual void add_child(Node*, Node* beforethis) { } virtual void add_child(Node *, Node *beforethis) { (void)beforethis; }
virtual void move_child(Node*, Node* beforethis) { } virtual void move_child(Node *, Node *beforethis) { (void)beforethis; }
virtual void remove_child(Node*) { } virtual void remove_child(Node*) { }
/** Give widgets a chance to arrange their children after all children were added. /** Give widgets a chance to arrange their children after all children were added.