Fix some warnings

Ref #127
This commit is contained in:
Daenyth 2014-06-27 22:19:23 -04:00
parent d3b4ef38a0
commit 6d3fe428e7
11 changed files with 21 additions and 13 deletions

View file

@ -58,8 +58,8 @@ IF(MSVC)
#set(CMAKE_CXX_FLAGS_DEBUG "/Zi") #set(CMAKE_CXX_FLAGS_DEBUG "/Zi")
ELSEIF (CMAKE_COMPILER_IS_GNUCXX) ELSEIF (CMAKE_COMPILER_IS_GNUCXX)
# linux/gcc, bsd/gcc, windows/mingw # linux/gcc, bsd/gcc, windows/mingw
set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") set(CMAKE_CXX_FLAGS_RELEASE "-s -O2 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-unused-parameter -Wno-inline -Wno-delete-non-virtual-dtor -Wno-error=sign-compare -Wno-reorder -Wno-missing-declarations")
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-error=unused-parameter -Wno-inline -Wno-error=delete-non-virtual-dtor -W-noerror=sign-compare -Wno-error=reorder -Wno-error=missing-declarations")
ELSE() ELSE()
# other: osx/llvm, bsd/llvm # other: osx/llvm, bsd/llvm
set(CMAKE_CXX_FLAGS_RELEASE "-O2") set(CMAKE_CXX_FLAGS_RELEASE "-O2")

View file

@ -31,7 +31,7 @@ enum ClientStatus {
StatusConnecting, StatusConnecting,
StatusAwaitingWelcome, StatusAwaitingWelcome,
StatusLoggingIn, StatusLoggingIn,
StatusLoggedIn, StatusLoggedIn
}; };
class AbstractClient : public QObject { class AbstractClient : public QObject {

View file

@ -16,7 +16,7 @@
const int CardDatabase::versionNeeded = 3; const int CardDatabase::versionNeeded = 3;
QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set) static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set)
{ {
xml.writeStartElement("set"); xml.writeStartElement("set");
xml.writeTextElement("name", set->getShortName()); xml.writeTextElement("name", set->getShortName());
@ -280,13 +280,13 @@ CardInfo::CardInfo(CardDatabase *_db,
name(_name), name(_name),
isToken(_isToken), isToken(_isToken),
sets(_sets), sets(_sets),
muIds(_muIds),
manacost(_manacost), manacost(_manacost),
cardtype(_cardtype), cardtype(_cardtype),
powtough(_powtough), powtough(_powtough),
text(_text), text(_text),
colors(_colors), colors(_colors),
loyalty(_loyalty), loyalty(_loyalty),
muIds(_muIds),
cipt(_cipt), cipt(_cipt),
tableRow(_tableRow), tableRow(_tableRow),
pixmap(NULL) pixmap(NULL)
@ -434,7 +434,7 @@ int CardInfo::getPreferredMuId()
return muIds[getPreferredSet()->getShortName()]; return muIds[getPreferredSet()->getShortName()];
} }
QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info) static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
{ {
xml.writeStartElement("card"); xml.writeStartElement("card");
xml.writeTextElement("name", info->getName()); xml.writeTextElement("name", info->getName());
@ -473,7 +473,7 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
} }
CardDatabase::CardDatabase(QObject *parent) CardDatabase::CardDatabase(QObject *parent)
: QObject(parent), loadStatus(NotLoaded), noCard(0) : QObject(parent), noCard(0), loadStatus(NotLoaded)
{ {
connect(settingsCache, SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged())); connect(settingsCache, SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged()));
connect(settingsCache, SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabase())); connect(settingsCache, SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabase()));

View file

@ -26,9 +26,9 @@ public:
}; };
private: private:
QString trm;
enum Type t; enum Type t;
enum Attr a; enum Attr a;
QString trm;
public: public:
CardFilter(QString term, Type type, Attr attr) : trm(term), t(type), a(attr) {}; CardFilter(QString term, Type type, Attr attr) : trm(term), t(type), a(attr) {};

View file

@ -340,6 +340,9 @@ void DeckListModel::sort(int column, Qt::SortOrder order)
break; break;
case 2: case 2:
sortMethod = ByPrice; sortMethod = ByPrice;
break;
default:
sortMethod = ByName;
} }
root->setSortMethod(sortMethod); root->setSortMethod(sortMethod);
sortHelper(root, order); sortHelper(root, order);

View file

@ -66,7 +66,7 @@ public:
const CardFilter::Attr attr; const CardFilter::Attr attr;
LogicMap(CardFilter::Attr a, FilterTree *parent) LogicMap(CardFilter::Attr a, FilterTree *parent)
: attr(a), p(parent) {} : p(parent), attr(a) {}
const FilterItemList *findTypeList(CardFilter::Type type) const; const FilterItemList *findTypeList(CardFilter::Type type) const;
FilterItemList *typeList(CardFilter::Type type); FilterItemList *typeList(CardFilter::Type type);
FilterTreeNode *parent() const; FilterTreeNode *parent() const;
@ -81,7 +81,7 @@ public:
const CardFilter::Type type; const CardFilter::Type type;
FilterItemList(CardFilter::Type t, LogicMap *parent) FilterItemList(CardFilter::Type t, LogicMap *parent)
: type(t), p(parent) {} : p(parent), type(t) {}
CardFilter::Attr attr() const { return p->attr; } CardFilter::Attr attr() const { return p->attr; }
FilterTreeNode *parent() const { return p; } FilterTreeNode *parent() const { return p; }
int termIndex(const QString &term) const; int termIndex(const QString &term) const;

View file

@ -55,7 +55,7 @@ QString translationPath = TRANSLATION_PATH;
QString translationPath = QString(); QString translationPath = QString();
#endif #endif
void myMessageOutput(QtMsgType /*type*/, const char *msg) static void myMessageOutput(QtMsgType /*type*/, const char *msg)
{ {
QFile file("qdebug.txt"); QFile file("qdebug.txt");
file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text); file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);

View file

@ -13,4 +13,6 @@ extern QString translationPath;
void installNewTranslator(); void installNewTranslator();
bool settingsValid();
#endif #endif

View file

@ -180,6 +180,7 @@ bool InnerDecklistNode::compare(AbstractDecklistNode *other) const
case 2: case 2:
return comparePrice(other); return comparePrice(other);
} }
return 0;
} }
bool InnerDecklistNode::compareNumber(AbstractDecklistNode *other) const bool InnerDecklistNode::compareNumber(AbstractDecklistNode *other) const
@ -226,6 +227,7 @@ bool AbstractDecklistCardNode::compare(AbstractDecklistNode *other) const
case ByPrice: case ByPrice:
return compareTotalPrice(other); return compareTotalPrice(other);
} }
return 0;
} }
bool AbstractDecklistCardNode::compareNumber(AbstractDecklistNode *other) const bool AbstractDecklistCardNode::compareNumber(AbstractDecklistNode *other) const
@ -351,6 +353,7 @@ DeckList::DeckList()
root = new InnerDecklistNode; root = new InnerDecklistNode;
} }
// TODO: http://qt-project.org/doc/qt-4.8/qobject.html#no-copy-constructor-or-assignment-operator
DeckList::DeckList(const DeckList &other) DeckList::DeckList(const DeckList &other)
: name(other.name), : name(other.name),
comments(other.comments), comments(other.comments),

View file

@ -64,7 +64,7 @@ void GameEventStorage::sendToGame(Server_Game *game)
} }
ResponseContainer::ResponseContainer(int _cmdId) ResponseContainer::ResponseContainer(int _cmdId)
: responseExtension(0), cmdId(_cmdId) : cmdId(_cmdId), responseExtension(0)
{ {
} }

View file

@ -17,7 +17,7 @@ public:
bool getImport() const { return import; } bool getImport() const { return import; }
void setImport(bool _import) { import = _import; } void setImport(bool _import) { import = _import; }
SetToDownload(const QString &_shortName, const QString &_longName, const QVariant &_cards, bool _import) SetToDownload(const QString &_shortName, const QString &_longName, const QVariant &_cards, bool _import)
: shortName(_shortName), longName(_longName), cards(_cards), import(_import) { } : shortName(_shortName), longName(_longName), import(_import), cards(_cards) { }
bool operator<(const SetToDownload &set) const { return longName.compare(set.longName, Qt::CaseInsensitive) < 0; } bool operator<(const SetToDownload &set) const { return longName.compare(set.longName, Qt::CaseInsensitive) < 0; }
}; };