From d35860e90a4981831cbb0980cbdf7a43110fee13 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Wed, 13 Aug 2008 06:10:55 +0000 Subject: [PATCH] address warnings gcc 4.3 --- build_num | 2 +- doc/ChangeLog | 4 ++ src/fwbedit/list_object.cpp | 2 +- src/gui/FWObjectClipboard.cpp | 2 +- src/gui/ObjectListViewItem.cpp | 86 +++++++++++------------- src/gui/ObjectManipulator.cpp | 6 +- src/gui/RuleSetView.cpp | 2 + src/gui/fakeWizard.cpp | 3 +- src/gui/printerStream.cpp | 3 +- src/gui/utils.cpp | 4 +- src/pix/OSConfigurator_pix_os_fixups.cpp | 4 +- 11 files changed, 62 insertions(+), 56 deletions(-) diff --git a/build_num b/build_num index f8ab9a6b8..3122babc1 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 449 +#define BUILD_NUM 465 diff --git a/doc/ChangeLog b/doc/ChangeLog index cdaad43f8..2fef030a6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,9 @@ 2008-08-12 Vadim Kurland + * ObjectListViewItem.cpp (ObjectListViewItem::operator<): (and + several other places): code fixes to address warnings issued by + gcc 4.3 + * Helper.cpp (Helper::findInterfaceByNetzone): fixed bug in policy compiler for pix - it could not properly identify interface with network zone "any" diff --git a/src/fwbedit/list_object.cpp b/src/fwbedit/list_object.cpp index 7b0d2c30a..d4f303a31 100644 --- a/src/fwbedit/list_object.cpp +++ b/src/fwbedit/list_object.cpp @@ -229,7 +229,7 @@ void listObject(FWObject *obj, bool list_children, bool recursive, else { string format = list_format; - while (replaceFirstMacroInString(format, obj)); + while (replaceFirstMacroInString(format, obj)) ; string::size_type n; while ( (n=format.find("\\t"))!=string::npos ) diff --git a/src/gui/FWObjectClipboard.cpp b/src/gui/FWObjectClipboard.cpp index 8e4702be4..7073e19ca 100644 --- a/src/gui/FWObjectClipboard.cpp +++ b/src/gui/FWObjectClipboard.cpp @@ -97,7 +97,7 @@ FWObject* FWObjectClipboard::getObject() FWObject* FWObjectClipboard::getObjectByIdx (int idx) { - if (idx < ids.size()) + if (idx < int(ids.size())) { pair p = ids[idx]; return p.second->db()->findInIndex( p.first ); diff --git a/src/gui/ObjectListViewItem.cpp b/src/gui/ObjectListViewItem.cpp index bf62941bc..3fac6e6ba 100644 --- a/src/gui/ObjectListViewItem.cpp +++ b/src/gui/ObjectListViewItem.cpp @@ -37,59 +37,55 @@ using namespace libfwbuilder; bool ObjectListViewItem::operator< ( const QTreeWidgetItem & other ) const { - QTreeWidget * widget = treeWidget () ; - if (widget!=NULL) + QTreeWidget * widget = treeWidget() ; + if (widget==NULL) return false; + + int col = widget->sortColumn (); + if (col==1) { - int col = widget->sortColumn (); - if (col==1) + FWObject *right = ((ObjectListViewItem*)(&other))->getFWObject(); + FWObject *left = this->getFWObject(); + TCPUDPService * rtcpudp = TCPUDPService::cast(right); + TCPUDPService * ltcpudp = TCPUDPService::cast(left); + + IPService * rip = IPService::cast(right); + IPService * lip = IPService::cast(left); + + ICMPService * ricmp = ICMPService::cast(right); + ICMPService * licmp = ICMPService::cast(left); + if (rtcpudp != NULL && ltcpudp != NULL) { - FWObject *right = ((ObjectListViewItem*)(&other))->getFWObject(); - FWObject *left = this->getFWObject(); - TCPUDPService * rtcpudp = TCPUDPService::cast(right); - TCPUDPService * ltcpudp = TCPUDPService::cast(left); - - IPService * rip = IPService::cast(right); - IPService * lip = IPService::cast(left); - - ICMPService * ricmp = ICMPService::cast(right); - ICMPService * licmp = ICMPService::cast(left); - if (rtcpudp != NULL && ltcpudp != NULL) + int ls = ltcpudp->getDstRangeStart(); + int rs = rtcpudp->getDstRangeStart(); + if (lsgetDstRangeStart(); - int rs = rtcpudp->getDstRangeStart(); - if (lsgetDstRangeEnd(); - int re = rtcpudp->getDstRangeEnd(); - if (legetDstRangeEnd(); + int re = rtcpudp->getDstRangeEnd(); + if (legetProtocolNumber(); - int rpn = rip->getProtocolNumber(); - return (lpn < rpn); - } - if (ricmp != NULL && licmp != NULL) - { - int lpn = licmp->getInt("code"); - int rpn = ricmp->getInt("code"); - return (lpn < rpn); - } - } - else + if (rip != NULL && lip != NULL) { - return QTreeWidgetItem::operator < (other); + int lpn = lip->getProtocolNumber(); + int rpn = rip->getProtocolNumber(); + return (lpn < rpn); } + if (ricmp != NULL && licmp != NULL) + { + int lpn = licmp->getInt("code"); + int rpn = ricmp->getInt("code"); + return (lpn < rpn); + } + } + return QTreeWidgetItem::operator < (other); } diff --git a/src/gui/ObjectManipulator.cpp b/src/gui/ObjectManipulator.cpp index bdf998221..5a25a39a3 100644 --- a/src/gui/ObjectManipulator.cpp +++ b/src/gui/ObjectManipulator.cpp @@ -2564,11 +2564,13 @@ void ObjectManipulator::libChanged(int ln) ObjectTreeViewItem *otvi=dynamic_cast(lv->currentItem()); if (otvi == NULL) + { if (lv->invisibleRootItem()->childCount() > 0) - otvi = dynamic_cast(lv->invisibleRootItem()->child(0)); + otvi = dynamic_cast( + lv->invisibleRootItem()->child(0)); else assert(FALSE); - + } currentObj=otvi->getFWObject(); showObjectInTree( otvi ); diff --git a/src/gui/RuleSetView.cpp b/src/gui/RuleSetView.cpp index a6abb36cc..75e8e7629 100644 --- a/src/gui/RuleSetView.cpp +++ b/src/gui/RuleSetView.cpp @@ -181,10 +181,12 @@ QVariant RuleTableModel::headerData(int section, return f; } if (role == Qt::DecorationRole) + { if (ruleSetView->rulesDisabled[section]) return QVariant(ruleSetView->negIcon); else return QVariant(QIcon()); + } } return QAbstractTableModel::headerData(section, orientation, role ); diff --git a/src/gui/fakeWizard.cpp b/src/gui/fakeWizard.cpp index 15df667d4..432c65a5c 100644 --- a/src/gui/fakeWizard.cpp +++ b/src/gui/fakeWizard.cpp @@ -156,6 +156,7 @@ void FakeWizard::showPage(const int page) (previousRelevant(page) > -1) ); if (titleLabel) + { if (!pageTitles[page].isEmpty()) { titleLabel->setText(pageTitles[page]); @@ -163,7 +164,7 @@ void FakeWizard::showPage(const int page) } else titleLabel->hide(); - + } setCurrentPage(page); stackedWidget->setCurrentIndex(page); diff --git a/src/gui/printerStream.cpp b/src/gui/printerStream.cpp index ff734d558..94569170c 100644 --- a/src/gui/printerStream.cpp +++ b/src/gui/printerStream.cpp @@ -254,7 +254,8 @@ void printerStream::printQTable(QTableView *tbl, bool left_margin, bool top_marg int tblHeight = tbl->horizontalHeader()->height(); int columnsWidth = 0; - for (int i = 0; i < tbl->model()->columnCount(); columnsWidth += tbl->columnWidth(i), i++); + for (int i = 0; i < tbl->model()->columnCount(); + columnsWidth += tbl->columnWidth(i), i++) ; if ( tblHeight + tbl->rowHeight(0) > getYSpace() ) { diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index 3a2a1f4f3..a754d75bb 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -403,8 +403,6 @@ QString getAddrByName(const QString &name, int af_type) try { results = DNS::getHostByName(name.toAscii().constData(), af_type); - if (fwbdebug) qDebug("utils::getAddrByName: obtained %ld addresses", - results.size()); } catch (FWException &e) { if (fwbdebug) qDebug("utils::getAddrByName: DNS lookup error: %s", @@ -499,7 +497,7 @@ QString wordWrap(const QString& s, int maxchinline) else { res.append(s.mid(linestart,pos-linestart)); - while (++pos< s.length() && s.at(pos).isSpace()); + while (++pos< s.length() && s.at(pos).isSpace()) ; if (pos protocols; -enum { FIXUP_ENABLE=0, FIXUP_DISABLE=1, FIXUP_SKIP=2 } fixupStatus; +FixupTypes fixupStatus; /* * par1 and par2 are parameters for the inspection protocol. These are