unused-but-set-variable warning in qt_main.cpp

../win/Qt/qt_main.cpp: In member function ‘virtual void nethack_qt_::NetHackQtMainWindow::closeEvent(QCloseEvent*)’:
../win/Qt/qt_main.cpp:1377:9: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
 1377 |     int ok = 0;
      |         ^~
This commit is contained in:
nhmall
2021-02-03 15:33:30 -05:00
parent 21ca9e1ec5
commit 44b16979cf
+3 -3
View File
@@ -1374,7 +1374,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event)
// game window's Close button has been activated // game window's Close button has been activated
void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED) void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED)
{ {
int ok = 0; // int ok = 0;
if ( g.program_state.something_worth_saving ) { if ( g.program_state.something_worth_saving ) {
/* this used to offer "Save" and "Cancel" /* this used to offer "Save" and "Cancel"
but cancel (ignoring the close attempt) won't work but cancel (ignoring the close attempt) won't work
@@ -1389,7 +1389,7 @@ void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED)
break; break;
case 1: case 1:
// quit -- bypass the prompting preformed by done2() // quit -- bypass the prompting preformed by done2()
ok = 1; // ok = 1;
g.program_state.stopprint++; g.program_state.stopprint++;
::done(QUIT); ::done(QUIT);
/*NOTREACHED*/ /*NOTREACHED*/
@@ -1397,7 +1397,7 @@ void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED)
} }
} else { } else {
/* nothing worth saving; just close/quit */ /* nothing worth saving; just close/quit */
ok = 1; // ok = 1;
} }
/* if !ok, we should try to continue, but we don't... */ /* if !ok, we should try to continue, but we don't... */
u.uhp = -1; u.uhp = -1;