From: Arun Persaud Date: Sat, 14 Apr 2012 23:19:34 +0000 (-0700) Subject: removed unused variables (-Wunused-variable) X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=26897ecf6be30b8ccc64285e1e293ab76df38ab9;p=xboard.git removed unused variables (-Wunused-variable) --- diff --git a/backend.c b/backend.c index 1cd59ce..44806a8 100644 --- a/backend.c +++ b/backend.c @@ -11581,7 +11581,6 @@ QuickScan (Board board, Move *move) move++; continue; } else if(piece <= Q_BCASTL) { // castling, encoded as (Q_XCASTL, king-to) + (rook, rook-to) - int rook; piece = pieceList[piece]; // first two elements of pieceList contain King numbers from = pieceList[piece]; // so this must be King quickBoard[from] = 0; diff --git a/board.c b/board.c index 4de6269..fbbb9af 100644 --- a/board.c +++ b/board.c @@ -893,7 +893,6 @@ DrawPosition (int repaint, Board board) static int lastBoardValid[2] = {0, 0}; static Board lastBoard[2]; static char lastMarker[BOARD_RANKS][BOARD_FILES]; - Arg args[16]; int rrow, rcol; int nr = twoBoards*partnerUp; diff --git a/dialogs.c b/dialogs.c index 07eba9b..c50651a 100644 --- a/dialogs.c +++ b/dialogs.c @@ -103,45 +103,47 @@ SetCurrentComboSelection (Option *opt) void GenericUpdate (Option *opts, int selected) { - int i, j; + int i; char buf[MSG_SIZ]; - float x; - for(i=0; ; i++) { - if(selected >= 0) { if(i < selected) continue; else if(i > selected) break; } - switch(opts[i].type) { - case TextBox: - case FileName: - case PathName: - SetWidgetText(&opts[i], *(char**) opts[i].target, -1); - break; - case Spin: - sprintf(buf, "%d", *(int*) opts[i].target); - SetWidgetText(&opts[i], buf, -1); - break; - case Fractional: - sprintf(buf, "%4.2f", *(float*) opts[i].target); - SetWidgetText(&opts[i], buf, -1); - break; - case CheckBox: - SetWidgetState(&opts[i], *(Boolean*) opts[i].target); - break; - case ComboBox: - if(opts[i].min & COMBO_CALLBACK) break; - SetCurrentComboSelection(opts+i); - // TODO: actually display this (but it is never used that way...) - break; - case EndMark: - return; - default: - printf("GenericUpdate: unexpected case in switch.\n"); - case ListBox: - case Button: - case SaveButton: - case Label: - case Break: - break; - } - } + + for(i=0; ; i++) + { + if(selected >= 0) { if(i < selected) continue; else if(i > selected) break; } + switch(opts[i].type) + { + case TextBox: + case FileName: + case PathName: + SetWidgetText(&opts[i], *(char**) opts[i].target, -1); + break; + case Spin: + sprintf(buf, "%d", *(int*) opts[i].target); + SetWidgetText(&opts[i], buf, -1); + break; + case Fractional: + sprintf(buf, "%4.2f", *(float*) opts[i].target); + SetWidgetText(&opts[i], buf, -1); + break; + case CheckBox: + SetWidgetState(&opts[i], *(Boolean*) opts[i].target); + break; + case ComboBox: + if(opts[i].min & COMBO_CALLBACK) break; + SetCurrentComboSelection(opts+i); + // TODO: actually display this (but it is never used that way...) + break; + case EndMark: + return; + default: + printf("GenericUpdate: unexpected case in switch.\n"); + case ListBox: + case Button: + case SaveButton: + case Label: + case Break: + break; + } + } } //------------------------------------------- Read out dialog controls ------------------------------------ @@ -965,7 +967,6 @@ NewCommentPopup (char *title, char *text, int index) void EditCommentProc () { - int j; if (PopDown(CommentDlg)) { // popdown succesful // MarkMenuItem("Edit.EditComment", False); // MarkMenuItem("View.Comments", False); @@ -1944,7 +1945,6 @@ Exp (int n, int x, int y) Option * BoardPopUp (int squareSize, int lineGap, void *clockFontThingy) { - extern Option *dialogOptions[]; int i, size = BOARD_WIDTH*(squareSize + lineGap) + lineGap; mainOptions[W_WHITE].choice = (char**) clockFontThingy; mainOptions[W_BLACK].choice = (char**) clockFontThingy; @@ -2064,7 +2064,7 @@ DisplayMessage (char *message, char *extMessage) static ChessProgramState *savCps; static FILE **savFP; -static char *fileName, *extFilter, *dirListing, *savMode, **namePtr; +static char *fileName, *extFilter, *savMode, **namePtr; static int folderPtr, filePtr, oldVal, byExtension, extFlag; static char curDir[MSG_SIZ], title[MSG_SIZ], *folderList[1000], *fileList[1000]; @@ -2196,7 +2196,6 @@ ListDir (int pathFlag) struct dirent *dp; struct stat statBuf; static int lastFlag; - char buf[MSG_SIZ]; if(pathFlag < 0) pathFlag = lastFlag; lastFlag = pathFlag; @@ -2206,7 +2205,7 @@ ListDir (int pathFlag) folderPtr = filePtr = 0; // clear listing while (dp = readdir(dir)) { // pass 1: list foders - char *s = dp->d_name, match; + char *s = dp->d_name; if(!stat(s, &statBuf) && S_ISDIR(statBuf.st_mode)) { // stat succeeds and tells us it is directory if(s[0] == '.' && strcmp(s, "..")) continue; // suppress hidden, except ".." ASSIGN(folderList[folderPtr], s); folderPtr++; diff --git a/menus.c b/menus.c index dca5e9f..d5744f7 100644 --- a/menus.c +++ b/menus.c @@ -363,17 +363,15 @@ FlipViewProc () void SaveOnExitProc () { - Arg args[16]; + saveSettingsOnExit = !saveSettingsOnExit; - saveSettingsOnExit = !saveSettingsOnExit; - - MarkMenuItem("Options.SaveSettingsonExit", saveSettingsOnExit); + MarkMenuItem("Options.SaveSettingsonExit", saveSettingsOnExit); } void SaveSettingsProc () { - SaveSettings(settingsFileName); + SaveSettings(settingsFileName); } void @@ -475,10 +473,8 @@ NothingProc () void PonderNextMoveProc () { - Arg args[16]; - - PonderNextMoveEvent(!appData.ponderNextMove); - MARK_MENU_ITEM("Options.PonderNextMove", appData.ponderNextMove); + PonderNextMoveEvent(!appData.ponderNextMove); + MARK_MENU_ITEM("Options.PonderNextMove", appData.ponderNextMove); } void @@ -636,12 +632,10 @@ ShowThinkingProc () void HideThinkingProc () { - Arg args[16]; - - appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: taken out of ShowThinkingEvent - ShowThinkingEvent(); + appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: taken out of ShowThinkingEvent + ShowThinkingEvent(); - MARK_MENU_ITEM("Options.HideThinking", appData.hideThinkingFromHuman); + MARK_MENU_ITEM("Options.HideThinking", appData.hideThinkingFromHuman); } /* diff --git a/ngamelist.c b/ngamelist.c index ae5bf12..f3ef1d9 100644 --- a/ngamelist.c +++ b/ngamelist.c @@ -96,7 +96,7 @@ static Option gamesOptions[] = { static void GL_Button (int n) { - int index, j; + int index; n = gamesOptions[n].value; // use marker in option rather than n itself, for more easy adding/deletng of buttons if (n == 6) { // close PopDown(GameListDlg); @@ -205,7 +205,7 @@ static void GameListReplace (int page) { // filter: put in separate routine, to make callable from call-back - char buf[MSG_SIZ], *p, **st=list; + char buf[MSG_SIZ], **st=list; int i; if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = ""; @@ -223,8 +223,6 @@ GameListReplace (int page) void GameListPopUp (FILE *fp, char *filename) { - char **st; - if (glc == NULL) { glc = (GameListClosure *) calloc(1, sizeof(GameListClosure)); glc->x = glc->y = -1; @@ -266,9 +264,6 @@ GameListDestroy () void ShowGameListProc () { - Arg args[16]; - int j; - if (glc == NULL) { DisplayError(_("There is no game list"), 0); return; diff --git a/xboard.c b/xboard.c index d3b827f..cf6beec 100644 --- a/xboard.c +++ b/xboard.c @@ -839,23 +839,20 @@ int frameX, frameY; void GetActualPlacement (Widget wg, WindowPlacement *wp) { - Arg args[16]; - Dimension w, h; - Position x, y; XWindowAttributes winAt; Window win, dummy; - int i, rx, ry; + int rx, ry; if(!wg) return; - win = XtWindow(wg); - XGetWindowAttributes(xDisplay, win, &winAt); // this works, where XtGetValues on XtNx, XtNy does not! - XTranslateCoordinates (xDisplay, win, winAt.root, -winAt.border_width, -winAt.border_width, &rx, &ry, &dummy); - wp->x = rx - winAt.x; - wp->y = ry - winAt.y; - wp->height = winAt.height; - wp->width = winAt.width; - frameX = winAt.x; frameY = winAt.y; // remember to decide if windows touch + win = XtWindow(wg); + XGetWindowAttributes(xDisplay, win, &winAt); // this works, where XtGetValues on XtNx, XtNy does not! + XTranslateCoordinates (xDisplay, win, winAt.root, -winAt.border_width, -winAt.border_width, &rx, &ry, &dummy); + wp->x = rx - winAt.x; + wp->y = ry - winAt.y; + wp->height = winAt.height; + wp->width = winAt.width; + frameX = winAt.x; frameY = winAt.y; // remember to decide if windows touch } void @@ -930,9 +927,7 @@ ConvertToLine (int argc, char **argv) void InitDrawingSizes (BoardSize boardSize, int flags) { // [HGM] resize is functional now, but for board format changes only (nr of ranks, files) - Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr; - Arg args[16]; - XtGeometryResult gres; + Dimension boardWidth, boardHeight, w, h; int i; static Dimension oldWidth, oldHeight; static VariantClass oldVariant; @@ -1114,8 +1109,8 @@ InitDrawingParams () void InitializeFonts (int clockFontPxlSize, int coordFontPxlSize, int fontPxlSize) -{ // determine what fonts to use, and create them - XrmValue vFrom, vTo; +{ // detervtomine what fonts to use, and create them + XrmValue vTo; XrmDatabase xdb; if(!fontIsSet[CLOCK_FONT] && fontValid[CLOCK_FONT][squareSize]) @@ -1170,11 +1165,10 @@ InitializeFonts (int clockFontPxlSize, int coordFontPxlSize, int fontPxlSize) int main (int argc, char **argv) { - int i, j, clockFontPxlSize, coordFontPxlSize, fontPxlSize; + int i, clockFontPxlSize, coordFontPxlSize, fontPxlSize; XSetWindowAttributes window_attributes; Arg args[16]; - Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr; - XtGeometryResult gres; + Dimension boardWidth, boardHeight, w, h; char *p; int forceMono = False; @@ -1751,8 +1745,6 @@ CreateOneGC (XGCValues *gc_values, Pixel foreground, Pixel background) static void CreateGCs (int redo) { - XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground - | GCBackground | GCFunction | GCPlaneMask; XGCValues gc_values; GC copyInvertedGC; Pixel white = XWhitePixel(xDisplay, xScreen); @@ -2316,8 +2308,6 @@ SetMenuEnables (Enables *enab) void KeyBindingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) { // [HGM] new method of key binding: specify MenuItem(FlipView) in stead of FlipViewProc in translation string - int i; - char *p; MenuItem *item; if(*nprms == 0) return; item = MenuNameToItem(prms[0]); @@ -2834,7 +2824,7 @@ FileNamePopUp (char *label, char *def, char *filter, FileProc proc, char *openMo fileProc = proc; /* I can't see a way not */ fileOpenMode = openMode; /* to use globals here */ { // [HGM] use file-selector dialog stolen from Ghostview - int index; // this is not supported yet + // int index; // this is not supported yet Browse(BoardWindow, label, (def[0] ? def : NULL), filter, False, openMode, &openName, &openFP); } } diff --git a/xedittags.c b/xedittags.c index 417c2b6..d27aca3 100644 --- a/xedittags.c +++ b/xedittags.c @@ -117,7 +117,5 @@ TagsPopDown() void EditTagsProc () { - Arg args[5]; - int j; - if (bookUp || !PopDown(TagsDlg)) EditTagsEvent(); + if (bookUp || !PopDown(TagsDlg)) EditTagsEvent(); } diff --git a/xevalgraph.c b/xevalgraph.c index 0257a0b..6430471 100644 --- a/xevalgraph.c +++ b/xevalgraph.c @@ -235,9 +235,6 @@ static Option graphOptions[] = { void EvalGraphPopUp () { - Arg args[16]; - int j; - if (GenericPopUp(graphOptions, _(title), EvalGraphDlg, BoardWindow, NONMODAL, 1)) { InitializeEvalGraph(&graphOptions[0]); // first time: add callbacks and initialize pens } else { diff --git a/xoptions.c b/xoptions.c index 68d23bc..7f4bf1d 100644 --- a/xoptions.c +++ b/xoptions.c @@ -359,7 +359,7 @@ CreateMenuItem (Widget menu, char *msg, XtCallbackProc CB, int n) static Widget CreateComboPopup (Widget parent, Option *opt, int n, int fromList, int def) { // fromList determines if the item texts are taken from a list of strings, or from a menu table - int i, j; + int i; Widget menu, entry; Arg arg; MenuItem *mb = (MenuItem *) opt->choice; @@ -370,7 +370,7 @@ CreateComboPopup (Widget parent, Option *opt, int n, int fromList, int def) for (i=0; 1; i++) { - char *msg = fromList ? list[i] : mb[i].string, *msg2; + char *msg = fromList ? list[i] : mb[i].string; if(!msg) break; entry = CreateMenuItem(menu, opt->min & NO_GETTEXT ? msg : _(msg), (XtCallbackProc) ComboSelect, (n<<16)+i); if(!fromList) mb[i].handle = (void*) entry; // save item ID, for enabling / checkmarking @@ -628,7 +628,7 @@ WheelProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) int j=0, n = atoi(prms[0]); static char *params[3] = { "", "Continuous", "Proportional" }; Arg args[16]; - float f, h, top; + float h, top; Widget v; if(!n) { // transient dialogs also use this for list-selection callback n = prms[1][0]-'0'; @@ -660,7 +660,7 @@ static char scrollTranslations[] = static void SqueezeIntoBox (Option *opt, int nr, int width) { // size buttons in bar to fit, clipping button names where necessary - int i, j, wtot = 0; + int i, wtot = 0; Dimension widths[20], oldWidths[20]; Arg arg; for(i=1; i