Merge branch 'coverity' into 'master'

Fix some Coverity issues

See merge request OpenMW/openmw!2082
This commit is contained in:
jvoisin 2022-07-03 16:29:05 +00:00
commit 498a835b77
22 changed files with 54 additions and 38 deletions

View file

@ -511,6 +511,8 @@ namespace DetourNavigator
const auto offMeshConnections = mOffMeshConnectionsManager.get().get(job.mChangedTile);
const PreparedNavMeshData* preparedNavMeshDataPtr = cachedNavMeshData ? &cachedNavMeshData.get() : preparedNavMeshData.get();
assert (preparedNavMeshDataPtr != nullptr);
const UpdateNavMeshStatus status = navMeshCacheItem.lock()->updateTile(job.mChangedTile, std::move(cachedNavMeshData),
makeNavMeshTileData(*preparedNavMeshDataPtr, offMeshConnections, job.mAgentBounds, job.mChangedTile, mSettings.get().mRecast));

View file

@ -19,7 +19,7 @@ class ESMWriter;
struct ContItem
{
int mCount;
int mCount{0};
std::string mItem;
};

View file

@ -104,7 +104,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
BTXT base;
if (reader.getExact(base))
{
assert(base.quadrant < 4 && base.quadrant >= 0 && "base texture quadrant index error");
assert(base.quadrant < 4 && "base texture quadrant index error");
reader.adjustFormId(base.formId);
mTextures[base.quadrant].base = std::move(base);
@ -126,8 +126,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
}
reader.get(layer.texture);
reader.adjustFormId(layer.texture.formId);
assert(layer.texture.quadrant < 4 && layer.texture.quadrant >= 0
&& "additional texture quadrant index error");
assert(layer.texture.quadrant < 4 && "additional texture quadrant index error");
#if 0
FormId txt = layer.texture.formId;
std::map<FormId, int>::iterator lb = uniqueTextures.lower_bound(txt);

View file

@ -56,11 +56,13 @@ namespace ESM4
{
ReaderContext::ReaderContext() : modIndex(0), recHeaderSize(sizeof(RecordHeader)),
filePos(0), recordRead(0), currWorld(0), currCell(0), cellGridValid(false)
filePos(0), fileRead(0), recordRead(0), currWorld(0), currCell(0), cellGridValid(false)
{
currCellGrid.cellId = 0;
currCellGrid.grid.x = 0;
currCellGrid.grid.y = 0;
subRecordHeader.typeId = 0;
subRecordHeader.dataSize = 0;
}
Reader::Reader(Files::IStreamPtr&& esmStream, const std::string& filename)

View file

@ -80,14 +80,17 @@ boost::filesystem::path LinuxPath::getGlobalConfigPath() const
boost::filesystem::path LinuxPath::getLocalPath() const
{
boost::filesystem::path localPath("./");
std::string binPath(pathconf(".", _PC_PATH_MAX), '\0');
const char *statusPaths[] = {"/proc/self/exe", "/proc/self/file", "/proc/curproc/exe", "/proc/curproc/file"};
for(const char *path : statusPaths)
{
if (readlink(path, &binPath[0], binPath.size()) != -1)
boost::filesystem::path statusPath(path);
if (!boost::filesystem::exists(statusPath)) continue;
statusPath = boost::filesystem::read_symlink(statusPath);
if (!boost::filesystem::is_empty(statusPath))
{
localPath = boost::filesystem::path(binPath).parent_path() / "/";
localPath = statusPath.parent_path() / "/";
break;
}
}

View file

@ -67,7 +67,6 @@ namespace fx
std::string mName;
bool mLegacyGLSL;
bool mUBO;
bool mSupportsNormals;
std::array<std::string, 3> mRenderTargets;

View file

@ -66,8 +66,8 @@ namespace fx
void initialiseOverride() override;
void notifyMouseButtonClick(MyGUI::Widget* sender);
MyGUI::Button* mCheckbutton;
MyGUI::Widget* mFill;
MyGUI::Button* mCheckbutton{nullptr};
MyGUI::Widget* mFill{nullptr};
};
template <class T, class UType>
@ -236,11 +236,11 @@ namespace fx
increment(uniform->mStep);
}
MyGUI::Button* mButtonDecrease;
MyGUI::Button* mButtonIncrease;
MyGUI::Widget* mDragger;
MyGUI::Widget* mFill;
MyGUI::TextBox* mValueLabel;
MyGUI::Button* mButtonDecrease{nullptr};
MyGUI::Button* mButtonIncrease{nullptr};
MyGUI::Widget* mDragger{nullptr};
MyGUI::Widget* mFill{nullptr};
MyGUI::TextBox* mValueLabel{nullptr};
T mValue;
int mLastPointerX;
@ -271,9 +271,9 @@ namespace fx
void initialiseOverride() override;
Gui::AutoSizedButton* mReset;
Gui::AutoSizedTextBox* mLabel;
MyGUI::Widget* mClient;
Gui::AutoSizedButton* mReset{nullptr};
Gui::AutoSizedTextBox* mLabel{nullptr};
MyGUI::Widget* mClient{nullptr};
std::vector<EditBase*> mBases;
};
}

View file

@ -23,8 +23,8 @@ namespace LuaUi
void textChange(MyGUI::EditBox*);
MyGUI::EditBox* mEditBox = nullptr;
bool mMultiline;
bool mAutoSize;
bool mMultiline{false};
bool mAutoSize{false};
};
}

View file

@ -160,7 +160,7 @@ namespace LuaUi
sol::object WidgetExtension::keyEvent(MyGUI::KeyCode code) const
{
SDL_Keysym keySym;
auto keySym = SDL_Keysym();
keySym.sym = SDLUtil::myGuiKeyToSdl(code);
keySym.scancode = SDL_GetScancodeFromKey(keySym.sym);
keySym.mod = SDL_GetModState();