diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index 4fbf06217..3d94f2b90 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -54,7 +54,7 @@ namespace *(image->data(x,y)+2) = *it++; *(image->data(x,y)+1) = *it++; *image->data(x,y) = *it++; - it++; // skip alpha + ++it; // skip alpha } } diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index f90ba4184..f2fcdb711 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -1,5 +1,6 @@ #include "importer.hpp" +#include #include #include #include @@ -897,8 +898,13 @@ std::time_t MwIniImporter::lastWriteTime(const boost::filesystem::path& filename boost::filesystem::path resolved = filename; #endif writeTime = boost::filesystem::last_write_time(resolved); - std::cout << "content file: " << resolved << " timestamp = (" << writeTime << - ") " << asctime(localtime(&writeTime)) << std::endl; + + // print timestamp + const int size=1024; + char timeStrBuffer[size]; + if (std::strftime(timeStrBuffer, size, "%x %X", localtime(&writeTime)) > 0) + std::cout << "content file: " << resolved << " timestamp = (" << writeTime << + ") " << timeStrBuffer << std::endl; } else { diff --git a/apps/opencs/model/doc/loader.cpp b/apps/opencs/model/doc/loader.cpp index cb3ff2cd0..166e6f3db 100644 --- a/apps/opencs/model/doc/loader.cpp +++ b/apps/opencs/model/doc/loader.cpp @@ -45,13 +45,12 @@ void CSMDoc::Loader::load() bool done = false; - const int batchingSize = 50; - try { if (iter->second.mRecordsLeft) { Messages messages (Message::Severity_Error); + const int batchingSize = 50; for (int i=0; igetData().continueLoading (messages)) { diff --git a/apps/opencs/model/tools/magiceffectcheck.cpp b/apps/opencs/model/tools/magiceffectcheck.cpp index 5435881b3..ab8b3b68b 100644 --- a/apps/opencs/model/tools/magiceffectcheck.cpp +++ b/apps/opencs/model/tools/magiceffectcheck.cpp @@ -7,7 +7,7 @@ namespace { - void addMessageIfNotEmpty(CSMDoc::Messages &messages, const CSMWorld::UniversalId &id, const std::string text) + void addMessageIfNotEmpty(CSMDoc::Messages &messages, const CSMWorld::UniversalId &id, const std::string& text) { if (!text.empty()) { diff --git a/apps/opencs/model/tools/search.cpp b/apps/opencs/model/tools/search.cpp index 0409199af..0c068ba11 100644 --- a/apps/opencs/model/tools/search.cpp +++ b/apps/opencs/model/tools/search.cpp @@ -120,24 +120,25 @@ QString CSMTools::Search::flatten (const QString& text) const return flat; } -CSMTools::Search::Search() : mType (Type_None), mPaddingBefore (10), mPaddingAfter (10) {} +CSMTools::Search::Search() : mType (Type_None), mValue (0), mIdColumn (0), mTypeColumn (0), + mPaddingBefore (10), mPaddingAfter (10) {} CSMTools::Search::Search (Type type, const std::string& value) -: mType (type), mText (value), mPaddingBefore (10), mPaddingAfter (10) +: mType (type), mText (value), mValue (0), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10) { if (type!=Type_Text && type!=Type_Id) throw std::logic_error ("Invalid search parameter (string)"); } CSMTools::Search::Search (Type type, const QRegExp& value) -: mType (type), mRegExp (value), mPaddingBefore (10), mPaddingAfter (10) +: mType (type), mRegExp (value), mValue (0), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10) { if (type!=Type_TextRegEx && type!=Type_IdRegEx) throw std::logic_error ("Invalid search parameter (RegExp)"); } CSMTools::Search::Search (Type type, int value) -: mType (type), mValue (value), mPaddingBefore (10), mPaddingAfter (10) +: mType (type), mValue (value), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10) { if (type!=Type_RecordState) throw std::logic_error ("invalid search parameter (int)"); diff --git a/apps/opencs/model/tools/soundgencheck.cpp b/apps/opencs/model/tools/soundgencheck.cpp index bdf89f19d..a36c494a1 100644 --- a/apps/opencs/model/tools/soundgencheck.cpp +++ b/apps/opencs/model/tools/soundgencheck.cpp @@ -26,7 +26,7 @@ void CSMTools::SoundGenCheckStage::perform(int stage, CSMDoc::Messages &messages return; } - const ESM::SoundGenerator soundGen = record.get(); + const ESM::SoundGenerator& soundGen = record.get(); CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_SoundGen, soundGen.mId); if (!soundGen.mCreature.empty()) diff --git a/apps/opencs/model/world/nestedcoladapterimp.cpp b/apps/opencs/model/world/nestedcoladapterimp.cpp index bfacc15dc..92b4b9e62 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.cpp +++ b/apps/opencs/model/world/nestedcoladapterimp.cpp @@ -277,7 +277,7 @@ namespace CSMWorld // WARNING: Assumed that the table view has the same order as std::map std::map::iterator iter = reactions.begin(); for(int i = 0; i < rowToRemove; ++i) - iter++; + ++iter; reactions.erase(iter); record.setModified (faction); @@ -314,7 +314,7 @@ namespace CSMWorld // WARNING: Assumed that the table view has the same order as std::map std::map::const_iterator iter = reactions.begin(); for(int i = 0; i < subRowIndex; ++i) - iter++; + ++iter; switch (subColIndex) { case 0: return QString((*iter).first.c_str()); @@ -337,7 +337,7 @@ namespace CSMWorld // WARNING: Assumed that the table view has the same order as std::map std::map::iterator iter = reactions.begin(); for(int i = 0; i < subRowIndex; ++i) - iter++; + ++iter; std::string factionId = (*iter).first; int reaction = (*iter).second; diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index 90a710fc8..039624c84 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -1153,7 +1153,7 @@ QVariant CSMWorld::CreatureAttributesRefIdAdapter::getNestedData (const RefIdCol const Record& record = static_cast&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature))); - const ESM::Creature creature = record.get(); + const ESM::Creature& creature = record.get(); if (subColIndex == 0) return subRowIndex; @@ -1259,7 +1259,7 @@ QVariant CSMWorld::CreatureAttackRefIdAdapter::getNestedData (const RefIdColumn const Record& record = static_cast&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature))); - const ESM::Creature creature = record.get(); + const ESM::Creature& creature = record.get(); if (subRowIndex < 0 || subRowIndex > 2 || subColIndex < 0 || subColIndex > 2) throw std::runtime_error ("index out of range"); @@ -1337,7 +1337,7 @@ QVariant CSMWorld::CreatureMiscRefIdAdapter::getNestedData (const RefIdColumn *c const Record& record = static_cast&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature))); - const ESM::Creature creature = record.get(); + const ESM::Creature& creature = record.get(); switch (subColIndex) { diff --git a/apps/opencs/view/world/datadisplaydelegate.cpp b/apps/opencs/view/world/datadisplaydelegate.cpp index 51d7137ec..9db16d593 100644 --- a/apps/opencs/view/world/datadisplaydelegate.cpp +++ b/apps/opencs/view/world/datadisplaydelegate.cpp @@ -140,7 +140,7 @@ void CSVWorld::DataDisplayDelegate::settingChanged (const CSMPrefs::Setting *set } -void CSVWorld::DataDisplayDelegateFactory::add (int enumValue, QString enumName, QString iconFilename) +void CSVWorld::DataDisplayDelegateFactory::add (int enumValue, const QString& enumName, const QString& iconFilename) { mIcons.push_back (std::make_pair(enumValue, QIcon(iconFilename))); EnumDelegateFactory::add(enumValue, enumName); diff --git a/apps/opencs/view/world/datadisplaydelegate.hpp b/apps/opencs/view/world/datadisplaydelegate.hpp index cde109fd4..540216d78 100755 --- a/apps/opencs/view/world/datadisplaydelegate.hpp +++ b/apps/opencs/view/world/datadisplaydelegate.hpp @@ -83,7 +83,7 @@ namespace CSVWorld protected: - void add (int enumValue,const QString enumName, const QString iconFilename); + void add (int enumValue, const QString& enumName, const QString& iconFilename); }; diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 25bd8e8ee..0a79aac2b 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -674,8 +674,6 @@ void CSVWorld::EditWidget::remake(int row) { mNestedTableMapper->addMapping (editor, col); - std::string disString = tree->nestedHeaderData (i, col, - Qt::Horizontal, Qt::DisplayRole).toString().toStdString(); // Need to use Qt::DisplayRole in order to get the correct string // from CSMWorld::Columns QLabel* label = new QLabel (tree->nestedHeaderData (i, col, diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 3cea00e45..3aeeedad1 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -305,7 +305,6 @@ namespace MWMechanics else { distantCombat = (rangeAttack > 500); - weapRange = 150.f; } diff --git a/apps/openmw/mwmechanics/aifollow.cpp b/apps/openmw/mwmechanics/aifollow.cpp index d9356da93..1430d42f2 100644 --- a/apps/openmw/mwmechanics/aifollow.cpp +++ b/apps/openmw/mwmechanics/aifollow.cpp @@ -129,12 +129,14 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte ESM::Pathgrid::Point dest = target.getRefData().getPosition().pos; float dist = distance(dest, pos.pos[0], pos.pos[1], pos.pos[2]); - const float threshold = 10; if (storage.mMoving) //Stop when you get close storage.mMoving = (dist > followDistance); else + { + const float threshold = 10; storage.mMoving = (dist > followDistance + threshold); + } if(!storage.mMoving) { diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index f6883ae35..57bf7919a 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -506,6 +506,9 @@ namespace MWPhysics private: btHeightfieldTerrainShape* mShape; btCollisionObject* mCollisionObject; + + void operator=(const HeightField&); + HeightField(const HeightField&); }; // -------------------------------------------------------------- diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 20e3dc07c..635116db0 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -366,7 +366,7 @@ public: for (unsigned int i=0; isize(); ++i) { float alpha = 1.f; - if (mMeshType == 0) alpha = i%2 ? 0.f : 1.f; // this is a cylinder, so every second vertex belongs to the bottom-most row + if (mMeshType == 0) alpha = (i%2) ? 0.f : 1.f; // this is a cylinder, so every second vertex belongs to the bottom-most row else if (mMeshType == 1) { if (i>= 49 && i <= 64) alpha = 0.f; // bottom-most row diff --git a/components/contentselector/model/contentmodel.cpp b/components/contentselector/model/contentmodel.cpp index 8dc4351f6..26f0a4806 100644 --- a/components/contentselector/model/contentmodel.cpp +++ b/components/contentselector/model/contentmodel.cpp @@ -110,12 +110,11 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index bool gamefileChecked = (file->gameFiles().count() == 0); foreach (const QString &fileName, file->gameFiles()) { - bool depFound = false; foreach (EsmFile *dependency, mFiles) { //compare filenames only. Multiple instances //of the filename (with different paths) is not relevant here. - depFound = (dependency->fileName().compare(fileName, Qt::CaseInsensitive) == 0); + bool depFound = (dependency->fileName().compare(fileName, Qt::CaseInsensitive) == 0); if (!depFound) continue; diff --git a/components/contentselector/model/loadordererror.hpp b/components/contentselector/model/loadordererror.hpp index 2b840cf69..7067f1f22 100644 --- a/components/contentselector/model/loadordererror.hpp +++ b/components/contentselector/model/loadordererror.hpp @@ -17,12 +17,9 @@ namespace ContentSelectorModel ErrorCode_LoadOrder = 3 }; - inline LoadOrderError() : mErrorCode(ErrorCode_None) {}; + inline LoadOrderError() : mErrorCode(ErrorCode_None) {} inline LoadOrderError(ErrorCode errorCode, QString fileName) - { - mErrorCode = errorCode; - mFileName = fileName; - } + : mErrorCode(errorCode), mFileName(fileName) {} inline ErrorCode errorCode() const { return mErrorCode; } inline QString fileName() const { return mFileName; } QString toolTip() const; diff --git a/components/myguiplatform/myguiplatform.hpp b/components/myguiplatform/myguiplatform.hpp index 56562e12a..90d45ce20 100644 --- a/components/myguiplatform/myguiplatform.hpp +++ b/components/myguiplatform/myguiplatform.hpp @@ -47,6 +47,9 @@ namespace osgMyGUI DataManager* mDataManager; MyGUI::LogManager* mLogManager; LogFacility* mLogFacility; + + void operator=(const Platform&); + Platform(const Platform&); }; } diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 28f61e4b6..d0abc9ead 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -258,7 +258,7 @@ void UVController::apply(osg::StateSet* stateset, osg::NodeVisitor* nv) mat.setTrans(uTrans, vTrans, 0); // setting once is enough because all other texture units share the same TexMat (see setDefaults). - if (mTextureUnits.size()) + if (!mTextureUnits.empty()) { osg::TexMat* texMat = static_cast(stateset->getTextureAttribute(*mTextureUnits.begin(), osg::StateAttribute::TEXMAT)); texMat->setMatrix(mat); diff --git a/components/sceneutil/riggeometry.cpp b/components/sceneutil/riggeometry.cpp index 88b907faf..be8d97a4c 100644 --- a/components/sceneutil/riggeometry.cpp +++ b/components/sceneutil/riggeometry.cpp @@ -177,7 +177,7 @@ bool RigGeometry::initFromParentSkeleton(osg::NodeVisitor* nv) } } - for (Vertex2BoneMap::iterator it = vertex2BoneMap.begin(); it != vertex2BoneMap.end(); it++) + for (Vertex2BoneMap::iterator it = vertex2BoneMap.begin(); it != vertex2BoneMap.end(); ++it) { mBone2VertexMap[it->second].push_back(it->first); } diff --git a/components/sceneutil/workqueue.cpp b/components/sceneutil/workqueue.cpp index b642687f0..26a392be4 100644 --- a/components/sceneutil/workqueue.cpp +++ b/components/sceneutil/workqueue.cpp @@ -59,7 +59,7 @@ WorkQueue::~WorkQueue() { { OpenThreads::ScopedLock lock(mMutex); - while (mQueue.size()) + while (!mQueue.empty()) { WorkItem* item = mQueue.front(); delete item; @@ -88,7 +88,7 @@ osg::ref_ptr WorkQueue::addWorkItem(WorkItem *item) WorkItem *WorkQueue::removeWorkItem() { OpenThreads::ScopedLock lock(mMutex); - while (!mQueue.size() && !mIsReleased) + while (mQueue.empty() && !mIsReleased) { mCondition.wait(&mMutex); }