FLTK logo

[master] 1ba957e - Fix MSVC Level 4 warnings (#1126)

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

[master] 1ba957e - Fix MSVC Level 4 warnings (#1126) "MatthiasWM" Oct 31, 2025  
 
commit 1ba957eb6096c1df1e6476cccea5dbd3ec3b189d
Author:     MatthiasWM <visualc.git@matthiasm.com>
AuthorDate: Fri Oct 31 19:15:38 2025 +0100
Commit:     MatthiasWM <visualc.git@matthiasm.com>
CommitDate: Fri Oct 31 19:15:38 2025 +0100

    Fix MSVC Level 4 warnings (#1126)

 FL/Fl_Button.H          |  2 +-
 FL/Fl_File_Input.H      |  2 +-
 FL/Fl_Grid.H            |  8 ++++----
 FL/Fl_Menu_.H           |  2 +-
 FL/Fl_Menu_Item.H       |  4 ++--
 FL/Fl_Slider.H          |  2 +-
 FL/Fl_Table.H           |  8 ++++----
 FL/Fl_Terminal.H        | 14 +++++++-------
 FL/Fl_Tree_Item.H       |  4 ++--
 FL/Fl_Tree_Prefs.H      |  2 +-
 FL/Fl_Widget.H          |  6 +++---
 FL/forms.H              | 50 +++++++++++++++++++++++++++++++------------------
 fluid/app/Snap_Action.h |  2 +-
 fluid/nodes/Node.h      |  4 ++--
 14 files changed, 62 insertions(+), 48 deletions(-)

diff --git FL/Fl_Button.H FL/Fl_Button.H
index a6429bb..dc31e17 100644
--- FL/Fl_Button.H
+++ FL/Fl_Button.H
@@ -157,7 +157,7 @@ public:
 
     \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);
 
diff --git FL/Fl_File_Input.H FL/Fl_File_Input.H
index 126046a..0516484 100644
--- FL/Fl_File_Input.H
+++ FL/Fl_File_Input.H
@@ -66,7 +66,7 @@ public:
   /** Gets the box type used for the navigation bar. */
   Fl_Boxtype    down_box() const { return (Fl_Boxtype)down_box_; }
   /** 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.
diff --git FL/Fl_Grid.H FL/Fl_Grid.H
index 5e6c278..639988b 100644
--- FL/Fl_Grid.H
+++ FL/Fl_Grid.H
@@ -177,15 +177,15 @@ public:
 
     Cell(int row, int col) {    // constructor
       Cell_();
-      row_ = row;
-      col_ = col;
+      row_ = (short)row;
+      col_ = (short)col;
     }
 
     Cell(Fl_Widget *w, int row, int col) {  // widget assignment
       Cell_();
       widget_ = w;
-      row_ = row;
-      col_ = col;
+      row_ = (short)row;
+      col_ = (short)col;
     }
 
     /**
diff --git FL/Fl_Menu_.H FL/Fl_Menu_.H
index b89949c..f0ddf59 100644
--- FL/Fl_Menu_.H
+++ FL/Fl_Menu_.H
@@ -232,7 +232,7 @@ public:
   */
   Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
   /** 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.
    \return the box type, or FL_NO_BOX if Fl_Menu_::box() is to be used instead
diff --git FL/Fl_Menu_Item.H FL/Fl_Menu_Item.H
index 09b9e02..6d086ea 100644
--- FL/Fl_Menu_Item.H
+++ FL/Fl_Menu_Item.H
@@ -217,7 +217,7 @@ struct FL_EXPORT Fl_Menu_Item {
     \see const char* Fl_Menu_Item::label() const
   */
   void label(Fl_Labeltype a, const char* b) {
-    labeltype_ = a;
+    labeltype_ = (uchar)a;
     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 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.
diff --git FL/Fl_Slider.H FL/Fl_Slider.H
index 030085c..d1ced67 100644
--- FL/Fl_Slider.H
+++ FL/Fl_Slider.H
@@ -99,7 +99,7 @@ public:
   Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
 
   /** Sets the slider box type. */
-  void slider(Fl_Boxtype c) {slider_ = c;}
+  void slider(Fl_Boxtype c) {slider_ = (uchar)c;}
 };
 
 #endif
diff --git FL/Fl_Table.H FL/Fl_Table.H
index 2abd685..3e3c1d6 100644
--- FL/Fl_Table.H
+++ FL/Fl_Table.H
@@ -514,7 +514,7 @@ public:
     row_header() must also be enabled to allow 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.
   */
   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.
   */
   void row_header(int flag) {
-    _row_header = flag;
+    _row_header = (char)flag;
     table_resized();
     redraw();
   }
@@ -595,7 +595,7 @@ public:
     If changed, the table is redrawn.
   */
   void col_header(int flag) {
-    _col_header = flag;
+    _col_header = (char)flag;
     table_resized();
     redraw();
   }
diff --git FL/Fl_Terminal.H FL/Fl_Terminal.H
index dcf038b..e8194c7 100644
--- FL/Fl_Terminal.H
+++ FL/Fl_Terminal.H
@@ -483,14 +483,14 @@ protected:
       else                        bgcolor(defaultbgcolor_);
     }
     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_dim(bool val)       { attrib_ = 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_underline(bool val) { attrib_ = 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_bold(bool val)      { attrib_ = (uchar)onoff(val, Fl_Terminal::BOLD);      } // e.g. ESC[1m
+    void sgr_dim(bool val)       { attrib_ = (uchar)onoff(val, Fl_Terminal::DIM);       } // e.g. ESC[2m
+    void sgr_italic(bool val)    { attrib_ = (uchar)onoff(val, Fl_Terminal::ITALIC);    } // 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_ = (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_inverse(bool val)   { attrib_ = 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_inverse(bool val)   { attrib_ = (uchar)onoff(val, Fl_Terminal::INVERSE);   } // e.g. ESC[7m
+    void sgr_strike(bool val)    { attrib_ = (uchar)onoff(val, Fl_Terminal::STRIKEOUT); } // e.g. ESC[9m
   };
 
 protected:
diff --git FL/Fl_Tree_Item.H FL/Fl_Tree_Item.H
index 8cdd6ee..620fb7d 100644
--- FL/Fl_Tree_Item.H
+++ FL/Fl_Tree_Item.H
@@ -349,7 +349,7 @@ public:
   }
   /// See if the item is selected.
   char is_selected() const {
-    return(is_flag(SELECTED));
+    return (char)is_flag(SELECTED);
   }
   /// Change the item's activation state to the optionally specified 'val'.
   ///
@@ -378,7 +378,7 @@ public:
   }
   /// See if the item is activated.
   char is_activated() const {
-    return(is_flag(ACTIVE));
+    return (char)is_flag(ACTIVE);
   }
   /// See if the item is activated. Alias for is_activated().
   char is_active() const {
diff --git FL/Fl_Tree_Prefs.H FL/Fl_Tree_Prefs.H
index be4e3e2..349fffe 100644
--- FL/Fl_Tree_Prefs.H
+++ FL/Fl_Tree_Prefs.H
@@ -361,7 +361,7 @@ public:
   ///                0: hides collapse icons.
   ///
   inline void showcollapse(int val) {
-    _showcollapse = val;
+    _showcollapse = (char)val;
   }
   /// Get the default sort order value
   inline Fl_Tree_Sort sortorder() const {
diff --git FL/Fl_Widget.H FL/Fl_Widget.H
index 18209af..8a62c12 100644
--- FL/Fl_Widget.H
+++ FL/Fl_Widget.H
@@ -448,7 +448,7 @@ public:
       \param[in] new_box the new box type
       \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.
       \return current background color
@@ -527,7 +527,7 @@ public:
   /** Shortcut to set the label text and type in one call.
       \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.
       \return the current label type.
@@ -543,7 +543,7 @@ public:
       \param[in] a new label type
       \see Fl_Labeltype
    */
-  void labeltype(Fl_Labeltype a) {label_.type = a;}
+  void labeltype(Fl_Labeltype a) {label_.type = (uchar)a;}
 
   /** Gets the label color.
       The default color is FL_FOREGROUND_COLOR.
diff --git FL/forms.H FL/forms.H
index c760259..c8c6df1 100644
--- FL/forms.H
+++ FL/forms.H
@@ -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_trigger_object(Fl_Widget* o) {o->do_callback();}
 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_show_object(Fl_Widget* o) {o->show();}
@@ -490,13 +490,23 @@ forms_constructor(Fl_Round_Button, fl_add_round3dbutton)
 #include "Fl_Check_Button.H"
 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 void fl_set_bitmapbutton_data(Fl_Widget* o,int a,int b,uchar* c) {
-  (new Fl_Bitmap(c,a,b))->label(o);}  // does not delete old Fl_Bitmap!
+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((uchar)t,x,y,w,h,l); 
+    return o;
+}
+
+inline void fl_set_bitmapbutton_data(Fl_Widget *o, int a, int b, uchar *c) {
+  (new Fl_Bitmap(c, a, b))->label(o); // does not delete old Fl_Bitmap!
+}
 
-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_pixmapbutton_data(Fl_Widget* o, const char*const* c) {
-  (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!
 
@@ -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) {
   ((Fl_Chart*)o)->maxsize(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) {
   ((Fl_Chart*)o)->textfont(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) {
     ((Fl_Counter*)o)->precision(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) {
     return ((Fl_Counter*)o)->value();}
 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());
 }
 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) {
   ((Fl_Dial*)o)->angles((short)a, (short)b);}
 //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"
-inline Fl_Free*
-fl_add_free(int t,double x,double y,double w,double h,const char* l,
-            FL_HANDLEPTR hdl) {
- return (Fl_Free*)(fl_add_new(
-   new Fl_Free(t,int(x),int(y),int(w),int(h),l,hdl)));
+inline Fl_Free* fl_add_free(int t,double x,double y,double w,double h,const char* l,
+                            FL_HANDLEPTR hdl) {
+  return (Fl_Free*)(fl_add_new(new Fl_Free((uchar)t,int(x),int(y),int(w),int(h),l,hdl)));
 }
 
 #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) {
     ((Fl_Input*)o)->value(v);}
 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) {
     ((Fl_Input*)o)->textcolor(a);
     ((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) {
     ((Fl_Positioner*)o)->ystep(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"
 
@@ -785,7 +798,8 @@ inline void fl_get_slider_bounds(Fl_Widget* o, float* a, float* b) {
   *b = float(((Fl_Slider*)o)->maximum());
 }
 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) {
     ((Fl_Slider*)o)->step(v);}
 // inline void fl_set_slider_increment(Fl_Widget* o, double v, double);
diff --git fluid/app/Snap_Action.h fluid/app/Snap_Action.h
index e555f9a..e5f4c99 100644
--- fluid/app/Snap_Action.h
+++ fluid/app/Snap_Action.h
@@ -188,7 +188,7 @@ public:
   Snap_Action() : ex(0x7fff), ey(0x7fff), dx(128), dy(128), type(0), mask(0) { }
   virtual ~Snap_Action() { }
   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);
 public:
   static int eex, eey;
diff --git fluid/nodes/Node.h fluid/nodes/Node.h
index 64d7202..a588223 100644
--- fluid/nodes/Node.h
+++ fluid/nodes/Node.h
@@ -240,8 +240,8 @@ public:
 
   virtual Node* click_test(int,int) { return nullptr; }
 
-  virtual void add_child(Node*, Node* beforethis) { }
-  virtual void move_child(Node*, Node* beforethis) { }
+  virtual void add_child(Node *, Node *beforethis) { (void)beforethis; }
+  virtual void move_child(Node *, Node *beforethis) { (void)beforethis; }
   virtual void remove_child(Node*) { }
 
   /** Give widgets a chance to arrange their children after all children were added.
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

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