From 5fcd68c64763478d3e05f58d4c21508e8dab97d5 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 28 Feb 2014 21:48:19 +0100 Subject: [PATCH 1/1] Fix various warnings Mostly written but never read errors. Also removed a debug printf that was causing a format warning. --- backend.c | 1 - winboard/wedittags.c | 3 +-- winboard/wgamelist.c | 3 +-- winboard/winboard.c | 14 ++++++-------- winboard/wsettings.c | 11 ++++------- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/backend.c b/backend.c index f305409..95697fa 100644 --- a/backend.c +++ b/backend.c @@ -8759,7 +8759,6 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h (unsigned int)programStats.nodes / (10*abs(programStats.time) + 1.), programStats.movelist); SendToICS(buf); -if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats.nodes, programStats.nodes); } } #endif diff --git a/winboard/wedittags.c b/winboard/wedittags.c index 79f4edc..3b599e8 100644 --- a/winboard/wedittags.c +++ b/winboard/wedittags.c @@ -58,7 +58,7 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static HANDLE hwndText; static int sizeX, sizeY; - int len, newSizeX, newSizeY, flags; + int len, newSizeX, newSizeY; char *str; RECT rect; MINMAXINFO *mmi; @@ -89,7 +89,6 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } if (!editTagsDialog) { editTagsDialog = hDlg; - flags = SWP_NOZORDER; GetClientRect(hDlg, &rect); sizeX = rect.right; sizeY = rect.bottom; diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index 4fa6025..fe8acec 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -164,7 +164,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) int nItem; RECT rect; static int sizeX, sizeY; - int newSizeX, newSizeY, flags; + int newSizeX, newSizeY; MINMAXINFO *mmi; static BOOL filterHasFocus = FALSE; int count; @@ -197,7 +197,6 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Size and position the dialog */ if (!gameListDialog) { gameListDialog = hDlg; - flags = SWP_NOZORDER; GetClientRect(hDlg, &rect); sizeX = rect.right; sizeY = rect.bottom; diff --git a/winboard/winboard.c b/winboard/winboard.c index 7c4306e..3738ddc 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -1810,6 +1810,7 @@ static void CreatePieceMaskFromFont( HDC hdc_window, HDC hdc, int index ) COLORREF chroma = RGB(0xFF,0x00,0xFF); RECT rc; SIZE sz; + POINT pt; int backColor = whitePieceColor; int foreColor = blackPieceColor; @@ -2299,6 +2300,7 @@ InitDrawingSizes(BoardSize boardSize, int flags) { // correct board size to one where built-in pieces exist if((v == VariantCapablanca || v == VariantGothic || v == VariantGrand || v == VariantCapaRandom || v == VariantJanus || v == VariantSuper) && (boardSize < SizePetite || boardSize > SizeBulky) // Archbishop and Chancellor available in entire middle range + || (v == VariantShogi && boardSize != SizeModerate) // Japanese-style Shogi || v == VariantKnightmate || v == VariantSChess || v == VariantXiangqi || v == VariantSpartan || v == VariantShatranj || v == VariantMakruk || v == VariantGreat || v == VariantFairy || v == VariantLion ) { @@ -3977,6 +3979,7 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) else if(dragInfo.from.x == BOARD_RGHT+1 ) board[dragInfo.from.y][dragInfo.from.x-1]++; + board[dragInfo.from.y][dragInfo.from.x] = dragged_piece; x = dragInfo.pos.x - squareSize / 2; y = dragInfo.pos.y - squareSize / 2; @@ -4718,7 +4721,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { FARPROC lpProc; - int wmId, wmEvent; + int wmId; char *defName; FILE *f; UINT number; @@ -4821,7 +4824,6 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: /* message: command from application menu */ wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); switch (wmId) { case IDM_NewGame: @@ -6389,7 +6391,7 @@ LRESULT CALLBACK CommentDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static HANDLE hwndText = NULL; - int len, newSizeX, newSizeY, flags; + int len, newSizeX, newSizeY; static int sizeX, sizeY; char *str; RECT rect; @@ -6417,7 +6419,6 @@ CommentDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Size and position the dialog */ if (!commentDialog) { commentDialog = hDlg; - flags = SWP_NOZORDER; GetClientRect(hDlg, &rect); sizeX = rect.right; sizeY = rect.bottom; @@ -6754,7 +6755,6 @@ ErrorPopDown() LRESULT CALLBACK ErrorDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - HANDLE hwndText; RECT rChild; switch (message) { @@ -6778,7 +6778,6 @@ ErrorDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) errorDialog = hDlg; SetWindowText(hDlg, errorTitle); - hwndText = GetDlgItem(hDlg, OPT_ErrorText); SetDlgItemText(hDlg, OPT_ErrorText, errorMessage); return FALSE; @@ -6804,7 +6803,6 @@ HWND gothicDialog = NULL; LRESULT CALLBACK GothicDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - HANDLE hwndText; RECT rChild; int height = GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYFRAME); @@ -6823,7 +6821,6 @@ GothicDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) */ gothicDialog = hDlg; SetWindowText(hDlg, errorTitle); - hwndText = GetDlgItem(hDlg, OPT_ErrorText); SetDlgItemText(hDlg, OPT_ErrorText, errorMessage); return FALSE; @@ -10076,6 +10073,7 @@ int flock(int fid, int code) ov.OffsetHigh = 0; switch(code) { case 1: LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK, 0, 1024, 0, &ov); break; // LOCK_SH + case 2: LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK, 0, 1024, 0, &ov); break; // LOCK_EX case 3: UnlockFileEx(hFile, 0, 1024, 0, &ov); break; // LOCK_UN default: return -1; diff --git a/winboard/wsettings.c b/winboard/wsettings.c index 99efab5..215ea18 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -120,7 +120,7 @@ void LayoutOptions(int firstOption, int endOption, char *groupName, Option *optionList) { int i, b = strlen(groupName), stop, prefix, right, nextOption, firstButton = buttons; - Control lastType, nextType; + Control lastType, nextType=Label; nextOption = firstOption; while(nextOption < endOption) { @@ -380,7 +380,6 @@ int GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) // read out all controls, and if value is altered, remember it and send it to the engine { - HANDLE hwndCombo; int i, k, new=0, changed=0, len; char **choices, newText[MSG_SIZ], buf[MSG_SIZ], *text; BOOL success; @@ -424,7 +423,6 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) break; case ComboBox: choices = (char**) optionList[j].textValue; - hwndCombo = GetDlgItem(hDlg, 2001+2*i); success = GetDlgItemText( hDlg, 2001+2*i, newText, MSG_SIZ ); if(!success) break; new = -1; @@ -577,8 +575,8 @@ void AddOption(int x, int y, Control type, int i) int extra, num = ES_NUMBER; switch(type) { - case Slider+100: - num = 0; // needs text control for accepting negative numbers +// case Slider+100: +// num = 0; // needs text control for accepting negative numbers case Slider: case Spin: AddControl(x, y+1, 95, 9, 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, i); @@ -888,8 +886,7 @@ int MatchOK() void PseudoOK(HWND hDlg) { - void (*saveOK)(); - saveOK = okFunc; okFunc = 0; + okFunc = 0; GetOptionValues(hDlg, activeCps, activeList); EndDialog( hDlg, 0 ); comboCallback = NULL; activeCps = NULL; -- 1.7.0.4