Merge pull request #12 from KroArtem/master

fix some cppcheck warnings
This commit is contained in:
auriamg 2014-01-25 17:23:24 -08:00
commit 4355c6450e
8 changed files with 7 additions and 14 deletions

View File

@ -117,6 +117,7 @@ GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb)
break;
case scene::EPT_LINES:
result.PrimitiveType = GL_LINES;
break;
case scene::EPT_TRIANGLES:
result.PrimitiveType = GL_TRIANGLES;
break;

View File

@ -754,7 +754,6 @@ namespace GUIEngine
// ------------------------------------------------------------------------
Widget* getFocusForPlayer(const unsigned int playerID)
{
assert(playerID >= 0);
assert(playerID < MAX_PLAYER_COUNT);
return g_focus_for_player[playerID];
@ -773,7 +772,6 @@ namespace GUIEngine
bool isFocusedForPlayer(const Widget* w, const unsigned int playerID)
{
assert(w != NULL);
assert(playerID >= 0);
assert(playerID < MAX_PLAYER_COUNT);
// If no focus

View File

@ -313,7 +313,6 @@ void DynamicRibbonWidget::buildInternalStructure()
elem->remove();
m_children.erase(i);
i--;
if (i<0) i = 0;
}
}
m_rows.clearWithoutDeleting(); // rows already deleted above, don't double-delete

View File

@ -851,8 +851,7 @@ bool SkiddingAI::handleSelectedItem(float kart_aim_angle, Vec3 *aim_point)
// If the item is unavailable or has been switched into a bad item
// stop aiming for it.
if(m_item_to_collect->getDisableTime()>0 ||
m_item_to_collect->getType() == Item::ITEM_BANANA ||
m_item_to_collect->getType() == Item::ITEM_BANANA )
m_item_to_collect->getType() == Item::ITEM_BANANA )
return false;
const Vec3 &xyz = m_item_to_collect->getXYZ();

View File

@ -180,14 +180,12 @@ float Skidding::getSteeringWhenSkidding(float steering) const
float f = (steering - m_skid_reduce_turn_min)
/ m_skid_reduce_turn_delta;
return f *2.0f-1.0f;
break;
}
case SKID_ACCUMULATE_LEFT:
{
float f = (steering + m_skid_reduce_turn_min)
/ m_skid_reduce_turn_delta;
return 2.0f * f +1.0f;
break;
}
} // switch m_skid_state
return 0; // keep compiler quiet

View File

@ -212,7 +212,7 @@ void ConnectToServer::asynchronousUpdate()
int count = 0;
while(error==ERROR_INSUFFICIENT_BUFFER && count < 10)
{
delete table; // deleting NULL is legal
delete[] table; // deleting NULL is legal
table = (MIB_IPADDRTABLE*)new char[size];
error = GetIpAddrTable(table, &size, 0);
count ++;
@ -226,7 +226,7 @@ void ConnectToServer::asynchronousUpdate()
break;
}
}
delete table;
delete[] table;
#endif
m_server_address = sender;

View File

@ -289,9 +289,9 @@ void RaceConfig::computeRaceMode()
}
}
// now we know :
m_major_mode = ((major_histogram.size() > 0) ? getHighestInHistogram<int>(&major_histogram) : 1);
m_races_count = ((minor_histogram.size() > 0) ? getHighestInHistogram<int>(&races_count_histogram) : 1);
m_minor_mode = ((minor_histogram.size() > 0) ? getHighestInHistogram<int>(&minor_histogram) : 0);
m_major_mode = (!major_histogram.empty() ? getHighestInHistogram<int>(&major_histogram) : 1);
m_races_count = (!minor_histogram.empty() ? getHighestInHistogram<int>(&races_count_histogram) : 1);
m_minor_mode = (!minor_histogram.empty() ? getHighestInHistogram<int>(&minor_histogram) : 0);
if (m_major_mode == RaceManager::MAJOR_MODE_GRAND_PRIX)
m_tracks.resize(m_races_count);

View File

@ -330,7 +330,6 @@ GUIEngine::EventPropagation SoccerSetupScreen::filterActions(PlayerAction action
sfx_manager->quickSound( "wee" );
}
return EVENT_BLOCK;
break;
}
case PA_MENU_CANCEL:
{
@ -351,7 +350,6 @@ GUIEngine::EventPropagation SoccerSetupScreen::filterActions(PlayerAction action
}
return EVENT_BLOCK;
break;
}
default:
break;