From 020a96b4a89e5d9e38170a28bb9848519060bdca Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 5 Apr 2016 21:15:45 +0000 Subject: Fix more compiler warnings. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11536 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl.H | 2 ++ fluid/CodeEditor.cxx | 2 +- src/Fl_PNG_Image.cxx | 2 +- src/Fl_Slider.cxx | 2 +- src/Fl_win32.cxx | 6 +++--- test/CMakeLists.txt | 2 +- test/sudoku.cxx | 6 +++--- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/FL/Fl.H b/FL/Fl.H index 990847125..e285d8ed5 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -23,6 +23,8 @@ #ifndef Fl_H # define Fl_H +#include + #include // for FL_SOCKET #ifdef FLTK_HAVE_CAIRO # include diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx index f262f70dd..e4fbc57f2 100644 --- a/fluid/CodeEditor.cxx +++ b/fluid/CodeEditor.cxx @@ -432,7 +432,7 @@ void CodeViewer::draw() { // Tricking Fl_Text_Display into using bearable colors for this specific task Fl_Color c = Fl::get_color(FL_SELECTION_COLOR); - Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9)); + Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f)); CodeEditor::draw(); Fl::set_color(FL_SELECTION_COLOR, c); } diff --git a/src/Fl_PNG_Image.cxx b/src/Fl_PNG_Image.cxx index 0183e82a5..1d94e9803 100644 --- a/src/Fl_PNG_Image.cxx +++ b/src/Fl_PNG_Image.cxx @@ -115,7 +115,7 @@ void Fl_PNG_Image::load_png_(const char *name_png, const unsigned char *buffer_p FILE *fp = NULL; // File pointer int channels; // Number of color channels png_structp pp; // PNG read pointer - png_infop info; // PNG info pointers + png_infop info = 0; // PNG info pointers png_bytep *rows;// PNG row pointers fl_png_memory png_mem_data; int from_memory = (buffer_png != NULL); // true if reading image from memory diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx index 705dc9692..e5f32ef01 100644 --- a/src/Fl_Slider.cxx +++ b/src/Fl_Slider.cxx @@ -269,7 +269,7 @@ int Fl_Slider::handle(int event, int X, int Y, int W, int H) { } int xx = mx-offcenter; - double v; + double v = 0; char tryAgain = 1; while (tryAgain) { diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 8d7e220a1..33addd3f2 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -738,7 +738,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type) { } else if (strcmp(type, Fl::clipboard_image) == 0) { // we want an image from clipboard uchar *rgb = NULL; - int width, height, depth; + int width = 0, height = 0, depth = 0; if ( (h = GetClipboardData(CF_DIB)) ) { // if there's a DIB in clipboard LPBITMAPINFO lpBI = (LPBITMAPINFO)GlobalLock(h) ; width = lpBI->bmiHeader.biWidth; // bitmap width & height @@ -1481,7 +1481,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar static int fake_X_wm_style(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by, DWORD style, DWORD styleEx, int w_maxw, int w_minw, int w_maxh, int w_minh, uchar w_size_range_set) { - int W, H, xoff, yoff, dx, dy; + int W = 0, H = 0, xoff = 0, yoff = 0, dx = 0, dy = 0; int ret = bx = by = bt = 0; int fallback = 1; @@ -1558,7 +1558,7 @@ static int fake_X_wm_style(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, in //Proceed to positioning the window fully inside the screen, if possible //Find screen that contains most of the window //FIXME: this ought to be the "work area" instead of the entire screen ! - int scr_x, scr_y, scr_w, scr_h; + int scr_x = 0, scr_y = 0, scr_w = 0, scr_h = 0; Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y, W, H); //Make border's lower right corner visible if (scr_x+scr_w < X+W) X = scr_x+scr_w - W; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 08a5cbcd6..fbef50b53 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,7 +33,7 @@ CREATE_EXAMPLE(colbrowser colbrowser.cxx "fltk;fltk_forms") CREATE_EXAMPLE(color_chooser color_chooser.cxx fltk) CREATE_EXAMPLE(cursor cursor.cxx fltk) CREATE_EXAMPLE(curve curve.cxx fltk) -CREATE_EXAMPLE(demo demo.cxx "fltk;fltk_forms") +CREATE_EXAMPLE(demo demo.cxx fltk) CREATE_EXAMPLE(device device.cxx fltk) CREATE_EXAMPLE(doublebuffer doublebuffer.cxx fltk) CREATE_EXAMPLE(editor editor.cxx fltk) diff --git a/test/sudoku.cxx b/test/sudoku.cxx index d517fa6ee..51004dc59 100644 --- a/test/sudoku.cxx +++ b/test/sudoku.cxx @@ -1029,7 +1029,7 @@ Sudoku::load_game() { sprintf(name, "readonly%d.%d", j, k); prefs_.get(name, val, 0); - cell->readonly(val); + cell->readonly(val != 0); if (val) cell->color(FL_GRAY); else { @@ -1090,7 +1090,7 @@ Sudoku::new_game(time_t seed) { // Generate a new (valid) Sudoku grid... seed_ = seed; - srand(seed); + srand((unsigned int)seed); memset(grid_values_, 0, sizeof(grid_values_)); @@ -1181,7 +1181,7 @@ Sudoku::new_game(time_t seed) { // Return the next available value for a cell... int Sudoku::next_value(SudokuCell *c) { - int j, k, m, n; + int j = 0, k = 0, m = 0, n = 0; for (j = 0; j < 9; j ++) { -- cgit v1.2.3