1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 16:09:43 +00:00

Merge branch 'coverityfixes' into 'master'

Correct some things based on Coverity's output

See merge request OpenMW/openmw!3272
This commit is contained in:
psi29a 2023-07-24 13:22:25 +00:00
commit 2c989e4057
2 changed files with 9 additions and 4 deletions

View file

@ -470,7 +470,11 @@ namespace Bsa
return 0;
std::replace(str.begin(), str.end(), '/', '\\');
Misc::StringUtils::lowerCaseInPlace(str);
uint64_t result = str[len - 1] | (len >= 3 ? (str[len - 2] << 8) : 0) | (len << 16) | (str[0] << 24);
uint64_t result = str[len - 1];
if (len >= 3)
result |= str[len - 2] << 8;
result |= len << 16;
result |= static_cast<uint32_t>(str[0] << 24);
if (len >= 4)
{
uint32_t hash = 0;

View file

@ -2386,7 +2386,7 @@ namespace NifOsg
auto setBin_Traversal = [](osg::StateSet* ss) { ss->setRenderBinDetails(2, "TraversalOrderBin"); };
auto setBin_Inherit = [](osg::StateSet* ss) { ss->setRenderBinToInherit(); };
int lightmode = 1;
auto lightmode = Nif::NiVertexColorProperty::LightMode::LightMode_EmiAmbDif;
float emissiveMult = 1.f;
float specStrength = 1.f;
@ -2442,7 +2442,8 @@ namespace NifOsg
}
case Nif::NiVertexColorProperty::VertexMode::VertMode_SrcAmbDif:
{
switch (vertprop->mLightingMode)
lightmode = vertprop->mLightingMode;
switch (lightmode)
{
case Nif::NiVertexColorProperty::LightMode::LightMode_Emissive:
{
@ -2565,7 +2566,7 @@ namespace NifOsg
if (mVersion <= Nif::NIFFile::VER_MW || !specEnabled)
mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
if (lightmode == 0)
if (lightmode == Nif::NiVertexColorProperty::LightMode::LightMode_Emissive)
{
osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK);
diffuse = osg::Vec4f(0, 0, 0, diffuse.a());