Skip to content

Commit ce294f7

Browse files
author
fabien
committed
+ clean up more code warnings on int / float conversions, unused variables
+ fixed an initialization pb in fluid that could potentially lead to a crash if a node is not recognized git-svn-id: http://seriss.com/public/fltk/fltk/trunk@4882 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
1 parent 32e0de3 commit ce294f7

File tree

8 files changed

+18
-21
lines changed

8 files changed

+18
-21
lines changed

fluid/Fl_Function_Type.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,7 @@ void CommentType::open() {
827827
comment_in_header->value(in_h_ ? true : false);
828828
comment_panel_ok->callback(comment_ok_cb);
829829
comment_panel->show();
830-
const char* message = 0;
831830
char itempath[256]; itempath[0] = 0;
832-
int last_selected_item = 0;
833831

834832
do { // read events
835833
fltk::check();

fluid/factory.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ class TextDisplayType : public WidgetType {
377377
w -= fltk::box_dw(o->box());
378378
int ww = (int) fltk::getwidth("m");
379379
w = ((w + ww - 1) / ww) * ww + fltk::box_dw(o->box());
380-
h = ((h + fltk::getascent() - 1) / fltk::getascent() ) * fltk::getascent() +
381-
fltk::box_dh(o->box());
380+
h = (int) (((h + fltk::getascent() - 1) / fltk::getascent() ) * fltk::getascent() +
381+
fltk::box_dh(o->box()));
382382
if (h < 30) h = 30;
383383
if (w < 50) w = 50;
384384
}
@@ -417,8 +417,8 @@ class TextEditorType : public WidgetType {
417417
w -= fltk::box_dw(o->box());
418418
int ww = (int)fltk::getwidth("m");
419419
w = ((w + ww - 1) / ww) * ww + fltk::box_dw(o->box());
420-
h = ((h + fltk::getascent() - 1) / fltk::getascent()) * fltk::getascent() +
421-
fltk::box_dh(o->box());
420+
h = (int) (((h + fltk::getascent() - 1) / fltk::getascent()) * fltk::getascent() +
421+
fltk::box_dh(o->box()));
422422
if (h < 30) h = 30;
423423
if (w < 50) w = 50;
424424
}
@@ -600,7 +600,7 @@ int reading_file;
600600
// Recursive function for searching submenus:
601601
static FluidType *FluidType_make(const char *tn, fltk::ItemGroup * menu) {
602602
FluidType *r = 0;
603-
fltk::Item * m;
603+
fltk::Item * m=0;
604604
char menuName[128];
605605
int n;
606606

src/FileInput.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ FileInput::update_buttons() {
157157
//
158158
// 'FileInput::text()' - Set the string stored in the widget...
159159
//
160-
static int idbg=0;
161160

162161
int // O - TRUE on success
163162
FileInput::text(const char *str, // I - New string value

src/NumericInput.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,4 @@ int NumericInput::handle_arrow(int dir)
248248
}
249249
return 1;
250250
}
251-
// End of "$Id$".
251+
// End of "$Id$".

src/Window.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ bool Window::get_size_range( int *min_w, int *min_h, int *max_w, int *max_h )
304304
if ( min_h ) { *min_h = minh; }
305305
if ( max_w ) { *max_w = maxw; }
306306
if ( max_h ) { *max_h = maxh; }
307-
return bool( size_range_set );
307+
return size_range_set ? true : false;
308308
}
309309

310310
//+++ verify port to FLTK2

src/win32/run.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static inline int fl_wait(double time_to_wait) {
392392
fl_unlock_function();
393393
int t_msec =
394394
time_to_wait < 2147483.647 ? int(time_to_wait*1000+.5) : 0x7fffffff;
395-
int ret_val =
395+
// int ret_val =
396396
MsgWaitForMultipleObjects(0, NULL, false, t_msec, QS_ALLINPUT);
397397
fl_lock_function();
398398
in_main_thread_ = true;

test/arc.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// "$Id: arc.cxx,v 1.21 2005/01/27 08:50:41 spitzak Exp $"
2+
// "$Id$"
33
//
44
// Arc drawing test program for the Fast Light Tool Kit (FLTK).
55
//
@@ -49,16 +49,16 @@ class Drawing : public fltk::Widget {
4949
fltk::fillstrokepath(fltk::WHITE);
5050
// draw a hardware circle to see how well rotations match:
5151
fltk::setcolor(fltk::GRAY33);
52-
fltk::addchord(Rectangle(20,20,args[2]+1,args[3]+1),args[4],args[5]);
52+
fltk::addchord(Rectangle(20,20,(int)(args[2]+1),(int)(args[3]+1)),args[4],args[5]);
5353
fltk::fillstrokepath(fltk::WHITE);
5454
// now draw non-rotated hardware circle to check if it inscribes:
5555
fltk::pop_matrix();
5656
fltk::setcolor(fltk::GRAY40);
57-
fltk::fillrect(fltk::Rectangle(10,270-args[3],args[2],args[3]));
57+
fltk::fillrect(fltk::Rectangle(10,(int)(270-args[3]),(int)args[2],(int)args[3]));
5858
fltk::setcolor(fltk::GRAY90);
59-
fltk::strokerect(fltk::Rectangle(10,270-args[3],args[2],args[3]));
59+
fltk::strokerect(fltk::Rectangle(10,(int)(270-args[3]),(int) args[2],(int) args[3]));
6060
fltk::setcolor(fltk::GRAY10);
61-
fltk::addchord(fltk::Rectangle(10,270-args[3],args[2],args[3]),args[4],args[5]);
61+
fltk::addchord(fltk::Rectangle(10,(int) (270-args[3]),(int) args[2],(int)args[3]),args[4],args[5]);
6262
fltk::fillstrokepath(fltk::GRAY90);
6363
fltk::pop_clip();
6464
}
@@ -103,5 +103,5 @@ int main(int argc, char** argv) {
103103

104104

105105
//
106-
// End of "$Id: arc.cxx,v 1.21 2005/01/27 08:50:41 spitzak Exp $".
106+
// End of "$Id$".
107107
//

test/fonts.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// "$Id: fonts.cxx,v 1.33 2005/01/24 08:07:59 spitzak Exp $"
2+
// "$Id$"
33
//
44
// Font demo program for the Fast Light Tool Kit (FLTK).
55
//
@@ -50,7 +50,7 @@ void FontDisplay::draw() {
5050
fltk::push_clip(fltk::Rectangle(2,2,w()-2,h()-2));
5151
const char* saved_encoding = fltk::get_encoding();
5252
fltk::set_encoding(encoding);
53-
fltk::setfont(font, size);
53+
fltk::setfont(font, (float) size);
5454
id_box->label(fltk::Font::current_name());
5555
id_box->redraw();
5656
fltk::setcolor(fltk::BLACK);
@@ -109,7 +109,7 @@ void font_cb(fltk::Widget *, long) {
109109
int *s; int n = f->sizes(s);
110110
if (!n) {
111111
// no sizes (this only happens on X)
112-
fltk::setfont(f, pickedsize);
112+
fltk::setfont(f, (float) pickedsize);
113113
textobj->size = (int)fltk::getsize();
114114
} else if (s[0] == 0) {
115115
// many sizes;
@@ -208,5 +208,5 @@ int main(int argc, char **argv) {
208208
}
209209

210210
//
211-
// End of "$Id: fonts.cxx,v 1.33 2005/01/24 08:07:59 spitzak Exp $".
211+
// End of "$Id$".
212212
//

0 commit comments

Comments
 (0)