Several warning fixes

openmw-35
scrawl 10 years ago
parent 8b5effe3e0
commit c883a73d30

@ -27,8 +27,8 @@ struct Arguments
void replaceAll(std::string& str, const std::string& needle, const std::string& substitute)
{
int pos = str.find(needle);
while(pos != -1)
size_t pos = str.find(needle);
while(pos != std::string::npos)
{
str.replace(pos, needle.size(), substitute);
pos = str.find(needle);
@ -138,8 +138,8 @@ bool parseOptions (int argc, char** argv, Arguments &info)
else if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
info.outdir = variables["input-file"].as< std::vector<std::string> >()[1];
info.longformat = variables.count("long");
info.fullpath = variables.count("full-path");
info.longformat = variables.count("long") != 0;
info.fullpath = variables.count("full-path") != 0;
return true;
}

@ -22,7 +22,7 @@ struct ESMData
{
std::string author;
std::string description;
int version;
unsigned int version;
std::vector<ESM::Header::MasterData> masters;
std::deque<EsmTool::RecordBase *> mRecords;
@ -48,9 +48,9 @@ const std::set<int> ESMData::sLabeledRec =
// Based on the legacy struct
struct Arguments
{
unsigned int raw_given;
unsigned int quiet_given;
unsigned int loadcells_given;
bool raw_given;
bool quiet_given;
bool loadcells_given;
bool plain_given;
std::string mode;
@ -177,10 +177,10 @@ bool parseOptions (int argc, char** argv, Arguments &info)
if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
info.outname = variables["input-file"].as< std::vector<std::string> >()[1];
info.raw_given = variables.count ("raw");
info.quiet_given = variables.count ("quiet");
info.loadcells_given = variables.count ("loadcells");
info.plain_given = (variables.count("plain") > 0);
info.raw_given = variables.count ("raw") != 0;
info.quiet_given = variables.count ("quiet") != 0;
info.loadcells_given = variables.count ("loadcells") != 0;
info.plain_given = variables.count("plain") != 0;
// Font encoding settings
info.encoding = variables["encoding"].as<std::string>();
@ -430,7 +430,7 @@ int clone(Arguments& info)
return 1;
}
int recordCount = info.data.mRecords.size();
size_t recordCount = info.data.mRecords.size();
int digitCount = 1; // For a nicer output
if (recordCount > 9) ++digitCount;
@ -501,9 +501,9 @@ int clone(Arguments& info)
if (!info.data.mCellRefs[ptr].empty()) {
typedef std::deque<ESM::CellRef> RefList;
RefList &refs = info.data.mCellRefs[ptr];
for (RefList::iterator it = refs.begin(); it != refs.end(); ++it)
for (RefList::iterator refIt = refs.begin(); refIt != refs.end(); ++refIt)
{
it->save(esm);
refIt->save(esm);
}
}
}
@ -511,7 +511,7 @@ int clone(Arguments& info)
esm.endRecord(name.toString());
saved++;
int perc = (saved / (float)recordCount)*100;
int perc = (int)((saved / (float)recordCount)*100);
if (perc % 10 == 0)
{
std::cerr << "\r" << perc << "%";

@ -13,14 +13,13 @@
#include <components/esm/loadweap.hpp>
#include <components/esm/aipackage.hpp>
#include <iostream>
#include <boost/format.hpp>
std::string bodyPartLabel(int idx)
{
if (idx >= 0 && idx <= 26)
{
const char *bodyPartLabels[] = {
static const char *bodyPartLabels[] = {
"Head",
"Hair",
"Neck",
@ -59,7 +58,7 @@ std::string meshPartLabel(int idx)
{
if (idx >= 0 && idx <= ESM::BodyPart::MP_Tail)
{
const char *meshPartLabels[] = {
static const char *meshPartLabels[] = {
"Head",
"Hair",
"Neck",
@ -86,7 +85,7 @@ std::string meshTypeLabel(int idx)
{
if (idx >= 0 && idx <= ESM::BodyPart::MT_Armor)
{
const char *meshTypeLabels[] = {
static const char *meshTypeLabels[] = {
"Skin",
"Clothing",
"Armor"
@ -101,7 +100,7 @@ std::string clothingTypeLabel(int idx)
{
if (idx >= 0 && idx <= 9)
{
const char *clothingTypeLabels[] = {
static const char *clothingTypeLabels[] = {
"Pants",
"Shoes",
"Shirt",
@ -123,7 +122,7 @@ std::string armorTypeLabel(int idx)
{
if (idx >= 0 && idx <= 10)
{
const char *armorTypeLabels[] = {
static const char *armorTypeLabels[] = {
"Helmet",
"Cuirass",
"Left Pauldron",
@ -146,7 +145,7 @@ std::string dialogTypeLabel(int idx)
{
if (idx >= 0 && idx <= 4)
{
const char *dialogTypeLabels[] = {
static const char *dialogTypeLabels[] = {
"Topic",
"Voice",
"Greeting",
@ -165,7 +164,7 @@ std::string questStatusLabel(int idx)
{
if (idx >= 0 && idx <= 4)
{
const char *questStatusLabels[] = {
static const char *questStatusLabels[] = {
"None",
"Name",
"Finished",
@ -182,7 +181,7 @@ std::string creatureTypeLabel(int idx)
{
if (idx >= 0 && idx <= 3)
{
const char *creatureTypeLabels[] = {
static const char *creatureTypeLabels[] = {
"Creature",
"Daedra",
"Undead",
@ -198,7 +197,7 @@ std::string soundTypeLabel(int idx)
{
if (idx >= 0 && idx <= 7)
{
const char *soundTypeLabels[] = {
static const char *soundTypeLabels[] = {
"Left Foot",
"Right Foot",
"Swim Left",
@ -218,7 +217,7 @@ std::string weaponTypeLabel(int idx)
{
if (idx >= 0 && idx <= 13)
{
const char *weaponTypeLabels[] = {
static const char *weaponTypeLabels[] = {
"Short Blade One Hand",
"Long Blade One Hand",
"Long Blade Two Hand",

@ -25,7 +25,7 @@ void printAIPackage(ESM::AIPackage p)
{
std::cout << " Travel Coordinates: (" << p.mTravel.mX << ","
<< p.mTravel.mY << "," << p.mTravel.mZ << ")" << std::endl;
std::cout << " Travel Unknown: " << (int)p.mTravel.mUnk << std::endl;
std::cout << " Travel Unknown: " << p.mTravel.mUnk << std::endl;
}
else if (p.mType == ESM::AI_Follow || p.mType == ESM::AI_Escort)
{
@ -33,12 +33,12 @@ void printAIPackage(ESM::AIPackage p)
<< p.mTarget.mY << "," << p.mTarget.mZ << ")" << std::endl;
std::cout << " Duration: " << p.mTarget.mDuration << std::endl;
std::cout << " Target ID: " << p.mTarget.mId.toString() << std::endl;
std::cout << " Unknown: " << (int)p.mTarget.mUnk << std::endl;
std::cout << " Unknown: " << p.mTarget.mUnk << std::endl;
}
else if (p.mType == ESM::AI_Activate)
{
std::cout << " Name: " << p.mActivate.mName.toString() << std::endl;
std::cout << " Activate Unknown: " << (int)p.mActivate.mUnk << std::endl;
std::cout << " Activate Unknown: " << p.mActivate.mUnk << std::endl;
}
else {
std::cout << " BadPackage: " << boost::format("0x%08x") % p.mType << std::endl;
@ -89,6 +89,7 @@ std::string ruleString(ESM::DialInfo::SelectStruct ss)
case 'A': if (indicator == 'R') type_str = "Not Race"; break;
case 'B': if (indicator == 'L') type_str = "Not Cell"; break;
case 'C': if (indicator == 's') type_str = "Not Local"; break;
default: break;
}
// Append the variable name to the function string if any.
@ -110,6 +111,7 @@ std::string ruleString(ESM::DialInfo::SelectStruct ss)
case '3': oper_str = ">="; break;
case '4': oper_str = "< "; break;
case '5': oper_str = "<="; break;
default: break;
}
std::ostringstream stream;
@ -430,7 +432,7 @@ void Record<ESM::Apparatus>::print()
std::cout << " Icon: " << mData.mIcon << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " Type: " << apparatusTypeLabel(mData.mData.mType)
<< " (" << (int)mData.mData.mType << ")" << std::endl;
<< " (" << mData.mData.mType << ")" << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
@ -816,7 +818,7 @@ void Record<ESM::Land>::print()
// Seems like this should done with reference counting in the
// loader to me. But I'm not really knowledgable about this
// record type yet. --Cory
bool wasLoaded = mData.mDataLoaded;
bool wasLoaded = (mData.mDataLoaded != 0);
if (mData.mDataTypes) mData.loadData(mData.mDataTypes);
if (mData.mDataLoaded)
{
@ -999,7 +1001,7 @@ void Record<ESM::NPC>::print()
<< (unsigned int)((unsigned char)mData.mNpdt12.mUnknown2) << std::endl;
std::cout << " Unknown3: "
<< (unsigned int)((unsigned char)mData.mNpdt12.mUnknown3) << std::endl;
std::cout << " Gold: " << (int)mData.mNpdt12.mGold << std::endl;
std::cout << " Gold: " << mData.mNpdt12.mGold << std::endl;
}
else {
std::cout << " Level: " << mData.mNpdt52.mLevel << std::endl;
@ -1021,7 +1023,7 @@ void Record<ESM::NPC>::print()
std::cout << " Skills:" << std::endl;
for (int i = 0; i != ESM::Skill::Length; i++)
std::cout << " " << skillLabel(i) << ": "
<< (int)((unsigned char)mData.mNpdt52.mSkills[i]) << std::endl;
<< (int)(mData.mNpdt52.mSkills[i]) << std::endl;
std::cout << " Health: " << mData.mNpdt52.mHealth << std::endl;
std::cout << " Magicka: " << mData.mNpdt52.mMana << std::endl;
@ -1123,9 +1125,9 @@ void Record<ESM::Race>::print()
std::cout << (male ? " Male:" : " Female:") << std::endl;
for (int i=0; i<8; ++i)
std::cout << " " << sAttributeNames[i] << ": "
<< mData.mData.mAttributeValues[i].getValue (male) << std::endl;
for (int j=0; j<8; ++j)
std::cout << " " << sAttributeNames[j] << ": "
<< mData.mData.mAttributeValues[j].getValue (male) << std::endl;
std::cout << " Height: " << mData.mData.mHeight.getValue (male) << std::endl;
std::cout << " Weight: " << mData.mData.mWeight.getValue (male) << std::endl;

@ -19,7 +19,7 @@ namespace EsmTool
{
protected:
std::string mId;
int mFlags;
uint32_t mFlags;
ESM::NAME mType;
bool mPrintPlain;
@ -40,11 +40,11 @@ namespace EsmTool
mId = id;
}
int getFlags() const {
uint32_t getFlags() const {
return mFlags;
}
void setFlags(int flags) {
void setFlags(uint32_t flags) {
mFlags = flags;
}
@ -52,10 +52,6 @@ namespace EsmTool
return mType;
}
bool getPrintPlain() const {
return mPrintPlain;
}
void setPrintPlain(bool plain) {
mPrintPlain = plain;
}

@ -12,7 +12,7 @@ namespace bfs = boost::filesystem;
int main(int argc, const char** argv)
int main(int argc, char** argv)
{
try
{

@ -69,7 +69,7 @@ namespace MWBase
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
virtual void readRecord (ESM::ESMReader& reader, uint32_t type) = 0;
/// Changes faction1's opinion of faction2 by \a diff.
virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff) = 0;

@ -92,7 +92,7 @@ namespace MWBase
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
virtual void readRecord (ESM::ESMReader& reader, uint32_t type) = 0;
};
}

@ -193,7 +193,7 @@ namespace MWBase
virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
virtual void readRecord (ESM::ESMReader& reader, uint32_t type) = 0;
virtual void clear() = 0;

@ -310,7 +310,7 @@ namespace MWBase
virtual void clear() = 0;
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
virtual void readRecord (ESM::ESMReader& reader, uint32_t type) = 0;
virtual int countSavedGameRecords() const = 0;
/// Does the current stack of GUI-windows permit saving?

@ -108,7 +108,7 @@ namespace MWBase
virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type,
virtual void readRecord (ESM::ESMReader& reader, uint32_t type,
const std::map<int, int>& contentFileMap) = 0;
virtual MWWorld::CellStore *getExterior (int x, int y) = 0;

@ -647,7 +647,7 @@ namespace MWDialogue
writer.endRecord (ESM::REC_DIAS);
}
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)
void DialogueManager::readRecord (ESM::ESMReader& reader, uint32_t type)
{
if (type==ESM::REC_DIAS)
{

@ -92,7 +92,7 @@ namespace MWDialogue
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
virtual void readRecord (ESM::ESMReader& reader, uint32_t type);
/// Changes faction1's opinion of faction2 by \a diff.
virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff);

@ -227,7 +227,7 @@ namespace MWDialogue
}
}
void Journal::readRecord (ESM::ESMReader& reader, int32_t type)
void Journal::readRecord (ESM::ESMReader& reader, uint32_t type)
{
if (type==ESM::REC_JOUR || type==ESM::REC_JOUR_LEGACY)
{

@ -71,7 +71,7 @@ namespace MWDialogue
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
virtual void readRecord (ESM::ESMReader& reader, uint32_t type);
};
}

@ -886,7 +886,7 @@ namespace MWGui
writer.endRecord(ESM::REC_GMAP);
}
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)
void MapWindow::readRecord(ESM::ESMReader &reader, uint32_t type)
{
if (type == ESM::REC_GMAP)
{

@ -177,7 +177,7 @@ namespace MWGui
void clear();
void write (ESM::ESMWriter& writer, Loading::Listener& progress);
void readRecord (ESM::ESMReader& reader, int32_t type);
void readRecord (ESM::ESMReader& reader, uint32_t type);
private:
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);

@ -431,7 +431,7 @@ namespace MWGui
writer.endRecord(ESM::REC_KEYS);
}
void QuickKeysMenu::readRecord(ESM::ESMReader &reader, int32_t type)
void QuickKeysMenu::readRecord(ESM::ESMReader &reader, uint32_t type)
{
if (type != ESM::REC_KEYS)
return;

@ -47,7 +47,7 @@ namespace MWGui
void write (ESM::ESMWriter& writer);
void readRecord (ESM::ESMReader& reader, int32_t type);
void readRecord (ESM::ESMReader& reader, uint32_t type);
void clear();

@ -1620,7 +1620,7 @@ namespace MWGui
}
}
void WindowManager::readRecord(ESM::ESMReader &reader, int32_t type)
void WindowManager::readRecord(ESM::ESMReader &reader, uint32_t type)
{
if (type == ESM::REC_GMAP)
mMap->readRecord(reader, type);

@ -306,7 +306,7 @@ namespace MWGui
virtual void clear();
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress);
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
virtual void readRecord (ESM::ESMReader& reader, uint32_t type);
virtual int countSavedGameRecords() const;
/// Does the current stack of GUI-windows permit saving?

@ -1468,7 +1468,7 @@ namespace MWMechanics
writer.endRecord(ESM::REC_DCOU);
}
void Actors::readRecord (ESM::ESMReader& reader, int32_t type)
void Actors::readRecord (ESM::ESMReader& reader, uint32_t type)
{
if (type == ESM::REC_DCOU)
{

@ -128,7 +128,7 @@ namespace MWMechanics
void write (ESM::ESMWriter& writer, Loading::Listener& listener) const;
void readRecord (ESM::ESMReader& reader, int32_t type);
void readRecord (ESM::ESMReader& reader, uint32_t type);
void clear(); // Clear death counter

@ -1360,7 +1360,7 @@ namespace MWMechanics
mActors.write(writer, listener);
}
void MechanicsManager::readRecord(ESM::ESMReader &reader, int32_t type)
void MechanicsManager::readRecord(ESM::ESMReader &reader, uint32_t type)
{
mActors.readRecord(reader, type);
}

@ -158,7 +158,7 @@ namespace MWMechanics
virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
virtual void readRecord (ESM::ESMReader& reader, uint32_t type);
virtual void clear();

@ -145,7 +145,7 @@ namespace MWScript
}
}
bool GlobalScripts::readRecord (ESM::ESMReader& reader, int32_t type)
bool GlobalScripts::readRecord (ESM::ESMReader& reader, uint32_t type)
{
if (type==ESM::REC_GSCR)
{

@ -62,7 +62,7 @@ namespace MWScript
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type);
bool readRecord (ESM::ESMReader& reader, uint32_t type);
///< Records for variables that do not exist are dropped silently.
///
/// \return Known type?

@ -299,7 +299,7 @@ void MWWorld::Cells::write (ESM::ESMWriter& writer, Loading::Listener& progress)
}
}
bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, int32_t type,
bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, uint32_t type,
const std::map<int, int>& contentFileMap)
{
if (type==ESM::REC_CSTA)

@ -76,7 +76,7 @@ namespace MWWorld
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type,
bool readRecord (ESM::ESMReader& reader, uint32_t type,
const std::map<int, int>& contentFileMap);
};
}

@ -175,7 +175,7 @@ void ESMStore::setUp()
mCreatureLists.write (writer, progress);
}
bool ESMStore::readRecord (ESM::ESMReader& reader, int32_t type)
bool ESMStore::readRecord (ESM::ESMReader& reader, uint32_t type)
{
switch (type)
{

@ -233,7 +233,7 @@ namespace MWWorld
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type);
bool readRecord (ESM::ESMReader& reader, uint32_t type);
///< \return Known type?
};

@ -88,7 +88,7 @@ namespace MWWorld
}
}
bool Globals::readRecord (ESM::ESMReader& reader, int32_t type)
bool Globals::readRecord (ESM::ESMReader& reader, uint32_t type)
{
if (type==ESM::REC_GLOB)
{

@ -53,7 +53,7 @@ namespace MWWorld
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type);
bool readRecord (ESM::ESMReader& reader, uint32_t type);
///< Records for variables that do not exist are dropped silently.
///
/// \return Known type?

@ -227,7 +227,7 @@ namespace MWWorld
writer.endRecord (ESM::REC_PLAY);
}
bool Player::readRecord (ESM::ESMReader& reader, int32_t type)
bool Player::readRecord (ESM::ESMReader& reader, uint32_t type)
{
if (type==ESM::REC_PLAY)
{

@ -102,7 +102,7 @@ namespace MWWorld
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type);
bool readRecord (ESM::ESMReader& reader, uint32_t type);
int getNewCrimeId(); // get new id for witnesses
void recordCrimeId(); // record the paid crime id when bounty is 0

@ -343,7 +343,7 @@ namespace MWWorld
}
}
bool ProjectileManager::readRecord(ESM::ESMReader &reader, int32_t type)
bool ProjectileManager::readRecord(ESM::ESMReader &reader, uint32_t type)
{
if (type == ESM::REC_PROJ)
{

@ -53,7 +53,7 @@ namespace MWWorld
void clear();
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type);
bool readRecord (ESM::ESMReader& reader, uint32_t type);
int countSavedGameRecords() const;
private:

@ -762,7 +762,7 @@ void WeatherManager::write(ESM::ESMWriter& writer, Loading::Listener& progress)
writer.endRecord(ESM::REC_WTHR);
}
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)
bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type)
{
if(ESM::REC_WTHR == type)
{

@ -199,7 +199,7 @@ namespace MWWorld
void write(ESM::ESMWriter& writer, Loading::Listener& progress);
bool readRecord(ESM::ESMReader& reader, int32_t type);
bool readRecord(ESM::ESMReader& reader, uint32_t type);
private:
float mHour;

@ -345,7 +345,7 @@ namespace MWWorld
writer.endRecord(ESM::REC_CAM_);
}
void World::readRecord (ESM::ESMReader& reader, int32_t type,
void World::readRecord (ESM::ESMReader& reader, uint32_t type,
const std::map<int, int>& contentFileMap)
{
switch (type)

@ -170,7 +170,7 @@ namespace MWWorld
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type,
virtual void readRecord (ESM::ESMReader& reader, uint32_t type,
const std::map<int, int>& contentFileMap);
virtual CellStore *getExterior (int x, int y);

@ -23,7 +23,7 @@ template <int LEN>
union NAME_T
{
char name[LEN];
int32_t val;
uint32_t val;
bool operator==(const char *str) const
{

Loading…
Cancel
Save