fix some coverity issues

This commit is contained in:
KroArtem 2014-01-30 03:19:41 +04:00
parent 6025db77c3
commit b80548a46e
6 changed files with 13 additions and 13 deletions

View File

@ -730,7 +730,6 @@ void RibbonWidget::setLabel(const unsigned int id, irr::core::stringw new_name)
// ignore this call for ribbons without labels // ignore this call for ribbons without labels
if (m_labels.size() == 0) return; if (m_labels.size() == 0) return;
assert(id >= 0);
assert(id < m_labels.size()); assert(id < m_labels.size());
m_labels[id].setText( new_name.c_str() ); m_labels[id].setText( new_name.c_str() );
m_text = new_name; m_text = new_name;

View File

@ -1060,7 +1060,7 @@ void SkiddingAI::evaluateItems(const Item *item, float kart_aim_angle,
// fall through: if we have enough space to store a big // fall through: if we have enough space to store a big
// container, we can also store a small container, and // container, we can also store a small container, and
// finally fall through to the bonus box code. // finally fall through to the bonus box code.
case Item::ITEM_NITRO_SMALL: avoid = false; break; case Item::ITEM_NITRO_SMALL: avoid = false;
// Only collect nitro, if it can actually be stored. // Only collect nitro, if it can actually be stored.
if (m_kart->getEnergy() + if (m_kart->getEnergy() +
m_kart->getKartProperties()->getNitroSmallContainer() m_kart->getKartProperties()->getNitroSmallContainer()

View File

@ -255,8 +255,8 @@ public:
/** Returns the position of a wheel relative to the kart. /** Returns the position of a wheel relative to the kart.
* \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear
* right, 3 = rear left. */ * right, 3 = rear left. */
const Vec3& getWheelGraphicsPosition(int i) const const Vec3& getWheelGraphicsPosition(unsigned int i) const
{assert(i>=0 && i<4); return m_wheel_graphics_position[i];} {assert(i<4); return m_wheel_graphics_position[i];}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns the position of wheels relative to the kart. /** Returns the position of wheels relative to the kart.
*/ */
@ -268,20 +268,20 @@ public:
* karts more stable. * karts more stable.
* \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear
* right, 3 = rear left. */ * right, 3 = rear left. */
const Vec3& getWheelPhysicsPosition(int i) const const Vec3& getWheelPhysicsPosition(unsigned int i) const
{assert(i>=0 && i<4); return m_wheel_physics_position[i];} {assert(i<4); return m_wheel_physics_position[i];}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns the radius of the graphical wheels. /** Returns the radius of the graphical wheels.
* \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear
* right, 3 = rear left. */ * right, 3 = rear left. */
float getWheelGraphicsRadius(int i) const float getWheelGraphicsRadius(unsigned int i) const
{assert(i>=0 && i<4); return m_wheel_graphics_radius[i]; } {assert(i<4); return m_wheel_graphics_radius[i]; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns the position of nitro emitter relative to the kart. /** Returns the position of nitro emitter relative to the kart.
* \param i Index of the emitter: 0 = right, 1 = left * \param i Index of the emitter: 0 = right, 1 = left
*/ */
const Vec3& getNitroEmittersPositon(unsigned int i) const const Vec3& getNitroEmittersPositon(unsigned int i) const
{ assert(i>=0 && i<2); return m_nitro_emitter_position[i]; } { assert(i<2); return m_nitro_emitter_position[i]; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns true if kart has nitro emitters */ /** Returns true if kart has nitro emitters */
const bool hasNitroEmitters() const const bool hasNitroEmitters() const

View File

@ -196,7 +196,7 @@ void GetPublicAddress::asynchronousUpdate()
case 0: case 0:
case 1: case 1:
assert(size == 8); assert(size == 8);
assert(attributes[5] = 0x01); // IPv4 only assert(attributes[5] == 0x01); // IPv4 only
port = attributes[6]*256+attributes[7]; port = attributes[6]*256+attributes[7];
address = (attributes[8]<<24 & 0xFF000000)+(attributes[9]<<16 & 0x00FF0000)+(attributes[10]<<8 & 0x0000FF00)+(attributes[11] & 0x000000FF); address = (attributes[8]<<24 & 0xFF000000)+(attributes[9]<<16 & 0x00FF0000)+(attributes[10]<<8 & 0x0000FF00)+(attributes[11] & 0x000000FF);
finish = true; finish = true;

View File

@ -117,7 +117,7 @@ void StartGameProtocol::update()
assert(profileToUse); assert(profileToUse);
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice(); InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
int new_player_id = 0; int new_player_id = 0;
if (StateManager::get()->getActivePlayers().size() >= 0) // more than one player, we're the first if (StateManager::get()->getActivePlayers().size() >= 1) // more than one player, we're the first
new_player_id = 0; new_player_id = 0;
else else
new_player_id = StateManager::get()->createActivePlayer( profileToUse, device , players[i]->user_profile); new_player_id = StateManager::get()->createActivePlayer( profileToUse, device , players[i]->user_profile);

View File

@ -85,7 +85,8 @@ void QuadSet::init(const std::string &filename)
XMLNode *xml = file_manager->createXMLTree(filename); XMLNode *xml = file_manager->createXMLTree(filename);
if(!xml || xml->getName()!="quads") if(!xml || xml->getName()!="quads")
{ {
fprintf(stderr, "[QuadSet::load] ERROR : QuadSet '%s' not found.\n", filename.c_str()); Log::error("[QuadSet::load] ERROR : QuadSet '%s' not found.\n", filename.c_str());
delete xml;
return; return;
} }
for(unsigned int i=0; i<xml->getNumNodes(); i++) for(unsigned int i=0; i<xml->getNumNodes(); i++)
@ -93,7 +94,7 @@ void QuadSet::init(const std::string &filename)
const XMLNode *xml_node = xml->getNode(i); const XMLNode *xml_node = xml->getNode(i);
if(xml_node->getName()!="quad") if(xml_node->getName()!="quad")
{ {
printf("[QuadSet::load] WARNING: Unsupported node type '%s' found in '%s' - ignored.\n", Log::warn("[QuadSet::load] WARNING: Unsupported node type '%s' found in '%s' - ignored.\n",
xml_node->getName().c_str(), filename.c_str()); xml_node->getName().c_str(), filename.c_str());
continue; continue;
} }