From 73d01dd659f82f2c53fd7cedcf0bbb8d47f70ab2 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 20 May 2007 00:01:06 +0000 Subject: Fix all compiler warnings from various build systems. Fix vsnprintf() implementation to properly handle long and long long ints. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5845 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/blocks.cxx | 33 +++--- test/browser.cxx | 2 +- test/file_chooser.cxx | 4 +- test/fractals.cxx | 32 +++--- test/fullscreen.cxx | 4 +- test/gl_overlay.cxx | 10 +- test/glpuzzle.cxx | 56 +++++------ test/scroll.cxx | 4 +- test/shape.cxx | 4 +- test/sudoku.cxx | 273 +++++++++++++++++++++++++------------------------- test/symbols.cxx | 2 +- test/threads.cxx | 1 - test/unittests.cxx | 10 +- 13 files changed, 219 insertions(+), 216 deletions(-) (limited to 'test') 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; tsize(); 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; itype((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; ibox(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); -- cgit v1.2.3