Merge pull request #2615 from nado/warning-fix

Fixes warnings
This commit is contained in:
hiker 2016-10-05 12:59:22 +11:00 committed by GitHub
commit 3506b7da2f
26 changed files with 55 additions and 79 deletions

View File

@ -333,11 +333,10 @@ bool MusicOggStream::streamIntoBuffer(ALuint buffer)
int size = 0;
int portion;
int result;
while(size < m_buffer_size)
{
result = ov_read(&m_oggStream, pcm + size, m_buffer_size - size,
int result = ov_read(&m_oggStream, pcm + size, m_buffer_size - size,
isBigEndian, 2, 1, &portion);
if(result > 0)

View File

@ -516,7 +516,6 @@ const irr::core::stringw
if (track == NULL) return irr::core::stringw( L"????" );
return _("New track '%s' now available", track->getName());
break;
}
case UNLOCK_MODE:
{

View File

@ -1600,7 +1600,7 @@ std::string IrrDriver::getSmallerTexture(const std::string& filename)
{
core::dimension2d<u32> dim = img->getDimension();
core::dimension2d<u32> new_dim; // Dimension of the cached texture
const int scale_factor = 2;
const unsigned scale_factor = 2;
// Resize the texture only if it can be done properly
if (dim.Width < scale_factor || dim.Height < scale_factor)
new_dim = dim;

View File

@ -1319,9 +1319,9 @@ void multidraw2ndPass(const std::vector<uint64_t> &Handles, Args... args)
T::InstancedSecondPassShader::getInstance()->use();
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
T::Instance));
uint64_t nulltex[10] = {};
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
{
uint64_t nulltex[10] = {};
HandleExpander<typename T::InstancedSecondPassShader>::template
Expand(nulltex, T::SecondPassTextures, Handles[0], Handles[1],
Handles[2]);
@ -1410,9 +1410,9 @@ void IrrDriver::renderSolidSecondPass()
GrassMat::InstancedSecondPassShader::getInstance()->use();
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(GrassMat::VertexType,
GrassMat::Instance));
uint64_t nulltex[10] = {};
if (SolidPassCmd::getInstance()->Size[GrassMat::MaterialType])
{
uint64_t nulltex[10] = {};
HandleExpander<GrassMat::InstancedSecondPassShader>
::Expand(nulltex, GrassMat::SecondPassTextures, DiffuseHandle,
SpecularHandle, SSAOHandle, DepthHandle);

View File

@ -314,20 +314,6 @@ void ShadowMatrices::computeMatrixesAndCameras(scene::ICameraSceneNode *const ca
const float oldfar = camnode->getFarValue();
const float oldnear = camnode->getNearValue();
float FarValues[] =
{
ShadowMatrices::m_shadow_split[1],
ShadowMatrices::m_shadow_split[2],
ShadowMatrices::m_shadow_split[3],
ShadowMatrices::m_shadow_split[4],
};
float NearValues[] =
{
ShadowMatrices::m_shadow_split[0],
ShadowMatrices::m_shadow_split[1],
ShadowMatrices::m_shadow_split[2],
ShadowMatrices::m_shadow_split[3]
};
float tmp[16 * 9 + 2];
memcpy(tmp, irr_driver->getViewMatrix().pointer(), 16 * sizeof(float));
@ -359,6 +345,21 @@ void ShadowMatrices::computeMatrixesAndCameras(scene::ICameraSceneNode *const ca
core::aabbox3df trackbox(vmin.toIrrVector(), vmax.toIrrVector() -
core::vector3df(0, 30, 0));
float FarValues[] =
{
ShadowMatrices::m_shadow_split[1],
ShadowMatrices::m_shadow_split[2],
ShadowMatrices::m_shadow_split[3],
ShadowMatrices::m_shadow_split[4],
};
float NearValues[] =
{
ShadowMatrices::m_shadow_split[0],
ShadowMatrices::m_shadow_split[1],
ShadowMatrices::m_shadow_split[2],
ShadowMatrices::m_shadow_split[3]
};
// Shadow Matrixes and cameras
for (unsigned i = 0; i < 4; i++)
{

View File

@ -723,7 +723,7 @@ PROFILER_POP_CPU_MARKER();
ListInstancedMatDetails::getInstance()->clear();
ListInstancedMatUnlit::getInstance()->clear();
size_t SolidPoly = 0, ShadowPoly = 0, MiscPoly = 0;
size_t SolidPoly = 0, ShadowPoly = 0;
PROFILER_PUSH_CPU_MARKER("- Draw Command upload", 0xFF, 0x0, 0xFF);
@ -868,6 +868,8 @@ PROFILER_POP_CPU_MARKER();
RSMCmdBuffer = (DrawElementsIndirectCommand*)glMapBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, 10000 * sizeof(DrawElementsIndirectCommand), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
}
size_t MiscPoly = 0;
// Default Material
RSMPassCmd::getInstance()->Offset[Material::SHADERTYPE_SOLID] = current_cmd;
FillInstances(MeshForRSM[Material::SHADERTYPE_SOLID], ListInstancedMatDefault::getInstance()->RSM, RSMInstanceBuffer, RSMCmdBuffer, offset, current_cmd, MiscPoly);

View File

@ -387,7 +387,7 @@ const bool NAVIGATION_DEBUG = false;
*/
void EventHandler::navigate(const int playerID, Input::InputType type, const bool pressedDown, const bool reverse)
{
IGUIElement *el = NULL, *closest = NULL;
IGUIElement *el = NULL;
if (type == Input::IT_STICKBUTTON && !pressedDown)
return;
@ -450,7 +450,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
// Down: if the current widget is e.g. 5, search for widget 6, 7, 8, 9, ..., 15 (up to 10 IDs may be missing)
for (int n = 1; n < 10 && !found; n++)
{
closest = GUIEngine::getGUIEnv()->getRootGUIElement()->getElementFromId(el->getTabOrder() + (reverse ? -n : n), true);
IGUIElement *closest = GUIEngine::getGUIEnv()->getRootGUIElement()->getElementFromId(el->getTabOrder() + (reverse ? -n : n), true);
if (closest != NULL && Widget::isFocusableId(closest->getID()))
{

View File

@ -927,7 +927,6 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
//if (widget->m_deactivated) return;
bool mark_selected = widget->isSelected(PLAYER_ID_GAME_MASTER);
bool always_show_selection = false;
IGUIElement* focusedElem = NULL;
if (GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) != NULL)
@ -1007,6 +1006,7 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
/* in combo ribbons, always show selection */
RibbonWidget* parentRibbonWidget = NULL;
bool always_show_selection = false;
if (widget->m_event_handler != NULL &&
widget->m_event_handler->m_type == WTYPE_RIBBON)

View File

@ -1321,11 +1321,10 @@ void CGUIEditBox::breakText()
s32 size = Text.size();
s32 length = 0;
s32 elWidth = RelativeRect.getWidth() - 6;
wchar_t c;
for (s32 i=0; i<size; ++i)
{
c = Text[i];
wchar_t c = Text[i];
bool lineBreak = false;
if (c == L'\r') // Mac or Windows breaks

View File

@ -210,7 +210,6 @@ void DynamicRibbonWidget::add()
// const int count = m_items.size();
m_row_amount = -1;
float max_score_so_far = -1;
if (m_h - m_label_height < 0)
{
@ -219,6 +218,7 @@ void DynamicRibbonWidget::add()
}
else
{
float max_score_so_far = -1;
for (int row_count = 1; row_count < 10; row_count++)
{
int visible_items;

View File

@ -143,7 +143,6 @@ void WiimoteManager::launchDetection(int timeout)
//To prevent segmentation fault, have to delete NULLs
number_deletables = 0;
number_deletables = 0;
deletable_wiimotes = (wiimote_t**) malloc(sizeof(struct wiimote_t*) * (number_previous_wiimotes-number_merged_wiimotes));
memset(deletable_wiimotes,0,sizeof(struct wiimote_t*) * (number_previous_wiimotes-number_merged_wiimotes));
for (int i = 0; i < number_previous_wiimotes; i++)

View File

@ -260,26 +260,24 @@ void EndController::handleRescue(const float DELTA)
void EndController::findNonCrashingPoint(Vec3 *result)
{
unsigned int sector = m_next_node_index[m_track_node];
int target_sector;
Vec3 direction;
Vec3 step_track_coord;
float distance;
int steps;
//We exit from the function when we have found a solution
while( 1 )
{
//target_sector is the sector at the longest distance that we can drive
//to without crashing with the track.
target_sector = m_next_node_index[sector];
int target_sector = m_next_node_index[sector];
//direction is a vector from our kart to the sectors we are testing
direction = DriveGraph::get()->getNode(target_sector)->getCenter()
- m_kart->getXYZ();
float len=direction.length();
steps = int( len / m_kart_length );
int steps = int( len / m_kart_length );
if( steps < 3 ) steps = 3;
//Protection against having vel_normal with nan values

View File

@ -1933,7 +1933,6 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
m_curve[CURVE_KART]->addPoint(m_kart->getTrans()(forw)+eps);
#endif
*last_node = m_next_node_index[m_track_node];
int target_sector;
Vec3 direction;
Vec3 step_track_coord;
@ -1945,7 +1944,7 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
{
// target_sector is the sector at the longest distance that we can
// drive to without crashing with the track.
target_sector = m_next_node_index[*last_node];
int target_sector = m_next_node_index[*last_node];
//direction is a vector from our kart to the sectors we are testing
direction = DriveGraph::get()->getNode(target_sector)->getCenter()
@ -2029,12 +2028,10 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
*last_node = m_next_node_index[m_track_node];
float angle = DriveGraph::get()->getAngleToNext(m_track_node,
m_successor_index[m_track_node]);
int target_sector;
Vec3 direction;
Vec3 step_track_coord;
float angle1;
// The original while(1) loop is replaced with a for loop to avoid
// infinite loops (which we had once or twice). Usually the number
// of iterations in the while loop is less than 7.
@ -2042,8 +2039,8 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
{
// target_sector is the sector at the longest distance that we can
// drive to without crashing with the track.
target_sector = m_next_node_index[*last_node];
angle1 = DriveGraph::get()->getAngleToNext(target_sector,
int target_sector = m_next_node_index[*last_node];
float angle1 = DriveGraph::get()->getAngleToNext(target_sector,
m_successor_index[target_sector]);
// In very sharp turns this algorithm tends to aim at off track points,
// resulting in hitting a corner. So test for this special case and

View File

@ -1982,7 +1982,6 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
m_curve[CURVE_KART]->addPoint(m_kart->getTrans()(forw)+eps);
#endif
*last_node = m_next_node_index[m_track_node];
int target_sector;
Vec3 direction;
Vec3 step_track_coord;
@ -1994,7 +1993,7 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
{
// target_sector is the sector at the longest distance that we can
// drive to without crashing with the track.
target_sector = m_next_node_index[*last_node];
int target_sector = m_next_node_index[*last_node];
//direction is a vector from our kart to the sectors we are testing
direction = DriveGraph::get()->getNode(target_sector)->getCenter()
@ -2078,12 +2077,9 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
*last_node = m_next_node_index[m_track_node];
float angle = DriveGraph::get()->getAngleToNext(m_track_node,
m_successor_index[m_track_node]);
int target_sector;
Vec3 direction;
Vec3 step_track_coord;
float angle1;
// The original while(1) loop is replaced with a for loop to avoid
// infinite loops (which we had once or twice). Usually the number
// of iterations in the while loop is less than 7.
@ -2091,8 +2087,8 @@ void SkiddingAI::findNonCrashingPointFixed(Vec3 *aim_position, int *last_node)
{
// target_sector is the sector at the longest distance that we can
// drive to without crashing with the track.
target_sector = m_next_node_index[*last_node];
angle1 = DriveGraph::get()->getAngleToNext(target_sector,
int target_sector = m_next_node_index[*last_node];
float angle1 = DriveGraph::get()->getAngleToNext(target_sector,
m_successor_index[target_sector]);
// In very sharp turns this algorithm tends to aim at off track points,
// resulting in hitting a corner. So test for this special case and

View File

@ -926,11 +926,10 @@ void KartModel::update(float dt, float distance, float steer, float speed,
m_kart->getKartProperties()->getSpeedWeightedObjectProperties().value_name
// Animation strength
float strength = 1.0f;
const float strength_factor = GET_VALUE(obj, m_strength_factor);
if (strength_factor >= 0.0f)
{
strength = speed * strength_factor;
float strength = speed * strength_factor;
btClamp<float>(strength, 0.0f, 1.0f);
}

View File

@ -358,14 +358,10 @@ void Skidding::update(float dt, bool is_on_ground,
m_predicted_curve->setVisible(true);
m_predicted_curve->setPosition(m_kart->getXYZ());
m_predicted_curve->setHeading(m_kart->getHeading());
float angle = kp
->getMaxSteerAngle(m_kart->getSpeed())
* fabsf(getSteeringFraction());
angle = kp
->getMaxSteerAngle(SPEED)
float angle = kp->getMaxSteerAngle(SPEED)
* fabsf(getSteeringFraction());
float r = kp->getWheelBase()
/ asin(angle)*1.0f;
/ asin(angle)*1.0f;
const int num_steps = 50;

View File

@ -396,9 +396,11 @@ void handleXmasMode()
*/
bool isEasterMode(int day, int month, int year, int before_after_days)
{
switch (UserConfigParams::m_easter_ear_mode)
{
case 0:
if (UserConfigParams::m_easter_ear_mode == 1) {
return true;
}
if (UserConfigParams::m_easter_ear_mode == 0)
{
// Compute Easter date, based on wikipedia formula
// http://en.wikipedia.org/wiki/Computus
@ -430,12 +432,9 @@ bool isEasterMode(int day, int month, int year, int before_after_days)
}
return (month > easter_start_month || (month == easter_start_month && day >= easter_start_day)) &&
(month < easter_end_month || (month == easter_end_month && day <= easter_end_day));
break;
}
case 1: return true; break;
default: return false; break;
} // switch m_xmas_mode
return false;
} // isEasterMode(day, month, year, before_after_days)
// ============================================================================

View File

@ -91,10 +91,9 @@ namespace Online
/** Request a login using the saved credentials of the user. */
void OnlinePlayerProfile::requestSavedSession()
{
SignInRequest *request = NULL;
if (m_online_state == OS_SIGNED_OUT && hasSavedSession())
{
request = new SignInRequest(true);
SignInRequest *request = new SignInRequest(true);
setUserDetails(request, "saved-session");
// The userid must be taken from the saved data,

View File

@ -378,7 +378,7 @@ namespace Scripting
Log::error("Scripting", "The script ended with an exception.");
// Write some information about the script exception
asIScriptFunction *func = ctx->GetExceptionFunction();
//asIScriptFunction *func = ctx->GetExceptionFunction();
//std::cout << "func: " << func->GetDeclaration() << std::endl;
//std::cout << "modl: " << func->GetModuleName() << std::endl;
//std::cout << "sect: " << func->GetScriptSectionName() << std::endl;
@ -520,7 +520,6 @@ namespace Scripting
{
if (m_callback_delegate != NULL)
{
asIScriptEngine* engine = World::getWorld()->getScriptEngine()->getEngine();
m_callback_delegate->Release();
}
}

View File

@ -975,8 +975,6 @@ bool CScriptArray::Less(const void *a, const void *b, bool asc, asIScriptContext
}
else
{
int r = 0;
if( subTypeId & asTYPEID_OBJHANDLE )
{
// Allow sort to work even if the array contains null handles
@ -988,7 +986,7 @@ bool CScriptArray::Less(const void *a, const void *b, bool asc, asIScriptContext
if( cache && cache->cmpFunc )
{
// TODO: Add proper error handling
r = ctx->Prepare(cache->cmpFunc); assert(r >= 0);
int r = ctx->Prepare(cache->cmpFunc); assert(r >= 0);
if( subTypeId & asTYPEID_OBJHANDLE )
{

View File

@ -215,7 +215,7 @@ void CreditsScreen::loadedFromFile()
irr::core::stringw translators_credits = _("translator-credits");
const int MAX_PER_SCREEN = 6;
const unsigned MAX_PER_SCREEN = 6;
if (translators_credits != L"translator-credits")
{

View File

@ -177,8 +177,6 @@ void EditTrackScreen::init()
// -----------------------------------------------------------------------------
void EditTrackScreen::loadTrackList()
{
bool belongs_to_group;
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
assert(tracks_widget != NULL);
@ -187,7 +185,7 @@ void EditTrackScreen::loadTrackList()
for (unsigned int i = 0; i < track_manager->getNumberOfTracks(); i++)
{
Track* t = track_manager->getTrack(i);
belongs_to_group = (m_track_group.empty() ||
bool belongs_to_group = (m_track_group.empty() ||
m_track_group == ALL_TRACKS_GROUP_ID ||
t->isInGroup(m_track_group) );
if (!t->isArena() && !t->isSoccer() &&

View File

@ -1158,13 +1158,12 @@ void KartSelectionScreen::allPlayersDone()
if (selected_kart == RANDOM_KART_ID)
{
// don't select an already selected kart
int random_id;
// to prevent infinite loop in case they are all locked
int count = 0;
bool done = false;
do
{
random_id = random.get(item_count);
int random_id = random.get(item_count);
// valid kart if it can bt used, and is either not locked,
// or it's a multiplayer race.
if (items[random_id].m_code_name != ID_DONT_USE &&

View File

@ -621,11 +621,10 @@ bool OptionsScreenDevice::conflictsBetweenKbdConfig(PlayerAction action,
PlayerAction from,
PlayerAction to)
{
KeyboardConfig* other_kbd_config;
int id = m_config->getBinding(action).getId();
for (int i=0; i < input_manager->getDeviceManager()->getKeyboardAmount(); i++)
{
other_kbd_config =
KeyboardConfig* other_kbd_config =
input_manager->getDeviceManager()->getKeyboardConfig(i);
if (m_config != other_kbd_config &&

View File

@ -241,7 +241,6 @@ void ServerSelection::onUpdate(float dt)
m_server_list_widget->clear();
ServersManager *manager = ServersManager::get();
loadList();
m_server_list_widget->addItem("spacer", L"");
m_server_list_widget->addItem("loading",

View File

@ -30,6 +30,7 @@
#include "irrlicht.h"
#include <algorithm>
#include <cstdint>
#include <string>
/** Constructor for a checkline.
@ -171,7 +172,7 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
bool previous_sign;
if (kart_index == -1)
if (kart_index == UINT_MAX)
{
core::vector2df p = old_pos.toIrrVector2d();
previous_sign = (m_line.getPointOrientation(p) >= 0);
@ -212,10 +213,10 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
else
result = false;
if (kart_index != -1)
if (kart_index != UINT_MAX)
m_previous_sign[kart_index] = sign;
if (result && kart_index != -1)
if (result && kart_index != UINT_MAX)
{
LinearWorld* lw = dynamic_cast<LinearWorld*>(w);
if (lw != NULL)