1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 10:36:42 +00:00

Merge branch 'various_warn' into 'master'

Fix various warnings found by clang

See merge request OpenMW/openmw!758
This commit is contained in:
psi29a 2021-04-18 20:04:20 +00:00
commit 3423d3f882
5 changed files with 8 additions and 8 deletions

View file

@ -57,7 +57,7 @@ int main(int argc, char** argv)
else else
{ {
const std::string& ext = ".omwsave"; const std::string& ext = ".omwsave";
if (boost::filesystem::exists(boost::filesystem::path(outputFile)) if (bfs::exists(bfs::path(outputFile))
&& (outputFile.size() < ext.size() || outputFile.substr(outputFile.size()-ext.size()) != ext)) && (outputFile.size() < ext.size() || outputFile.substr(outputFile.size()-ext.size()) != ext))
{ {
throw std::runtime_error("Output file already exists and does not end in .omwsave. Did you mean to use --compare?"); throw std::runtime_error("Output file already exists and does not end in .omwsave. Did you mean to use --compare?");

View file

@ -76,6 +76,7 @@ void CSMWorld::ImportLandTexturesCommand::redo()
} }
std::vector<std::string> oldTextures; std::vector<std::string> oldTextures;
oldTextures.reserve(texIndices.size());
for (int index : texIndices) for (int index : texIndices)
{ {
oldTextures.push_back(LandTexture::createUniqueRecordId(oldPlugin, index)); oldTextures.push_back(LandTexture::createUniqueRecordId(oldPlugin, index));

View file

@ -201,7 +201,7 @@ QModelIndex CSMWorld::IdTree::parent (const QModelIndex& index) const
const std::pair<int, int>& address(unfoldIndexAddress(id)); const std::pair<int, int>& address(unfoldIndexAddress(id));
if (address.first >= this->rowCount() || address.second >= this->columnCount()) if (address.first >= this->rowCount() || address.second >= this->columnCount())
throw "Parent index is not present in the model"; throw std::logic_error("Parent index is not present in the model");
return createIndex(address.first, address.second); return createIndex(address.first, address.second);
} }
@ -216,7 +216,7 @@ unsigned int CSMWorld::IdTree::foldIndexAddress (const QModelIndex& index) const
std::pair< int, int > CSMWorld::IdTree::unfoldIndexAddress (unsigned int id) const std::pair< int, int > CSMWorld::IdTree::unfoldIndexAddress (unsigned int id) const
{ {
if (id == 0) if (id == 0)
throw "Attempt to unfold index id of the top level data cell"; throw std::runtime_error("Attempt to unfold index id of the top level data cell");
--id; --id;
int row = id / this->columnCount(); int row = id / this->columnCount();

View file

@ -115,7 +115,7 @@ namespace ESM
void Region::blank() void Region::blank()
{ {
mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast = mData.mRain = mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast = mData.mRain =
mData.mThunder = mData.mAsh, mData.mBlight = mData.mA = mData.mB = 0; mData.mThunder = mData.mAsh = mData.mBlight = mData.mA = mData.mB = 0;
mMapColor = 0; mMapColor = 0;

View file

@ -1,6 +1,7 @@
#include "variantimp.hpp" #include "variantimp.hpp"
#include <stdexcept> #include <stdexcept>
#include <cmath>
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
@ -52,12 +53,10 @@ void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType ty
esm.getHNT (value, "FLTV"); esm.getHNT (value, "FLTV");
if (type==VT_Short) if (type==VT_Short)
{ if (std::isnan(value))
if (value!=value) out = 0;
out = 0; // nan
else else
out = static_cast<short> (value); out = static_cast<short> (value);
}
else if (type==VT_Long) else if (type==VT_Long)
out = static_cast<int> (value); out = static_cast<int> (value);
else else