diff options
34 files changed, 279 insertions, 267 deletions
diff --git a/configure.in b/configure.in index c7c45fc2c..17a14250f 100644 --- a/configure.in +++ b/configure.in @@ -887,7 +887,7 @@ if test -n "$GCC"; then OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM" # The following additional warnings are useful for tracking down problems... - #OPTIM="-Wshadow -Wconversion $OPTIM" + OPTIM="-Wshadow -Wconversion $OPTIM" # Set the default compiler optimizations... if test -z "$DEBUGFLAG"; then diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx index 3e6c8e3d6..27a233476 100644 --- a/fluid/Fl_Group_Type.cxx +++ b/fluid/Fl_Group_Type.cxx @@ -230,7 +230,7 @@ void Fl_Group_Type::move_child(Fl_Type* cc, Fl_Type* before) { //////////////////////////////////////////////////////////////// // live mode support -Fl_Widget *Fl_Group_Type::enter_live_mode(int top) { +Fl_Widget *Fl_Group_Type::enter_live_mode(int) { Fl_Group *grp = new Fl_Group(o->x(), o->y(), o->w(), o->h()); live_widget = grp; if (live_widget) { @@ -245,7 +245,7 @@ Fl_Widget *Fl_Group_Type::enter_live_mode(int top) { return live_widget; } -Fl_Widget *Fl_Tabs_Type::enter_live_mode(int top) { +Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) { Fl_Tabs *grp = new Fl_Tabs(o->x(), o->y(), o->w(), o->h()); live_widget = grp; if (live_widget) { @@ -278,7 +278,7 @@ void Fl_Group_Type::copy_properties() { const char scroll_type_name[] = "Fl_Scroll"; -Fl_Widget *Fl_Scroll_Type::enter_live_mode(int top) { +Fl_Widget *Fl_Scroll_Type::enter_live_mode(int) { Fl_Group *grp = new Fl_Scroll(o->x(), o->y(), o->w(), o->h()); grp->show(); live_widget = grp; diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index 75be910f4..6754de395 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -848,7 +848,7 @@ int Fl_Type::read_fdesign(const char*, const char*) {return 0;} * \return a widget pointer that the live mode initiator can 'show()' * \see leave_live_mode() */ -Fl_Widget *Fl_Type::enter_live_mode(int top) { +Fl_Widget *Fl_Type::enter_live_mode(int) { return 0L; } diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 087297752..68512cb54 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1689,7 +1689,7 @@ void overlay_cb(Fl_Button*o,void *v) { void leave_live_mode_cb(Fl_Widget*, void*); -void live_mode_cb(Fl_Button*o,void *v) { +void live_mode_cb(Fl_Button*o,void *) { /// \todo live mode should end gracefully when the application quits /// or when the user closes the live widget static Fl_Type *live_type = 0L; @@ -2620,7 +2620,7 @@ void leave_live_mode_cb(Fl_Widget*, void*) { live_mode_cb(0, 0); } -Fl_Widget *Fl_Widget_Type::enter_live_mode(int top) { +Fl_Widget *Fl_Widget_Type::enter_live_mode(int) { live_widget = widget(o->x(), o->y(), o->w(), o->h()); if (live_widget) copy_properties(); diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index f43a14929..117d180de 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -1482,7 +1482,7 @@ void Fl_Widget_Class_Type::write_code2() { //////////////////////////////////////////////////////////////// // live mode support -Fl_Widget *Fl_Window_Type::enter_live_mode(int top) { +Fl_Widget *Fl_Window_Type::enter_live_mode(int) { Fl_Window *win = new Fl_Window(o->x(), o->y(), o->w(), o->h()); live_widget = win; if (live_widget) { diff --git a/fluid/align_widget.cxx b/fluid/align_widget.cxx index 5d44028fd..7b3d8b50f 100644 --- a/fluid/align_widget.cxx +++ b/fluid/align_widget.cxx @@ -521,7 +521,7 @@ void widget_size_cb(Fl_Widget *, long size) { } Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->labelsize(size); + w->labelsize((uchar)size); Fl_Font f; int s = (int)size; Fl_Color c; diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx index 78d4bb714..36cb1e716 100644 --- a/fluid/function_panel.cxx +++ b/fluid/function_panel.cxx @@ -483,7 +483,7 @@ Fl_Double_Window* make_comment_panel() { return comment_panel; } -void type_make_cb(Fl_Widget*w,void*d) { +void type_make_cb(Fl_Widget*,void*d) { undo_checkpoint(); Fl_Type *t = Fl_Type_make((char*)d); if (t) { @@ -499,7 +499,7 @@ void type_make_cb(Fl_Widget*w,void*d) { Fl_Window *widgetbin_panel=(Fl_Window *)0; Fl_Window* make_widgetbin() { - { widgetbin_panel = new Fl_Window(551, 85, "Widget Bin"); + { widgetbin_panel = new Fl_Window(550, 85, "Widget Bin"); widgetbin_panel->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE); { Fl_Group* o = new Fl_Group(3, 3, 79, 79); { Fl_Button* o = new Fl_Button(5, 5, 24, 24); diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl index 772730d37..79c809a6a 100644 --- a/fluid/function_panel.fl +++ b/fluid/function_panel.fl @@ -125,7 +125,7 @@ Function {make_code_panel()} {open Function {make_codeblock_panel()} {open } { Fl_Window codeblock_panel { - label {Code Block Properties} + label {Code Block Properties} selected xywh {468 221 300 115} type Double labelsize 11 hide resizable code0 {o->size_range(o->w(), o->h(), Fl::w(), o->h());} modal } { @@ -339,7 +339,7 @@ Function {make_comment_panel()} {open } } -Function {type_make_cb(Fl_Widget*w,void*d)} {open return_type void +Function {type_make_cb(Fl_Widget*,void*d)} {open return_type void } { code {undo_checkpoint(); Fl_Type *t = Fl_Type_make((char*)d); @@ -356,8 +356,8 @@ Function {type_make_cb(Fl_Widget*w,void*d)} {open return_type void Function {make_widgetbin()} {open } { Fl_Window widgetbin_panel { - label {Widget Bin} selected - xywh {411 171 551 85} type Single align 80 non_modal visible + label {Widget Bin} + xywh {411 171 550 85} type Single align 80 non_modal visible } { Fl_Group {} { xywh {3 3 79 79} diff --git a/fluid/function_panel.h b/fluid/function_panel.h index 9d7f8d996..08740183d 100644 --- a/fluid/function_panel.h +++ b/fluid/function_panel.h @@ -88,7 +88,7 @@ extern Fl_Light_Button *comment_in_header; extern Fl_Menu_Button *comment_predefined; extern Fl_Button *comment_load; Fl_Double_Window* make_comment_panel(); -void type_make_cb(Fl_Widget*w,void*d); +void type_make_cb(Fl_Widget*,void*d); #include <FL/Fl_Window.H> extern Fl_Window *widgetbin_panel; extern void type_make_cb(Fl_Button*, void*); diff --git a/src/Fl_GIF_Image.cxx b/src/Fl_GIF_Image.cxx index e40a9d218..9666896cd 100644 --- a/src/Fl_GIF_Image.cxx +++ b/src/Fl_GIF_Image.cxx @@ -153,7 +153,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { char bits; bits = NEXTBYTE; - char junk = NEXTBYTE; junk = NEXTBYTE; // GETSHORT(delay); + getc(GifFile); getc(GifFile); // GETSHORT(delay); transparent_pixel = NEXTBYTE; if (bits & 1) has_transparent = 1; blocklen = NEXTBYTE; diff --git a/src/Fl_JPEG_Image.cxx b/src/Fl_JPEG_Image.cxx index a3eda8498..13889000a 100644 --- a/src/Fl_JPEG_Image.cxx +++ b/src/Fl_JPEG_Image.cxx @@ -79,12 +79,10 @@ extern "C" { static void fl_jpeg_error_handler(j_common_ptr dinfo) { // I - Decompressor info longjmp(((fl_jpeg_error_mgr *)(dinfo->err))->errhand_, 1); - return; } static void - fl_jpeg_output_handler(j_common_ptr dinfo) { // I - Decompressor info - return; + fl_jpeg_output_handler(j_common_ptr) { // I - Decompressor info (not used) } } #endif // HAVE_LIBJPEG diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx index 4ee2dc786..22a05c84b 100644 --- a/src/Fl_Scrollbar.cxx +++ b/src/Fl_Scrollbar.cxx @@ -139,7 +139,6 @@ int Fl_Scrollbar::handle(int event) { handle_drag(clamp(value() + linesize_ * Fl::e_dy)); return 1; } - break; case FL_SHORTCUT: case FL_KEYBOARD: { int v = value(); diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 26bfd45b4..61c401d19 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1148,7 +1148,7 @@ int Fl_Text_Display::rewind_lines(int startPos, int nLines) { return buf->rewind_lines(startPos, nLines); pos = startPos; - while (true) { + for (;;) { lineStart = buf->line_start(pos); wrapped_line_counter(buf, lineStart, pos, INT_MAX, true, 0, &retPos, &retLines, &retLineStart, &retLineEnd, false); @@ -2255,7 +2255,7 @@ void Fl_Text_Display::h_scrollbar_cb(Fl_Scrollbar* b, Fl_Text_Display* textD) { ** stray marks outside of the character cell area, which might have been ** left from before a resize or font change. */ -void Fl_Text_Display::draw_line_numbers(bool clearAll) { +void Fl_Text_Display::draw_line_numbers(bool /*clearAll*/) { #if 0 // FIXME: don't want this yet, so will leave for another time @@ -2447,7 +2447,7 @@ void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos, */ lineStart = countFrom; *modRangeStart = countFrom; - while (true) { + for (;;) { /* advance to the next line. If the line ended in a real newline or the end of the buffer, that's far enough */ @@ -2595,7 +2595,7 @@ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) { ** line starts to re-sync with the original line starts array */ lineStart = countFrom; - while (true) { + for (;;) { /* advance to the next line. If the line ended in a real newline or the end of the buffer, that's far enough */ wrapped_line_counter(buf, lineStart, buf->length(), 1, true, 0, diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index acba0be7d..0eb407158 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -60,7 +60,7 @@ public: Fl_Widget* Fl_Tooltip::widget_ = 0; static Fl_TooltipBox *window = 0; -static int X,Y,W,H; +static int Y,H; void Fl_TooltipBox::layout() { fl_font(Fl_Tooltip::font(), Fl_Tooltip::size()); @@ -71,10 +71,8 @@ void Fl_TooltipBox::layout() { // find position on the screen of the widget: int ox = Fl::event_x_root(); - //int ox = X+W/2; int oy = Y + H+2; for (Fl_Widget* p = Fl_Tooltip::current(); p; p = p->window()) { - //ox += p->x(); oy += p->y(); } int scr_x, scr_y, scr_w, scr_h; @@ -224,7 +222,7 @@ Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t) Fl::remove_timeout(tooltip_timeout); Fl::remove_timeout(recent_timeout); // remember it: - widget_ = wid; X = x; Y = y; W = w; H = h; tip = t; + widget_ = wid; Y = y; H = h; tip = t; // popup the tooltip immediately if it was recently up: if (recent_tooltip) { if (window) window->hide(); diff --git a/src/fl_call_main.c b/src/fl_call_main.c index e29f5853e..563d9652b 100644 --- a/src/fl_call_main.c +++ b/src/fl_call_main.c @@ -48,26 +48,26 @@ #if defined(WIN32) && !defined(FL_DLL) && !defined (__GNUC__) -#include <windows.h> -#include <stdio.h> -#include <stdlib.h> +# include <windows.h> +# include <stdio.h> +# include <stdlib.h> -#ifdef __MWERKS__ -# include <crtl.h> -#endif +# ifdef __MWERKS__ +# include <crtl.h> +# endif extern int main(int, char *[]); -#ifdef BORLAND5 -# define __argc _argc -# define __argv _argv -#endif +# ifdef BORLAND5 +# define __argc _argc +# define __argv _argv +# endif /* BORLAND5 */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int rc; -#ifdef _DEBUG +# ifdef _DEBUG /* * If we are using compiling in debug mode, open a console window so * we can see any printf's, etc... @@ -82,24 +82,24 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, freopen("conin$", "r", stdin); freopen("conout$", "w", stdout); freopen("conout$", "w", stderr); -#endif /* _DEBUG */ +# endif /* _DEBUG */ /* Run the standard main entry point function... */ rc = main(__argc, __argv); -#ifdef _DEBUG +# ifdef _DEBUG fclose(stdin); fclose(stdout); fclose(stderr); -#endif /* _DEBUG */ +# endif /* _DEBUG */ return rc; } -#else +#elif defined(__future_compiler_test) /* This code to prevent "empty translation unit" or similar warnings... */ static void dummy(void) {} -#endif +#endif // WIN32 && !FL_DLL && !__GNUC__ /* * End of "$Id$". diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index 21f6f0856..7caf95e0b 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -69,7 +69,7 @@ void fl_register_images() { Fl_Image * // O - Image, if found fl_check_images(const char *name, // I - Filename uchar *header, // I - Header data from file - int headerlen) { // I - Amount of data + int) { // I - Amount of data (not used) if (memcmp(header, "GIF87a", 6) == 0 || memcmp(header, "GIF89a", 6) == 0) // GIF file return new Fl_GIF_Image(name); diff --git a/src/freeglut_stroke_mono_roman.cxx b/src/freeglut_stroke_mono_roman.cxx index 61d186274..f26289ba2 100644 --- a/src/freeglut_stroke_mono_roman.cxx +++ b/src/freeglut_stroke_mono_roman.cxx @@ -2845,4 +2845,4 @@ static const Fl_Glut_StrokeChar *chars[] = &ch120, &ch121, &ch122, &ch123, &ch124, &ch125, &ch126, &ch127 }; -Fl_Glut_StrokeFont glutStrokeMonoRoman = {"MonoRoman",128,152.381f,chars}; +Fl_Glut_StrokeFont glutStrokeMonoRoman = {(char *)"MonoRoman",128,152.381f,chars}; diff --git a/src/freeglut_stroke_roman.cxx b/src/freeglut_stroke_roman.cxx index b6cf398ad..deda2d05d 100644 --- a/src/freeglut_stroke_roman.cxx +++ b/src/freeglut_stroke_roman.cxx @@ -2845,4 +2845,4 @@ static const Fl_Glut_StrokeChar *chars[] = &ch120, &ch121, &ch122, &ch123, &ch124, &ch125, &ch126, &ch127 }; -Fl_Glut_StrokeFont glutStrokeRoman = {"Roman",128,152.381f,chars}; +Fl_Glut_StrokeFont glutStrokeRoman = {(char *)"Roman",128,152.381f,chars}; diff --git a/src/glut_compatability.cxx b/src/glut_compatability.cxx index 52bedf12a..8fe7ca900 100644 --- a/src/glut_compatability.cxx +++ b/src/glut_compatability.cxx @@ -106,7 +106,6 @@ int Fl_Glut_Window::handle(int event) { while (button < 0) {mouse(3,GLUT_DOWN,ex,ey); ++button;} while (button > 0) {mouse(4,GLUT_DOWN,ex,ey); --button;} return 1; - break; case FL_RELEASE: for (button = 0; button < 3; button++) if (mouse_down & (1<<button)) { diff --git a/src/screen_xywh.cxx b/src/screen_xywh.cxx index c38a7ec96..67694ca4c 100644 --- a/src/screen_xywh.cxx +++ b/src/screen_xywh.cxx @@ -201,6 +201,9 @@ void Fl::screen_xywh(int &x, int &y, int &w, int &h, int mx, int my) { } } } +#else + (void)mx; + (void)my; #endif // WIN32 x = Fl::x(); @@ -237,6 +240,8 @@ void Fl::screen_xywh(int &x, int &y, int &w, int &h, int n) { h = screens[n].height; return; } +#else + (void)n; #endif // WIN32 x = Fl::x(); diff --git a/src/vsnprintf.c b/src/vsnprintf.c index 8d1752b91..184e1ed24 100644 --- a/src/vsnprintf.c +++ b/src/vsnprintf.c @@ -3,7 +3,7 @@ * * snprintf() and vsnprintf() functions for the Fast Light Tool Kit (FLTK). * - * Copyright 1998-2005 by Bill Spitzak and others. + * Copyright 1998-2007 by Bill Spitzak and others. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -108,6 +108,8 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { } } else prec = -1; + size = '\0'; + if (*format == 'l' && format[1] == 'l') { size = 'L'; if (tptr < (tformat + sizeof(tformat) - 2)) { @@ -159,7 +161,15 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { case 'x' : if ((width + 2) > sizeof(temp)) break; - sprintf(temp, tformat, va_arg(ap, int)); +#ifdef HAVE_LONg_LONG + if (size == 'L') + sprintf(temp, tformat, va_arg(ap, long long)); + else +#endif /* HAVE_LONG_LONG */ + if (size == 'l') + sprintf(temp, tformat, va_arg(ap, long)); + else + sprintf(temp, tformat, va_arg(ap, int)); bytes += strlen(temp); diff --git a/test/blocks.cxx b/test/blocks.cxx index 2ae7bbf79..4aa9e1c76 100644 --- a/test/blocks.cxx +++ b/test/blocks.cxx @@ -383,11 +383,13 @@ BlockSound::play_explosion(float duration) { if (duration <= 0.0) return; +#if defined(__APPLE_) || defined(WIN32) || defined(HAVE_ALSA_ASOUNDLIB_H) if (duration > 1.0) duration = 1.0; int samples = (int)(duration * sample_size); short *sample_ptr = sample_data + 2 * (sample_size - samples); +#endif // __APPLE__ || WIN32 || HAVE_ALSA_ASOUNDLIB_H #ifdef __APPLE__ // Point to the next note... @@ -540,7 +542,7 @@ BlockWindow::_BlockWindow() { // Bomb all blocks of a given color and return the number of affected blocks int BlockWindow::bomb(int color) { - int i, j; + int j, k; int count; Block *b; Column *c; @@ -548,8 +550,8 @@ BlockWindow::bomb(int color) { if (color >= BLOCK_BLAST) return (0); - for (i = num_columns_, c = columns_, count = 1; i > 0; i --, c ++) - for (j = c->num_blocks, b = c->blocks; j > 0; j --, b ++) + for (j = num_columns_, c = columns_, count = 1; j > 0; j --, c ++) + for (k = c->num_blocks, b = c->blocks; k > 0; k --, b ++) if (b->color == color) { b->color = -color; count ++; @@ -607,7 +609,7 @@ BlockWindow::click(int col, int row) { // Draw the block window... void BlockWindow::draw() { - int i, j, xx, yy; + int j, k, xx, yy; Block *b; Column *c; @@ -617,8 +619,8 @@ BlockWindow::draw() { fl_rectf(0, 0, w(), h()); // Draw the blocks... - for (i = num_columns_, c = columns_; i > 0; i --, c ++) - for (j = c->num_blocks, b = c->blocks; j > 0; j --, b ++) { + for (j = num_columns_, c = columns_; j > 0; j --, c ++) + for (k = c->num_blocks, b = c->blocks; k > 0; k --, b ++) { xx = w() - c->x; yy = h() - BLOCK_SIZE - b->y; @@ -723,7 +725,7 @@ BlockWindow::draw() { // Handle mouse clicks, etc. int BlockWindow::handle(int event) { - int i, j, mx, my, count; + int j, k, mx, my, count; Block *b; Column *c; @@ -736,20 +738,21 @@ BlockWindow::handle(int event) { mx = w() - Fl::event_x() + BLOCK_SIZE; my = h() - Fl::event_y(); count = 0; + b = c->blocks; - for (i = 0, c = columns_; !count && i < num_columns_; i ++, c ++) - for (j = 0, b = c->blocks; !count && j < c->num_blocks; j ++, b ++) + for (j = 0, c = columns_; !count && j < num_columns_; j ++, c ++) + for (k = 0, b = c->blocks; !count && k < c->num_blocks; k ++, b ++) if (mx >= c->x && mx < (c->x + BLOCK_SIZE) && my >= b->y && my < (b->y + BLOCK_SIZE)) { if (b->bomb) count = bomb(b->color); - else count = click(i, j); + else count = click(j, k); break; } if (count < 2) { - for (i = 0, c = columns_; i < num_columns_; i ++, c ++) - for (j = 0, b = c->blocks; j < c->num_blocks; j ++, b ++) + for (j = 0, c = columns_; j < num_columns_; j ++, c ++) + for (k = 0, b = c->blocks; k < c->num_blocks; k ++, b ++) if (b->color < 0) b->color = -b->color; } else { count --; @@ -771,8 +774,8 @@ BlockWindow::handle(int event) { prefs_.set("high_score", high_score_); } - for (i = 0, c = columns_; i < num_columns_; i ++, c ++) - for (j = 0, b = c->blocks; j < c->num_blocks; j ++, b ++) + for (j = 0, c = columns_; j < num_columns_; j ++, c ++) + for (k = 0, b = c->blocks; k < c->num_blocks; k ++, b ++) if (b->color < 0) b->color = BLOCK_BLAST; } return (1); @@ -784,7 +787,7 @@ BlockWindow::handle(int event) { // Toggle the on-line help... void -BlockWindow::help_cb(Fl_Widget *wi, BlockWindow *bw) { +BlockWindow::help_cb(Fl_Widget *, BlockWindow *bw) { bw->paused_ = bw->help_ = !bw->help_; bw->play_button_->label("@>"); bw->redraw(); diff --git a/test/browser.cxx b/test/browser.cxx index e2fcdb672..da6babd58 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -104,7 +104,7 @@ void show_cb(Fl_Widget *o, void *) { browser->make_visible(line); } -void swap_cb(Fl_Widget *o, void *) { +void swap_cb(Fl_Widget *, void *) { int a = -1, b = -1; for ( int t=0; t<browser->size(); t++ ) { // find two selected items if ( browser->selected(t) ) { diff --git a/test/file_chooser.cxx b/test/file_chooser.cxx index 847156f04..c8dfc7cf9 100644 --- a/test/file_chooser.cxx +++ b/test/file_chooser.cxx @@ -211,7 +211,7 @@ multi_callback(void) Fl_Image * // O - Page image or NULL pdf_check(const char *name, // I - Name of file uchar *header, // I - Header data - int headerlen) // I - Length of header data + int) // I - Length of header data (unused) { const char *home; // Home directory char preview[1024], // Preview filename @@ -242,7 +242,7 @@ pdf_check(const char *name, // I - Name of file Fl_Image * // O - Page image or NULL ps_check(const char *name, // I - Name of file uchar *header, // I - Header data - int headerlen) // I - Length of header data + int) // I - Length of header data (unused) { const char *home; // Home directory char preview[1024], // Preview filename diff --git a/test/fractals.cxx b/test/fractals.cxx index 46d1fcb94..c0238f40b 100644 --- a/test/fractals.cxx +++ b/test/fractals.cxx @@ -737,28 +737,28 @@ void MenuInit(void) int submenu3, submenu2, submenu1; submenu1 = glutCreateMenu(setlevel); - glutAddMenuEntry("0", 0); glutAddMenuEntry("1", 1); - glutAddMenuEntry("2", 2); glutAddMenuEntry("3", 3); - glutAddMenuEntry("4", 4); glutAddMenuEntry("5", 5); - glutAddMenuEntry("6", 6); glutAddMenuEntry("7", 7); - glutAddMenuEntry("8", 8); + glutAddMenuEntry((char *)"0", 0); glutAddMenuEntry((char *)"1", 1); + glutAddMenuEntry((char *)"2", 2); glutAddMenuEntry((char *)"3", 3); + glutAddMenuEntry((char *)"4", 4); glutAddMenuEntry((char *)"5", 5); + glutAddMenuEntry((char *)"6", 6); glutAddMenuEntry((char *)"7", 7); + glutAddMenuEntry((char *)"8", 8); submenu2 = glutCreateMenu(choosefract); - glutAddMenuEntry("Moutain", MOUNTAIN); - glutAddMenuEntry("Tree", TREE); - glutAddMenuEntry("Island", ISLAND); + glutAddMenuEntry((char *)"Moutain", MOUNTAIN); + glutAddMenuEntry((char *)"Tree", TREE); + glutAddMenuEntry((char *)"Island", ISLAND); submenu3 = glutCreateMenu(agvSwitchMoveMode); - glutAddMenuEntry("Flying", FLYING); - glutAddMenuEntry("Polar", POLAR); + glutAddMenuEntry((char *)"Flying", FLYING); + glutAddMenuEntry((char *)"Polar", POLAR); glutCreateMenu(handlemenu); - glutAddSubMenu("Level", submenu1); - glutAddSubMenu("Fractal", submenu2); - glutAddSubMenu("Movement", submenu3); - glutAddMenuEntry("New Fractal", MENU_RAND); - glutAddMenuEntry("Toggle Axes", MENU_AXES); - glutAddMenuEntry("Quit", MENU_QUIT); + glutAddSubMenu((char *)"Level", submenu1); + glutAddSubMenu((char *)"Fractal", submenu2); + glutAddSubMenu((char *)"Movement", submenu3); + glutAddMenuEntry((char *)"New Fractal", MENU_RAND); + glutAddMenuEntry((char *)"Toggle Axes", MENU_AXES); + glutAddMenuEntry((char *)"Quit", MENU_QUIT); glutAttachMenu(GLUT_RIGHT_BUTTON); } diff --git a/test/fullscreen.cxx b/test/fullscreen.cxx index a37883d6d..e4a70d1bf 100644 --- a/test/fullscreen.cxx +++ b/test/fullscreen.cxx @@ -91,8 +91,8 @@ void shape_window::draw() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(.5,.6,.7); glBegin(GL_POLYGON); - for (int i=0; i<sides; i++) { - double ang = i*2*M_PI/sides; + for (int j = 0; j < sides; j ++) { + double ang = j*2*M_PI/sides; glVertex3f(cos(ang),sin(ang),0); } glEnd(); diff --git a/test/gl_overlay.cxx b/test/gl_overlay.cxx index d6584b01c..c877ecbc1 100644 --- a/test/gl_overlay.cxx +++ b/test/gl_overlay.cxx @@ -72,9 +72,9 @@ void shape_window::draw() { glClear(GL_COLOR_BUFFER_BIT); // for (int j=1; j<=1000; j++) { glBegin(GL_POLYGON); - for (int i=0; i<sides; i++) { - double ang = i*2*M_PI/sides; - glColor3f(float(i)/sides,float(i)/sides,float(i)/sides); + for (int j=0; j<sides; j++) { + double ang = j*2*M_PI/sides; + glColor3f(float(j)/sides,float(j)/sides,float(j)/sides); glVertex3f(cos(ang),sin(ang),0); } glEnd(); @@ -92,8 +92,8 @@ void shape_window::draw_overlay() { // draw an amazing graphic: gl_color(FL_RED); glBegin(GL_LINE_LOOP); - for (int i=0; i<overlay_sides; i++) { - double ang = i*2*M_PI/overlay_sides; + for (int j=0; j<overlay_sides; j++) { + double ang = j*2*M_PI/overlay_sides; glVertex3f(cos(ang),sin(ang),0); } glEnd(); diff --git a/test/glpuzzle.cxx b/test/glpuzzle.cxx index 6df075749..7aada84f3 100644 --- a/test/glpuzzle.cxx +++ b/test/glpuzzle.cxx @@ -721,7 +721,7 @@ continueSolving(void) } } } - glutSetWindowTitle("What! No change?"); + glutSetWindowTitle((char *)"What! No change?"); freeSolutions(); return 0; @@ -755,7 +755,7 @@ solvePuzzle(void) int i; if (solution(thePuzzle)) { - glutSetWindowTitle("Puzzle already solved!"); + glutSetWindowTitle((char *)"Puzzle already solved!"); return 0; } addConfig(thePuzzle, NULL); @@ -1147,12 +1147,12 @@ toggleSolve(void) if (solving) { freeSolutions(); solving = 0; - glutChangeToMenuEntry(1, "Solving", 1); - glutSetWindowTitle("glpuzzle"); + glutChangeToMenuEntry(1, (char *)"Solving", 1); + glutSetWindowTitle((char *)"glpuzzle"); movingPiece = 0; } else { - glutChangeToMenuEntry(1, "Stop solving", 1); - glutSetWindowTitle("Solving..."); + glutChangeToMenuEntry(1, (char *)"Stop solving", 1); + glutSetWindowTitle((char *)"Solving..."); if (solvePuzzle()) { solving = 1; } @@ -1166,8 +1166,8 @@ void reset(void) if (solving) { freeSolutions(); solving = 0; - glutChangeToMenuEntry(1, "Solving", 1); - glutSetWindowTitle("glpuzzle"); + glutChangeToMenuEntry(1, (char *)"Solving", 1); + glutSetWindowTitle((char *)"glpuzzle"); movingPiece = 0; changeState(); } @@ -1189,8 +1189,8 @@ keyboard(unsigned char c, int x, int y) if (solving) { freeSolutions(); solving = 0; - glutChangeToMenuEntry(1, "Solving", 1); - glutSetWindowTitle("glpuzzle"); + glutChangeToMenuEntry(1, (char *)"Solving", 1); + glutSetWindowTitle((char *)"glpuzzle"); movingPiece = 0; changeState(); } @@ -1264,8 +1264,8 @@ mouse(int b, int s, int x, int y) if (solving) { freeSolutions(); solving = 0; - glutChangeToMenuEntry(1, "Solving", 1); - glutSetWindowTitle("glpuzzle"); + glutChangeToMenuEntry(1, (char *)"Solving", 1); + glutSetWindowTitle((char *)"glpuzzle"); movingPiece = 0; } left_mouse = GL_TRUE; @@ -1306,8 +1306,8 @@ animate(void) if (solving) { if (!continueSolving()) { solving = 0; - glutChangeToMenuEntry(1, "Solving", 1); - glutSetWindowTitle("glpuzzle"); + glutChangeToMenuEntry(1, (char *)"Solving", 1); + glutSetWindowTitle((char *)"glpuzzle"); } } if ((!solving && !spinning) || !visible) { @@ -1388,8 +1388,8 @@ init(void) static void Usage(void) { - printf("Usage: puzzle [-s]\n"); - printf(" -s: Run in single buffered mode\n"); + puts("Usage: puzzle [-s]"); + puts(" -s: Run in single buffered mode"); exit(-1); } @@ -1454,15 +1454,15 @@ main(int argc, char **argv) glGetIntegerv(GL_VIEWPORT, viewport); - printf("\n"); - printf("r Reset puzzle\n"); - printf("s Solve puzzle (may take a few seconds to compute)\n"); - printf("d Destroy a piece - makes the puzzle easier\n"); - printf("b Toggles the depth buffer on and off\n"); - printf("\n"); - printf("Left mouse moves pieces\n"); - printf("Middle mouse spins the puzzle\n"); - printf("Right mouse has menu\n"); + puts(""); + puts("r Reset puzzle"); + puts("s Solve puzzle (may take a few seconds to compute)"); + puts("d Destroy a piece - makes the puzzle easier"); + puts("b Toggles the depth buffer on and off"); + puts(""); + puts("Left mouse moves pieces"); + puts("Middle mouse spins the puzzle"); + puts("Right mouse has menu"); glutReshapeFunc(Reshape); glutDisplayFunc(redraw); @@ -1471,9 +1471,9 @@ main(int argc, char **argv) glutMouseFunc(mouse); glutVisibilityFunc(visibility); glutCreateMenu(menu); - glutAddMenuEntry("Solve", 1); - glutAddMenuEntry("Reset", 2); - glutAddMenuEntry("Quit", 3); + glutAddMenuEntry((char *)"Solve", 1); + glutAddMenuEntry((char *)"Reset", 2); + glutAddMenuEntry((char *)"Quit", 3); glutAttachMenu(GLUT_RIGHT_BUTTON); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ diff --git a/test/scroll.cxx b/test/scroll.cxx index 4329f70cd..8528efbcd 100644 --- a/test/scroll.cxx +++ b/test/scroll.cxx @@ -71,7 +71,7 @@ void box_cb(Fl_Widget* o, void*) { } void type_cb(Fl_Widget*, void* v) { - thescroll->type((long)v); + thescroll->type((uchar)((long)v)); thescroll->redraw(); } @@ -87,7 +87,7 @@ Fl_Menu_Item choices[] = { }; void align_cb(Fl_Widget*, void* v) { - thescroll->scrollbar.align((long)v); + thescroll->scrollbar.align((uchar)((long)v)); thescroll->redraw(); } diff --git a/test/shape.cxx b/test/shape.cxx index b64067bbd..ac298767d 100644 --- a/test/shape.cxx +++ b/test/shape.cxx @@ -60,8 +60,8 @@ void shape_window::draw() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(.5,.6,.7); glBegin(GL_POLYGON); - for (int i=0; i<sides; i++) { - double ang = i*2*M_PI/sides; + for (int j=0; j<sides; j++) { + double ang = j*2*M_PI/sides; glVertex3f(cos(ang),sin(ang),0); } glEnd(); diff --git a/test/sudoku.cxx b/test/sudoku.cxx index 010a9c5ef..d5edb05c5 100644 --- a/test/sudoku.cxx +++ b/test/sudoku.cxx @@ -547,7 +547,6 @@ SudokuCell::handle(int event) { case FL_UNFOCUS : redraw(); return 1; - break; case FL_PUSH : if (!readonly() && Fl::event_inside(this)) { @@ -630,7 +629,7 @@ Fl_Preferences Sudoku::prefs_(Fl_Preferences::USER, "fltk.org", "sudoku"); Sudoku::Sudoku() : Fl_Window(GROUP_SIZE * 3, GROUP_SIZE * 3 + MENU_OFFSET, "Sudoku") { - int i, j; + int j, k; Fl_Group *g; SudokuCell *cell; static Fl_Menu_Item items[] = { @@ -657,8 +656,8 @@ Sudoku::Sudoku() // Setup sound output... - prefs_.get("mute_sound", i, 0); - if (i) { + prefs_.get("mute_sound", j, 0); + if (j) { // Mute sound? sound_ = NULL; items[6].flags |= FL_MENU_VALUE; @@ -676,27 +675,27 @@ Sudoku::Sudoku() // Create the grids... grid_ = new Fl_Group(0, MENU_OFFSET, 3 * GROUP_SIZE, 3 * GROUP_SIZE); - for (i = 0; i < 3; i ++) - for (j = 0; j < 3; j ++) { - g = new Fl_Group(j * GROUP_SIZE, i * GROUP_SIZE + MENU_OFFSET, + for (j = 0; j < 3; j ++) + for (k = 0; k < 3; k ++) { + g = new Fl_Group(k * GROUP_SIZE, j * GROUP_SIZE + MENU_OFFSET, GROUP_SIZE, GROUP_SIZE); g->box(FL_BORDER_BOX); - if ((i == 1) ^ (j == 1)) g->color(FL_DARK3); + if ((int)(j == 1) ^ (int)(k == 1)) g->color(FL_DARK3); else g->color(FL_DARK2); g->end(); - grid_groups_[i][j] = g; + grid_groups_[j][k] = g; } - for (i = 0; i < 9; i ++) - for (j = 0; j < 9; j ++) { - cell = new SudokuCell(j * CELL_SIZE + CELL_OFFSET + - (j / 3) * (GROUP_SIZE - 3 * CELL_SIZE), - i * CELL_SIZE + CELL_OFFSET + MENU_OFFSET + - (i / 3) * (GROUP_SIZE - 3 * CELL_SIZE), + for (j = 0; j < 9; j ++) + for (k = 0; k < 9; k ++) { + cell = new SudokuCell(k * CELL_SIZE + CELL_OFFSET + + (k / 3) * (GROUP_SIZE - 3 * CELL_SIZE), + j * CELL_SIZE + CELL_OFFSET + MENU_OFFSET + + (j / 3) * (GROUP_SIZE - 3 * CELL_SIZE), CELL_SIZE, CELL_SIZE); cell->callback(reset_cb); - grid_cells_[i][j] = cell; + grid_cells_[j][k] = cell; } // Set icon for window (MacOS uses app bundle for icon...) @@ -749,23 +748,23 @@ void Sudoku::check_game(bool highlight) { bool empty = false; bool correct = true; - int i, j, k; + int j, k, m; // Check the game for right/wrong answers... - for (i = 0; i < 9; i ++) - for (j = 0; j < 9; j ++) { - SudokuCell *cell = grid_cells_[i][j]; + for (j = 0; j < 9; j ++) + for (k = 0; k < 9; k ++) { + SudokuCell *cell = grid_cells_[j][k]; int val = cell->value(); if (cell->readonly()) continue; if (!val) empty = true; else { - for (k = 0; k < 9; k ++) - if ((i != k && grid_cells_[k][j]->value() == val) || - (j != k && grid_cells_[i][k]->value() == val)) break; + for (m = 0; m < 9; m ++) + if ((j != m && grid_cells_[m][k]->value() == val) || + (k != m && grid_cells_[j][m]->value() == val)) break; - if (k < 9) { + if (m < 9) { if (highlight) { cell->color(FL_YELLOW); cell->redraw(); @@ -780,28 +779,28 @@ Sudoku::check_game(bool highlight) { } // Check subgrids for duplicate numbers... - for (i = 0; i < 9; i += 3) - for (j = 0; j < 9; j += 3) - for (int ii = 0; ii < 3; ii ++) - for (int jj = 0; jj < 3; jj ++) { - SudokuCell *cell = grid_cells_[i + ii][j + jj]; + for (j = 0; j < 9; j += 3) + for (k = 0; k < 9; k += 3) + for (int jj = 0; jj < 3; jj ++) + for (int kk = 0; kk < 3; kk ++) { + SudokuCell *cell = grid_cells_[j + jj][k + kk]; int val = cell->value(); if (cell->readonly() || !val) continue; - int iii; + int jjj; - for (iii = 0; iii < 3; iii ++) { - int jjj; + for (jjj = 0; jjj < 3; jjj ++) { + int kkk; - for (jjj = 0; jjj < 3; jjj ++) - if (ii != iii && jj != jjj && - grid_cells_[i + iii][j + jjj]->value() == val) break; + for (kkk = 0; kkk < 3; kkk ++) + if (jj != jjj && kk != kkk && + grid_cells_[j + jjj][k + kkk]->value() == val) break; - if (jjj < 3) break; + if (kkk < 3) break; } - if (iii < 3) { + if (jjj < 3) { if (highlight) { cell->color(FL_YELLOW); cell->redraw(); @@ -813,14 +812,14 @@ Sudoku::check_game(bool highlight) { if (!empty && correct) { // Success! - for (i = 0; i < 9; i ++) { - for (j = 0; j < 9; j ++) { - SudokuCell *cell = grid_cells_[i][j]; + for (j = 0; j < 9; j ++) { + for (k = 0; k < 9; k ++) { + SudokuCell *cell = grid_cells_[j][k]; cell->color(FL_GREEN); cell->readonly(1); } - if (sound_) sound_->play('A' + grid_cells_[i][8]->value() - 1); + if (sound_) sound_->play('A' + grid_cells_[j][8]->value() - 1); } } } @@ -879,50 +878,52 @@ Sudoku::update_helpers_cb(Fl_Widget *widget, void *) { void Sudoku::update_helpers() { - int i, j, k; - // first we delete any entries that the user may have made - for (i=0; i<9; i++) { - for (j=0; j<9; j++) { - SudokuCell *cell = grid_cells_[i][j]; - for (k = 0; k < 8; k++) { - cell->test_value(0, k); + int j, k, m; + + // First we delete any entries that the user may have made + for (j = 0; j < 9; j ++) { + for (k = 0; k < 9; k ++) { + SudokuCell *cell = grid_cells_[j][k]; + for (m = 0; m < 8; m ++) { + cell->test_value(0, m); } } } - // now go through all cells and find out, what we can not be - for (i=0; i<81; i++) { + + // Now go through all cells and find out, what we can not be + for (j = 0; j < 81; j ++) { char taken[10] = { 0 }; - // find our destination cell - int row = i/9; - int col = i%9; + // Find our destination cell + int row = j / 9; + int col = j % 9; SudokuCell *dst_cell = grid_cells_[row][col]; if (dst_cell->value()) continue; - // find all values already taken in this row - for (j=0; j<9; j++) { - SudokuCell *cell = grid_cells_[row][j]; + // Find all values already taken in this row + for (k = 0; k < 9; k ++) { + SudokuCell *cell = grid_cells_[row][k]; int v = cell->value(); if (v) taken[v] = 1; } - // find all values already taken in this column - for (j=0; j<9; j++) { - SudokuCell *cell = grid_cells_[j][col]; + // Find all values already taken in this column + for (k = 0; k < 9; k ++) { + SudokuCell *cell = grid_cells_[k][col]; int v = cell->value(); if (v) taken[v] = 1; } - // now find all values already taken in this sqare - int ro = (row/3) * 3; - int co = (col/3) * 3; - for (j=0; j<3; j++) { - for (k=0; k<3; k++) { - SudokuCell *cell = grid_cells_[ro+j][co+k]; + // Now find all values already taken in this square + int ro = (row / 3) * 3; + int co = (col / 3) * 3; + for (k = 0; k < 3; k ++) { + for (m = 0; m < 3; m ++) { + SudokuCell *cell = grid_cells_[ro + j][co + k]; int v = cell->value(); if (v) taken[v] = 1; } } // transfer our findings to the markers - for (k = 1, j = 0; k <= 9; k++) { + for (m = 1, k = 0; m <= 9; m ++) { if (!taken[k]) - dst_cell->test_value(k, j++); + dst_cell->test_value(m, k ++); } } } @@ -994,27 +995,27 @@ Sudoku::load_game() { bool solved = true; - for (int i = 0; i < 9; i ++) - for (int j = 0; j < 9; j ++) { + for (int j = 0; j < 9; j ++) + for (int k = 0; k < 9; k ++) { char name[255]; int val; - SudokuCell *cell = grid_cells_[i][j]; + SudokuCell *cell = grid_cells_[j][k]; - sprintf(name, "value%d.%d", i, j); + sprintf(name, "value%d.%d", j, k); if (!prefs_.get(name, val, 0)) { - i = 9; + j = 9; grid_values_[0][0] = 0; break; } - grid_values_[i][j] = val; + grid_values_[j][k] = val; - sprintf(name, "state%d.%d", i, j); + sprintf(name, "state%d.%d", j, k); prefs_.get(name, val, 0); cell->value(val); - sprintf(name, "readonly%d.%d", i, j); + sprintf(name, "readonly%d.%d", j, k); prefs_.get(name, val, 0); cell->readonly(val); @@ -1024,10 +1025,10 @@ Sudoku::load_game() { solved = false; } - for (int k = 0; k < 8; k ++) { - sprintf(name, "test%d%d.%d", k, i, j); + for (int m = 0; m < 8; m ++) { + sprintf(name, "test%d%d.%d", m, j, k); prefs_.get(name, val, 0); - cell->test_value(val, k); + cell->test_value(val, m); } } @@ -1072,7 +1073,7 @@ Sudoku::new_cb(Fl_Widget *widget, void *) { // Create a new game... void Sudoku::new_game(time_t seed) { - int i, j, k, m, t, count; + int j, k, m, n, t, count; // Generate a new (valid) Sudoku grid... @@ -1081,36 +1082,36 @@ Sudoku::new_game(time_t seed) { memset(grid_values_, 0, sizeof(grid_values_)); - for (i = 0; i < 9; i += 3) { - for (j = 0; j < 9; j += 3) { + for (j = 0; j < 9; j += 3) { + for (k = 0; k < 9; k += 3) { for (t = 1; t <= 9; t ++) { for (count = 0; count < 20; count ++) { - k = i + (rand() % 3); m = j + (rand() % 3); - if (!grid_values_[k][m]) { - int kk; - - for (kk = 0; kk < k; kk ++) - if (grid_values_[kk][m] == t) break; - - if (kk < k) continue; - + n = k + (rand() % 3); + if (!grid_values_[m][n]) { int mm; for (mm = 0; mm < m; mm ++) - if (grid_values_[k][mm] == t) break; + if (grid_values_[mm][n] == t) break; if (mm < m) continue; - grid_values_[k][m] = t; + int nn; + + for (nn = 0; nn < n; nn ++) + if (grid_values_[m][nn] == t) break; + + if (nn < n) continue; + + grid_values_[m][n] = t; break; } } if (count == 20) { // Unable to find a valid puzzle so far, so start over... - j = 9; - i = -3; + k = 9; + j = -3; memset(grid_values_, 0, sizeof(grid_values_)); } } @@ -1120,9 +1121,9 @@ Sudoku::new_game(time_t seed) { // Start by making all cells editable SudokuCell *cell; - for (i = 0; i < 9; i ++) - for (j = 0; j < 9; j ++) { - cell = grid_cells_[i][j]; + for (j = 0; j < 9; j ++) + for (k = 0; k < 9; k ++) { + cell = grid_cells_[j][k]; cell->value(0); cell->readonly(0); @@ -1134,10 +1135,10 @@ Sudoku::new_game(time_t seed) { int numbers[9]; - for (i = 0; i < 9; i ++) numbers[i] = i + 1; + for (j = 0; j < 9; j ++) numbers[j] = j + 1; while (count > 0) { - for (i = 0; i < 20; i ++) { + for (j = 0; j < 20; j ++) { k = rand() % 9; m = rand() % 9; t = numbers[k]; @@ -1145,14 +1146,14 @@ Sudoku::new_game(time_t seed) { numbers[m] = t; } - for (i = 0; count > 0 && i < 9; i ++) { - t = numbers[i]; + for (j = 0; count > 0 && j < 9; j ++) { + t = numbers[j]; - for (j = 0; count > 0 && j < 9; j ++) { - cell = grid_cells_[i][j]; + for (k = 0; count > 0 && k < 9; k ++) { + cell = grid_cells_[j][k]; - if (grid_values_[i][j] == t && !cell->readonly()) { - cell->value(grid_values_[i][j]); + if (grid_values_[j][k] == t && !cell->readonly()) { + cell->value(grid_values_[j][k]); cell->readonly(1); cell->color(FL_GRAY); @@ -1168,33 +1169,33 @@ Sudoku::new_game(time_t seed) { // Return the next available value for a cell... int Sudoku::next_value(SudokuCell *c) { - int i, j, k, m; + int j, k, m, n; - for (i = 0; i < 9; i ++) { - for (j = 0; j < 9; j ++) - if (grid_cells_[i][j] == c) break; + for (j = 0; j < 9; j ++) { + for (k = 0; k < 9; k ++) + if (grid_cells_[j][k] == c) break; - if (j < 9) break; + if (k < 9) break; } - if (i == 9) return 1; + if (j == 9) return 1; - i -= i % 3; j -= j % 3; + k -= k % 3; int numbers[9]; memset(numbers, 0, sizeof(numbers)); - for (k = 0; k < 3; k ++) - for (m = 0; m < 3; m ++) { - c = grid_cells_[i + k][j + m]; + for (m = 0; m < 3; m ++) + for (n = 0; n < 3; n ++) { + c = grid_cells_[j + m][k + n]; if (c->value()) numbers[c->value() - 1] = 1; } - for (i = 0; i < 9; i ++) - if (!numbers[i]) return i + 1; + for (j = 0; j < 9; j ++) + if (!numbers[j]) return j + 1; return 1; } @@ -1230,9 +1231,9 @@ Sudoku::restart_cb(Fl_Widget *widget, void *) { Sudoku *s = (Sudoku *)(widget->window()); bool solved = true; - for (int i = 0; i < 9; i ++) - for (int j = 0; j < 9; j ++) { - SudokuCell *cell = s->grid_cells_[i][j]; + for (int j = 0; j < 9; j ++) + for (int k = 0; k < 9; k ++) { + SudokuCell *cell = s->grid_cells_[j][k]; if (!cell->readonly()) { solved = false; @@ -1251,23 +1252,23 @@ Sudoku::restart_cb(Fl_Widget *widget, void *) { void Sudoku::save_game() { // Save the current values and state of each grid... - for (int i = 0; i < 9; i ++) - for (int j = 0; j < 9; j ++) { + for (int j = 0; j < 9; j ++) + for (int k = 0; k < 9; k ++) { char name[255]; - SudokuCell *cell = grid_cells_[i][j]; + SudokuCell *cell = grid_cells_[j][k]; - sprintf(name, "value%d.%d", i, j); - prefs_.set(name, grid_values_[i][j]); + sprintf(name, "value%d.%d", j, k); + prefs_.set(name, grid_values_[j][k]); - sprintf(name, "state%d.%d", i, j); + sprintf(name, "state%d.%d", j, k); prefs_.set(name, cell->value()); - sprintf(name, "readonly%d.%d", i, j); + sprintf(name, "readonly%d.%d", j, k); prefs_.set(name, cell->readonly()); - for (int k = 0; k < 8; k ++) { - sprintf(name, "test%d%d.%d", k, i, j); - prefs_.set(name, cell->test_value(k)); + for (int m = 0; m < 8; m ++) { + sprintf(name, "test%d%d.%d", m, j, k); + prefs_.set(name, cell->test_value(m)); } } } @@ -1297,18 +1298,18 @@ Sudoku::solve_cb(Fl_Widget *widget, void *) { // Solve the puzzle... void Sudoku::solve_game() { - int i, j; + int j, k; - for (i = 0; i < 9; i ++) { - for (j = 0; j < 9; j ++) { - SudokuCell *cell = grid_cells_[i][j]; + for (j = 0; j < 9; j ++) { + for (k = 0; k < 9; k ++) { + SudokuCell *cell = grid_cells_[j][k]; - cell->value(grid_values_[i][j]); + cell->value(grid_values_[j][k]); cell->readonly(1); cell->color(FL_GRAY); } - if (sound_) sound_->play('A' + grid_cells_[i][8]->value() - 1); + if (sound_) sound_->play('A' + grid_cells_[j][8]->value() - 1); } } diff --git a/test/symbols.cxx b/test/symbols.cxx index 6450a20a3..28d4eaed2 100644 --- a/test/symbols.cxx +++ b/test/symbols.cxx @@ -45,7 +45,7 @@ Fl_Window *window; Fl_Value_Slider *orientation; Fl_Value_Slider *size; -void slider_cb(Fl_Widget *w, void *) { +void slider_cb(Fl_Widget *, void *) { static char buf[80]; int val = (int)orientation->value(); int sze = (int)size->value(); diff --git a/test/threads.cxx b/test/threads.cxx index 15e8165ca..df2c4920a 100644 --- a/test/threads.cxx +++ b/test/threads.cxx @@ -108,7 +108,6 @@ void* prime_func(void* p) Fl::unlock(); } } - return 0; } int main(int argc, char **argv) diff --git a/test/unittests.cxx b/test/unittests.cxx index 49a236640..3f7a7bb35 100644 --- a/test/unittests.cxx +++ b/test/unittests.cxx @@ -80,7 +80,7 @@ Fl_Group *beginTestPage(const char *l) { } //------- test the point drawing capabilities of this implementation ---------- -class PointTest : Fl_Widget { +class PointTest : public Fl_Widget { public: PointTest(int x, int y, int w, int h) : Fl_Widget(x, y, w, h) {} void draw() { int a = x(), b = y(); @@ -111,7 +111,7 @@ void fl_point_test() { } //------- test the line drawing capabilities of this implementation ---------- -class LineTest : Fl_Widget { +class LineTest : public Fl_Widget { public: LineTest(int x, int y, int w, int h) : Fl_Widget(x, y, w, h) {} void draw() { int a = x(), b = y(); fl_color(FL_BLACK); fl_rect(a, b, w(), h()); @@ -148,7 +148,7 @@ void fl_line_test() { } //------- test the line drawing capabilities of this implementation ---------- -class RectTest : Fl_Widget { +class RectTest : public Fl_Widget { public: RectTest(int x, int y, int w, int h) : Fl_Widget(x, y, w, h) {} void draw() { int a = x(), b = y(); fl_color(FL_BLACK); fl_rect(a, b, w(), h()); @@ -176,7 +176,7 @@ void fl_rect_test() { } //------- test the line drawing capabilities of this implementation ---------- -class ViewportTest : Fl_Widget { +class ViewportTest : public Fl_Widget { int pos; public: ViewportTest(int x, int y, int w, int h, int p) : Fl_Widget(x, y, w, h), pos(p) {} @@ -218,7 +218,7 @@ void fl_viewport_test() { } //------- test the circle drawing capabilities of this implementation ---------- -class CircleTest : Fl_Widget { +class CircleTest : public Fl_Widget { public: CircleTest(int x, int y, int w, int h) : Fl_Widget(x, y, w, h) {} void draw() { int a = x(), b = y(); fl_color(FL_BLACK); fl_rect(a, b, 100, 100); |
