Improved code based on CppCheck results

None of this should change the engine's behavior, but the code is better
this way.


Former-commit-id: 0127769848fc1f7fc8006ee607985cfc0ead2965
This commit is contained in:
Lynix
2015-06-05 13:25:17 +02:00
parent 0f27930467
commit fc65b30f84
15 changed files with 22 additions and 49 deletions

View File

@@ -37,7 +37,7 @@ namespace
class IcoSphereBuilder
{
public:
IcoSphereBuilder(const NzMatrix4f& matrix) :
explicit IcoSphereBuilder(const NzMatrix4f& matrix) :
m_matrix(matrix)
{
}

View File

@@ -144,7 +144,6 @@ namespace
// "If you want to embolden the bitmap owned by a FT_GlyphSlot_Rec, you should call FT_GlyphSlot_Own_Bitmap on the slot first"
FT_GlyphSlot_Own_Bitmap(glyph);
FT_Bitmap_Embolden(s_library, &glyph->bitmap, boldStrength, boldStrength);
embolden = false;
}
dst->advance += glyph->metrics.horiAdvance >> 6;
@@ -173,7 +172,7 @@ namespace
for (unsigned int y = 0; y < height; ++y)
{
for (unsigned int x = 0; x < width; ++x)
*pixels++ = (data[x/8] & (1 << (7 - x%8)) ? 255 : 0);
*pixels++ = (data[x/8] & ((1 << (7 - x%8)) ? 255 : 0));
data += glyph->bitmap.pitch;
}

View File

@@ -469,7 +469,7 @@ bool NzMD5AnimParser::ParseHierarchy()
}
char name[64];
if (std::sscanf(&m_currentLine[0], "%s %d %u %u", &name[0], &m_joints[i].parent, &m_joints[i].flags, &m_joints[i].index) != 4)
if (std::sscanf(&m_currentLine[0], "%63s %d %u %u", &name[0], &m_joints[i].parent, &m_joints[i].flags, &m_joints[i].index) != 4)
{
UnrecognizedLine(true);
return false;

View File

@@ -234,9 +234,9 @@ bool NzMD5MeshParser::ParseJoints()
}
char name[64];
if (std::sscanf(&m_currentLine[0], "%s %d ( %f %f %f ) ( %f %f %f )", &name[0], &m_joints[i].parent,
&m_joints[i].bindPos.x, &m_joints[i].bindPos.y, &m_joints[i].bindPos.z,
&m_joints[i].bindOrient.x, &m_joints[i].bindOrient.y, &m_joints[i].bindOrient.z) != 8)
if (std::sscanf(&m_currentLine[0], "%63s %d ( %f %f %f ) ( %f %f %f )", &name[0], &m_joints[i].parent,
&m_joints[i].bindPos.x, &m_joints[i].bindPos.y, &m_joints[i].bindPos.z,
&m_joints[i].bindOrient.x, &m_joints[i].bindOrient.y, &m_joints[i].bindOrient.z) != 8)
{
UnrecognizedLine(true);
return false;

View File

@@ -130,10 +130,6 @@ void NzSubMesh::GenerateTangents()
dv[0] = positions[iterator[1]] - pos0;
dv[1] = positions[iterator[2]] - pos0;
NzVector2f duv[2];
duv[0] = uv1 - uv0;
duv[1] = uv2 - uv0;
float ds[2];
ds[0] = uv1.x - uv0.x;
ds[1] = uv2.x - uv0.x;