Skip to content

Commit

Permalink
Resolve some warnings reported by llvm/clang static source code analy…
Browse files Browse the repository at this point in the history
…sis (#4365)
  • Loading branch information
codereader committed Oct 29, 2016
1 parent 42229aa commit db70dfc
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 34 deletions.
2 changes: 1 addition & 1 deletion plugins/dm.conversation/ConversationDialog.cpp
Expand Up @@ -46,7 +46,7 @@ ConversationDialog::ConversationDialog() :

void ConversationDialog::populateWindow()
{
wxPanel* mainPanel = loadNamedPanel(this, "ConvDialogMainPanel");
loadNamedPanel(this, "ConvDialogMainPanel");

wxPanel* entityPanel = findNamedObject<wxPanel>(this, "ConvDialogEntityPanel");

Expand Down
2 changes: 1 addition & 1 deletion plugins/dm.stimresponse/EffectEditor.cpp
Expand Up @@ -167,7 +167,7 @@ void EffectEditor::createArgumentWidgets(ResponseEffect& effect)
for (ResponseEffect::ArgumentList::iterator i = list.begin();
i != list.end(); ++i)
{
int index = i->first;
//int index = i->first;
ResponseEffect::Argument& arg = i->second;
ArgumentItemPtr item;

Expand Down
2 changes: 1 addition & 1 deletion plugins/fonts/GlyphSet.cpp
Expand Up @@ -68,7 +68,7 @@ GlyphSetPtr GlyphSet::createFromDatFile(const std::string& vfsPath,
q3font::Q3FontInfoPtr buf(new q3font::Q3FontInfo);

InputStream& stream = file->getInputStream();
StreamBase::size_type bytesRead = stream.read(
stream.read(
reinterpret_cast<StreamBase::byte_type*>(buf.get()),
sizeof(q3font::Q3FontInfo)
);
Expand Down
2 changes: 1 addition & 1 deletion plugins/mapdoom3/aas/Doom3AasFile.cpp
Expand Up @@ -244,7 +244,7 @@ void Doom3AasFile::parseFromTokens(parser::DefTokeniser& tok)
tok.assertNextToken(")");

// Skip over reachabilities for the moment being
std::size_t reachCount = string::convert<std::size_t>(tok.nextToken());
/*std::size_t reachCount = */string::convert<std::size_t>(tok.nextToken());
tok.assertNextToken("{");

while (tok.nextToken() != "}")
Expand Down
2 changes: 1 addition & 1 deletion plugins/mapdoom3/compiler/OptIsland.cpp
Expand Up @@ -677,7 +677,7 @@ void OptIsland::removeIfColinear(OptVertex* ov)

// see if they are colinear
Vector3 dir1 = v3->v.vertex - v1->v.vertex;
float len = dir1.normalise();
dir1.normalise();

Vector3 dir2 = v2->v.vertex - v1->v.vertex;

Expand Down
5 changes: 1 addition & 4 deletions plugins/mapdoom3/compiler/ProcCompiler.cpp
Expand Up @@ -326,8 +326,6 @@ class ToolPrimitiveGenerator :

_buildBrush.contentShader = firstSide.material;

bool mixed = false;

// a brush is only opaque if all sides are opaque
_buildBrush.opaque = true;

Expand All @@ -344,7 +342,6 @@ class ToolPrimitiveGenerator :

if (flags != contents)
{
mixed = true;
contents |= flags;
}

Expand Down Expand Up @@ -4503,7 +4500,7 @@ Surface ProcCompiler::createShadowVolume(const Matrix4& transform, const Surface
bool overflowed = false;
_indexFrustumNumber = 0;
int capPlaneBits = 0;
bool callOptimizer = (optimize == SG_OFFLINE);
//bool callOptimizer = (optimize == SG_OFFLINE);

// the facing information will be the same for all six projections
// from a point light, as well as for any directed lights
Expand Down
8 changes: 0 additions & 8 deletions plugins/mapdoom3/compiler/ProcPatch.cpp
Expand Up @@ -656,7 +656,6 @@ void ProcPatch::generateNormals()
{
for (int j = 0; j < _height; ++j)
{
std::size_t count = 0;
const Vector3& base = _vertices[j * _width + i].vertex;

for (std::size_t k = 0; k < 8; ++k)
Expand Down Expand Up @@ -730,13 +729,6 @@ void ProcPatch::generateNormals()
}

sum += norm;
count++;
}

if (count == 0)
{
//idLib::common->Printf("bad normal\n");
count = 1;
}

_vertices[j * _width + i].normal = sum;
Expand Down
16 changes: 8 additions & 8 deletions plugins/sound/WavFileLoader.h
Expand Up @@ -87,36 +87,36 @@ class WavFileLoader
unsigned short bps = 0;
stream.read(reinterpret_cast<byte*>(&bps), 2);

int bufferSize = 0;
//int bufferSize = 0;

if (channels == 1) {
if (bps == 8) {
format = AL_FORMAT_MONO8;
// Set BufferSize to 250ms (Frequency divided by 4 (quarter of a second))
bufferSize = freq / 4;
//bufferSize = freq / 4;
}
else {
format = AL_FORMAT_MONO16;
// Set BufferSize to 250ms (Frequency * 2 (16bit) divided by 4 (quarter of a second))
bufferSize = freq >> 1;
//bufferSize = freq >> 1;
// IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ...
bufferSize -= (bufferSize % 2);
//bufferSize -= (bufferSize % 2);
}
}
else {
if (bps == 8) {
format = AL_FORMAT_STEREO16;
// Set BufferSize to 250ms (Frequency * 2 (8bit stereo) divided by 4 (quarter of a second))
bufferSize = freq >> 1;
//bufferSize = freq >> 1;
// IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ...
bufferSize -= (bufferSize % 2);
//bufferSize -= (bufferSize % 2);
}
else {
format = AL_FORMAT_STEREO16;
// Set BufferSize to 250ms (Frequency * 4 (16bit stereo) divided by 4 (quarter of a second))
bufferSize = freq;
//bufferSize = freq;
// IMPORTANT : The Buffer Size must be an exact multiple of the BlockAlignment ...
bufferSize -= (bufferSize % 4);
//bufferSize -= (bufferSize % 4);
}
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/uimanager/MenuManager.cpp
Expand Up @@ -378,7 +378,7 @@ void MenuManager::remove(const std::string& path)
else if (parent->getType() == menuBar)
{
wxMenuBar* parentBar = static_cast<wxMenuBar*>(parent->getWidget());
wxMenu* menu = static_cast<wxMenu*>(item->getWidget());
static_cast<wxMenu*>(item->getWidget());

int oldPosition = parent->getMenuPosition(item);

Expand All @@ -388,7 +388,7 @@ void MenuManager::remove(const std::string& path)
item->removeAllChildren();
item->setWidget(NULL);

menu = parentBar->Remove(oldPosition);
wxMenu* menu = parentBar->Remove(oldPosition);
delete menu;
}
else
Expand Down
7 changes: 0 additions & 7 deletions radiant/patch/PatchTesselation.cpp
Expand Up @@ -112,7 +112,6 @@ void PatchTesselation::generateNormals()
{
for (std::size_t j = 0; j < height; j++)
{
int count = 0;
Vector3 base = vertices[j * width + i].vertex;

for (std::size_t k = 0; k < 8; k++)
Expand Down Expand Up @@ -185,12 +184,6 @@ void PatchTesselation::generateNormals()
}

sum += tempNormal;
count++;
}

if (count == 0)
{
count = 1;
}

vertices[j * width + i].normal = sum;
Expand Down

0 comments on commit db70dfc

Please sign in to comment.