From b67fba0297ce7c700d6e7da3073d07b7772d1c8f Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 6 Nov 2022 13:54:28 +0100 Subject: [PATCH] Fix bugs in directory-change and new-variant patches By too much copy-pasting SetCurrentDirectory in the WB front-end had obtained a spurious extra argument. --- winboard/winboard.c | 13 ++++++++----- winboard/woptions.c | 3 ++- winboard/wsettings.c | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/winboard/winboard.c b/winboard/winboard.c index e7542ad..e152a9a 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -381,6 +381,7 @@ LoadLanguageFile(char *name) case 't': k = '\t'; break; } languageBuf[--i] = k; + } i++; } @@ -4752,7 +4753,7 @@ LoadGameDialog(HWND hwnd, char* title) appData.oldSaveStyle ? "gam" : "pgn", GAME_FILT, title, &number, fileTitle, NULL); - SetCurrentDirectory(MSG_SIZ, dir); + SetCurrentDirectory(dir); if (f != NULL) { cmailMsgLoaded = FALSE; if (number == 0) { @@ -5022,7 +5023,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) appData.oldSaveStyle ? "pos" : "fen", POSITION_FILT, _("Load Position from File"), &number, fileTitle, NULL); - SetCurrentDirectory(MSG_SIZ, dir); + SetCurrentDirectory(dir); if (f != NULL) { LoadPosition(f, number, fileTitle); } @@ -5047,7 +5048,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) appData.oldSaveStyle ? "gam" : "pgn", GAME_FILT, _("Save Game to File"), NULL, fileTitle, NULL); - SetCurrentDirectory(MSG_SIZ, dir); + SetCurrentDirectory(dir); if (f != NULL) { SaveGame(f, 0, ""); } @@ -5073,7 +5074,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) "bmp", DIAGRAM_FILT, _("Save Diagram to File"), NULL, fileTitle, NULL); - SetCurrentDirectory(MSG_SIZ, dir); + SetCurrentDirectory(dir); if (f != NULL) { SaveDiagram(f); } @@ -5085,7 +5086,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) "pgn", GAME_FILT, _("Save Game to File"), NULL, fileTitle, NULL); - SetCurrentDirectory(MSG_SIZ, dir); + SetCurrentDirectory(dir); if (f != NULL) { SaveSelected(f, 0, ""); } @@ -5321,6 +5322,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_Rematch: RematchEvent(); + break; case IDM_CallFlag: @@ -5675,6 +5677,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case EP_BlackCannon: EditPositionMenuEvent(BlackCannon, fromX, fromY); + fromX = fromY = -1; break; diff --git a/winboard/woptions.c b/winboard/woptions.c index c7d78e6..ecdcce1 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -905,7 +905,7 @@ VariantShowRadio(HWND hDlg) while((j = radioButton[i++]) != -2) { if(j == -1) continue; // no menu button v = VariantName(i-1); p = strstr(first.variants, v); - if(p && p != &first.variants && p[-1] != ',') p == NULL; + if(p && p != first.variants && p[-1] != ',') p = NULL; if(appData.noChessProgram || p && (!*v || strlen(v) == strlen(p) || p[strlen(v)] == ',')) { SendMessage(combo, CB_ADDSTRING, 0, (LPARAM) T_(v)); if(gameInfo.variant == i - 1) current = nr; @@ -1218,6 +1218,7 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) COLORREF *colorref; switch (message) { + case WM_INITDIALOG: /* message: initialize dialog box */ mca = colorizeAttribs; diff --git a/winboard/wsettings.c b/winboard/wsettings.c index e5fdbfc..bde55b4 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -528,7 +528,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa GetSaveFileName( &ofn ) ) { SetDlgItemText( hDlg, i+3, buf ); } - SetCurrentDirectory(MSG_SIZ, dir); + SetCurrentDirectory(dir); } else if(j == -3) { GetDlgItemText( hDlg, i+3, buf, MSG_SIZ ); -- 1.7.0.4