Fix various warnings found by clang

- unused alias
- inefficient use of push_back
- exceptions not inheriting from std::exception
- weird use of a comma
- value compared against itself
pull/593/head
jvoisin 4 years ago
parent 57b501ad13
commit 38316cdaf8

@ -57,7 +57,7 @@ int main(int argc, char** argv)
else
{
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))
{
throw std::runtime_error("Output file already exists and does not end in .omwsave. Did you mean to use --compare?");

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

@ -201,7 +201,7 @@ QModelIndex CSMWorld::IdTree::parent (const QModelIndex& index) const
const std::pair<int, int>& address(unfoldIndexAddress(id));
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);
}
@ -216,7 +216,7 @@ unsigned int CSMWorld::IdTree::foldIndexAddress (const QModelIndex& index) const
std::pair< int, int > CSMWorld::IdTree::unfoldIndexAddress (unsigned int id) const
{
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;
int row = id / this->columnCount();

@ -115,7 +115,7 @@ namespace ESM
void Region::blank()
{
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;

@ -52,12 +52,7 @@ void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType ty
esm.getHNT (value, "FLTV");
if (type==VT_Short)
{
if (value!=value)
out = 0; // nan
else
out = static_cast<short> (value);
}
out = static_cast<short> (value);
else if (type==VT_Long)
out = static_cast<int> (value);
else

Loading…
Cancel
Save