# HG changeset patch # User Matti Hamalainen # Date 1412543591 -10800 # Node ID 99242b34e6dcc0cdc27255b3cae39edde064a25c # Parent ab7cd6cdb5d7646a6f28ed708590753d67c7cdae Fix some cosmetics and warnings. diff -r ab7cd6cdb5d7 -r 99242b34e6dc src/editloop.cc --- a/src/editloop.cc Mon Sep 26 19:46:21 2011 +0300 +++ b/src/editloop.cc Mon Oct 06 00:13:11 2014 +0300 @@ -213,7 +213,7 @@ /* FIXME : all these variables should be moved to edit_t : */ int RedrawMap; bool DragObject = false, DragMapMove = false; - int oldbuttons, DragMapMoveX, DragMapMoveY; + int DragMapMoveX = 0, DragMapMoveY = 0; bool StretchSelBox = false; // FIXME apparently not used anymore... @@ -276,7 +276,6 @@ CenterMapAroundCoords((MapMinX + MapMaxX) / 2, (MapMinY + MapMaxY) / 2); } - oldbuttons = 0; /* Create the menu bar */ { diff -r ab7cd6cdb5d7 -r 99242b34e6dc src/gotoobj.cc --- a/src/gotoobj.cc Mon Sep 26 19:46:21 2011 +0300 +++ b/src/gotoobj.cc Mon Oct 06 00:13:11 2014 +0300 @@ -129,8 +129,8 @@ { sd1 = LineDefs[n].sidedef1; sd2 = LineDefs[n].sidedef2; - if (sd1 >= 0 && SideDefs[sd1].sector == objid.num - || sd2 >= 0 && SideDefs[sd2].sector == objid.num) + if ((sd1 >= 0 && SideDefs[sd1].sector == objid.num) || + (sd2 >= 0 && SideDefs[sd2].sector == objid.num)) { GetObjectCoords(OBJ_LINEDEFS, n, &xpos2, &ypos2); int d = ComputeDist(abs(xpos - xpos2), abs(ypos - ypos2)) / 7; diff -r ab7cd6cdb5d7 -r 99242b34e6dc src/input.cc --- a/src/input.cc Mon Sep 26 19:46:21 2011 +0300 +++ b/src/input.cc Mon Oct 06 00:13:11 2014 +0300 @@ -131,7 +131,7 @@ { // No event ? Wait for ms before polling again. #if defined Y_NANOSLEEP - struct timespec treq = { 0, 1000000ul * cfg.idle_sleep_ms }; + struct timespec treq = { 0, 1000000l * cfg.idle_sleep_ms }; struct timespec trem; nanosleep(&treq, &trem); #elif defined Y_USLEEP diff -r ab7cd6cdb5d7 -r 99242b34e6dc src/lumpdir.cc --- a/src/lumpdir.cc Mon Sep 26 19:46:21 2011 +0300 +++ b/src/lumpdir.cc Mon Oct 06 00:13:11 2014 +0300 @@ -131,8 +131,7 @@ Wad_name_c x_end("%c_END", label); Wad_name_c xx_start("%c%c_START", label, label); Wad_name_c xx_end("%c%c_END", label, label); - for (MDirPtr dir = *master_dir; - dir && (dir = FindMasterDir(dir, x_start.name, xx_start.name));) + for (MDirPtr dir = *master_dir; dir && (dir = FindMasterDir(dir, x_start.name, xx_start.name));) { MDirPtr start_label = dir; const char *end_label = 0; @@ -154,13 +153,15 @@ break; } // Ended by X_END or, if started by XX_START, XX_END. - if (!x_end.cmp(dir->dir.name) - || end_label == xx_end.name && !xx_end.cmp(dir->dir.name)) + if (!x_end.cmp(dir->dir.name) || + (end_label == xx_end.name && !xx_end.cmp(dir->dir.name))) { if (dir->dir.size != 0) + { warn("%.128s: label %.*s has non-zero size %ld\n", dir->wadfile->pathname(), (int) WAD_NAME, dir->dir.name, (long) dir->dir.size); + } dir = dir->next; break; } @@ -176,15 +177,17 @@ (!y_strnicmp(dir->dir.name + 3, "START", WAD_NAME - 3) || !y_strnicmp(dir->dir.name + 3, "END", WAD_NAME - 3)))) + { warn("%.128s: unexpected label \"%.*s\" in %s group\n", dir->wadfile->pathname(), (int) WAD_NAME, dir->dir.name, start_label->dir.name); + } continue; } + wad_flat_name_t name; memcpy(name, dir->dir.name, sizeof name); - lump_map[name] - = Lump_loc(dir->wadfile, dir->dir.start, dir->dir.size); + lump_map[name] = Lump_loc(dir->wadfile, dir->dir.start, dir->dir.size); } if (dir) dir = dir->next; diff -r ab7cd6cdb5d7 -r 99242b34e6dc src/menubar.cc --- a/src/menubar.cc Mon Sep 26 19:46:21 2011 +0300 +++ b/src/menubar.cc Mon Oct 06 00:13:11 2014 +0300 @@ -83,30 +83,27 @@ * (, ) are the coordinates * of the bottom right corner of the screen/window. */ -void menubar_c::compute_menubar_coords(int scrx0, int scry0, int scrx1, - int scry1) +void menubar_c::compute_menubar_coords(int scrx0, int scry0, int scrx1, int scry1) { -// Just to prevent the compiler from emitting an -// annoying warning about that parameter being unused. - scry1 = 0; + (void) scry1; - menubar_out_x0 = scrx0; - menubar_in_x0 = menubar_out_x0 + BOX_BORDER; + menubar_out_x0 = scrx0; + menubar_in_x0 = menubar_out_x0 + BOX_BORDER; menubar_text_x0 = menubar_in_x0; - menubar_out_x1 = scrx1; - menubar_in_x1 = menubar_out_x1 - BOX_BORDER; + menubar_out_x1 = scrx1; + menubar_in_x1 = menubar_out_x1 - BOX_BORDER; menubar_text_x1 = menubar_in_x1; - menubar_out_y0 = scry0; - menubar_in_y0 = menubar_out_y0 + BOX_BORDER; + menubar_out_y0 = scry0; + menubar_in_y0 = menubar_out_y0 + BOX_BORDER; menubar_text_y0 = menubar_in_y0 + NARROW_VSPACING; menubar_text_y1 = menubar_text_y0 + FONTH - 1; - menubar_in_y1 = menubar_text_y1 + NARROW_VSPACING; - menubar_out_y1 = menubar_in_y1 + BOX_BORDER; + menubar_in_y1 = menubar_text_y1 + NARROW_VSPACING; + menubar_out_y1 = menubar_in_y1 + BOX_BORDER; - stale_coords = 0; - stale_x0_x1 = 1; + stale_coords = 0; + stale_x0_x1 = 1; } @@ -122,8 +119,10 @@ { if (nitems >= MAX_ITEMS) fatal_error("Too many items on menu bar"); + if (shortcut_index < 0 || shortcut_index >= (int) strlen(text)) fatal_error("add_menubar_item: shortcut_index out of range"); + item_text[nitems] = text; item_shortcut_index[nitems] = shortcut_index; item_right_aligned[nitems] = right_aligned; @@ -144,7 +143,7 @@ fatal_error("set_menu: bad mbi#"); item_menu[number] = menu; -// So that need_to_clear() knows something has changed + // So that need_to_clear() knows something has changed if (number == pulled_down_no) pulled_down_menu = menu; } @@ -251,11 +250,11 @@ void menubar_c::draw() { // Draw the menu bar itself - if (bar_visible && !bar_visible_disp - || highlighted_no != highlighted_no_disp) + if ((bar_visible && !bar_visible_disp) || highlighted_no != highlighted_no_disp) { if (stale_x0_x1) compute_x0_x1(); + push_colour(menu_colour[0][0].bg); /* 1 */ DrawScreenBox3D(0, 0, cfg.ScrMaxX, menubar_out_y1); set_colour(menu_colour[0][0].fg); @@ -281,15 +280,15 @@ highlighted_no_disp = highlighted_no; } -// If there is a menu that used to be visible -// but isn't anymore, let it be aware of it. + // If there is a menu that used to be visible + // but isn't anymore, let it be aware of it. if (pulled_down_menu_disp && pulled_down_menu != pulled_down_menu_disp) { pulled_down_menu_disp->clear(); pulled_down_menu_disp->set_visible(0); } -// Draw the pulled down menu (if any) + // Draw the pulled down menu (if any) if (pulled_down_menu) { int x, y;