From bf98bc9fe852434d30f80731fad39df587b9df1b Mon Sep 17 00:00:00 2001 From: cohrs Date: Mon, 13 Oct 2003 21:17:12 +0000 Subject: [PATCH] qt gcc warnings cosmetic changes to allow qt_win.cpp to compile cleanly using gcc -Wall. This corresponds to a debian report that doesn't mention a debian bug ID. The changes are not identical to the suggested debian patch. --- win/Qt/qt_win.cpp | 50 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 0ae27ae60..39d47416b 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -1656,8 +1656,6 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event) painter.setClipRect( event->rect() ); // (normally we don't clip) painter.fillRect( event->rect(), black ); - int offset; - if ( !rogue_font ) { // Find font... int pts = 5; @@ -1845,10 +1843,10 @@ public: int uncleared; NetHackQtScrollText(int maxlength) : + uncleared(0), maxitems(maxlength), first(0), count(0), - uncleared(0), item_cycle(maxlength) { setNumCols(1); @@ -2046,21 +2044,21 @@ void NetHackQtMessageWindow::PutStr(int attr, const char* text) NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : QWidget(parent), + low_is_good(FALSE), + prev_value(-123), turn_count(-1), label(new QLabel(l,this)), - icon(0), - low_is_good(FALSE), - prev_value(-123) + icon(0) { initHighlight(); } NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l, const QPixmap& i) : QWidget(parent), low_is_good(FALSE), + prev_value(-123), turn_count(-1), label(new QLabel(l,this)), - icon(new QLabel(this)), - prev_value(-123) + icon(new QLabel(this)) { setIcon(i); initHighlight(); @@ -2202,14 +2200,14 @@ NetHackQtStatusWindow::NetHackQtStatusWindow() : // Alignment needs -2 init value, because -1 is an alignment. // Armor Class is an schar, so 256 is out of range. // Blank value is 0 and should never change. + name(this,"(name)"), + dlevel(this,"(dlevel)"), str(this,"STR"), dex(this,"DEX"), con(this,"CON"), intel(this,"INT"), wis(this,"WIS"), cha(this,"CHA"), - name(this,"(name)"), - dlevel(this,"(dlevel)"), gold(this,"Gold"), hp(this,"Hit Points"), power(this,"Power"), @@ -2356,7 +2354,6 @@ void NetHackQtStatusWindow::resizeEvent(QResizeEvent*) int h=height(); int x=0,y=0; - double space=1.0; int iw; // Width of an item across line int lh; // Height of a line of values @@ -2700,8 +2697,8 @@ NetHackQtMenuWindow::NetHackQtMenuWindow(NetHackQtKeyBuffer& ks) : QTableView(), keysource(ks), dialog(new NetHackQtMenuDialog()), - pressed(-1), - prompt(0) + prompt(0), + pressed(-1) { setNumCols(4); setCellHeight(QMAX(qt_settings->glyphs().height()+1,fontMetrics().height())); @@ -2709,8 +2706,6 @@ NetHackQtMenuWindow::NetHackQtMenuWindow(NetHackQtKeyBuffer& ks) : setFrameStyle(Panel|Sunken); setLineWidth(2); - int x=0; - ok=new QPushButton("Ok",dialog); connect(ok,SIGNAL(clicked()),dialog,SLOT(accept())); @@ -2808,7 +2803,7 @@ void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, } } - if (item.size()0) Sprintf(buf,"%d", item[row].count); else - Sprintf(buf,""); + Strcpy(buf, ""); requestor.SetDefault(buf); if (requestor.Get(buf)) { @@ -3436,7 +3431,7 @@ void NetHackQtTextWindow::Search() requestor.SetDefault(line); if (requestor.Get(line)) { int current=lines->currentItem(); - for (int i=1; icount(); i++) { + for (uint i=1; icount(); i++) { int lnum=(i+current)%lines->count(); QString str=lines->text(lnum); if (str.contains(line)) { @@ -4096,8 +4091,8 @@ void NetHackQtMainWindow::ShowIfReady() NetHackQtYnDialog::NetHackQtYnDialog(NetHackQtKeyBuffer& keysrc,const char* q,const char* ch,char df) : QDialog(qApp->mainWidget(),0,FALSE), - keysource(keysrc), - question(q), choices(ch), def(df) + question(q), choices(ch), def(df), + keysource(keysrc) { setCaption("NetHack: Question"); } @@ -4184,7 +4179,6 @@ char NetHackQtYnDialog::Exec() const int margin=8; const int gutter=8; const int extra=fontMetrics().height(); // Extra for group - int row=0; int x=margin, y=extra+margin; int butsize=fontMetrics().height()*2+5; @@ -4222,7 +4216,7 @@ char NetHackQtYnDialog::Exec() show(); char choice=0; char ch_esc=0; - for (int i=0; i id_to_window; winid NetHackQtBind::qt_create_nhwindow(int type) { winid id; - for (id = 0; id < id_to_window.size(); id++) { + for (id = 0; id < (winid) id_to_window.size(); id++) { if ( !id_to_window[id] ) break; } - if ( id == id_to_window.size() ) + if ( id == (winid) id_to_window.size() ) id_to_window.resize(id+1); NetHackQtWindow* window=0; -- 2.40.0