Fixed missing includes and warnings under VS
Former-commit-id: c06756b62b616e7322aced01062966247bb7654f
This commit is contained in:
@@ -351,7 +351,7 @@ namespace
|
||||
if (info.format & SF_FORMAT_VORBIS)
|
||||
sf_command(file, SFC_SET_SCALE_FLOAT_INT_READ, nullptr, SF_TRUE);
|
||||
|
||||
sf_count_t sampleCount = info.frames * info.channels;
|
||||
unsigned int sampleCount = static_cast<unsigned int>(info.frames * info.channels);
|
||||
std::unique_ptr<nzInt16[]> samples(new nzInt16[sampleCount]);
|
||||
|
||||
if (sf_read_short(file, samples.get(), sampleCount) != sampleCount)
|
||||
@@ -364,14 +364,13 @@ namespace
|
||||
if (parameters.forceMono && format != nzAudioFormat_Mono)
|
||||
{
|
||||
// Nous effectuons la conversion en mono dans le même buffer (il va de toute façon être copié)
|
||||
NzMixToMono(monoSamples.get(), monoSamples.get(), info.channels, info.frames);
|
||||
NzMixToMono(samples.get(), samples.get(), static_cast<unsigned int>(info.channels), static_cast<unsigned int>(info.frames));
|
||||
|
||||
format = nzAudioFormat_Mono;
|
||||
samples = std::move(monoSamples);
|
||||
sampleCount = info.frames;
|
||||
sampleCount = static_cast<unsigned int>(info.frames);
|
||||
}
|
||||
|
||||
if (!soundBuffer->Create(format, static_cast<unsigned int>(sampleCount), info.samplerate, samples.get()))
|
||||
if (!soundBuffer->Create(format, sampleCount, info.samplerate, samples.get()))
|
||||
{
|
||||
NazaraError("Failed to create sound buffer");
|
||||
return false;
|
||||
|
||||
@@ -733,7 +733,7 @@ bool NzFile::FillHash(NzAbstractHash* hash) const
|
||||
unsigned int size;
|
||||
while (remainingSize > 0)
|
||||
{
|
||||
size = std::min(remainingSize, static_cast<nzUInt64>(NAZARA_CORE_FILE_BUFFERSIZE));
|
||||
size = static_cast<unsigned int>(std::min(remainingSize, static_cast<nzUInt64>(NAZARA_CORE_FILE_BUFFERSIZE)));
|
||||
if (file.Read(&buffer[0], sizeof(char), size) != sizeof(char)*size)
|
||||
{
|
||||
NazaraError("Unable to read file");
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <Nazara/Core/GuillotineBinPack.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
@@ -22,8 +23,8 @@ namespace
|
||||
|
||||
int ScoreBestLongSideFit(int width, int height, const NzRectui& freeRectSize)
|
||||
{
|
||||
int leftoverHoriz = std::abs(freeRectSize.width - width);
|
||||
int leftoverVert = std::abs(freeRectSize.height - height);
|
||||
int leftoverHoriz = std::abs(static_cast<int>(freeRectSize.width - width));
|
||||
int leftoverVert = std::abs(static_cast<int>(freeRectSize.height - height));
|
||||
int leftover = std::max(leftoverHoriz, leftoverVert);
|
||||
|
||||
return leftover;
|
||||
@@ -31,8 +32,8 @@ namespace
|
||||
|
||||
int ScoreBestShortSideFit(int width, int height, const NzRectui& freeRectSize)
|
||||
{
|
||||
int leftoverHoriz = std::abs(freeRectSize.width - width);
|
||||
int leftoverVert = std::abs(freeRectSize.height - height);
|
||||
int leftoverHoriz = std::abs(static_cast<int>(freeRectSize.width - width));
|
||||
int leftoverVert = std::abs(static_cast<int>(freeRectSize.height - height));
|
||||
int leftover = std::min(leftoverHoriz, leftoverVert);
|
||||
|
||||
return leftover;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/Core/HardwareInfo.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include <Nazara/Core/HashDigest.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
NzHashDigest::NzHashDigest() :
|
||||
|
||||
@@ -91,7 +91,7 @@ bool NzParameterList::GetFloatParameter(const NzString& name, float* value) cons
|
||||
return true;
|
||||
|
||||
case nzParameterType_Integer:
|
||||
*value = it->second.value.intVal;
|
||||
*value = static_cast<float>(it->second.value.intVal);
|
||||
return true;
|
||||
|
||||
case nzParameterType_String:
|
||||
@@ -99,7 +99,7 @@ bool NzParameterList::GetFloatParameter(const NzString& name, float* value) cons
|
||||
double converted;
|
||||
if (it->second.value.stringVal.ToDouble(&converted))
|
||||
{
|
||||
*value = converted;
|
||||
*value = static_cast<float>(converted);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ bool NzParameterList::GetIntegerParameter(const NzString& name, int* value) cons
|
||||
return true;
|
||||
|
||||
case nzParameterType_Float:
|
||||
*value = it->second.value.floatVal;
|
||||
*value = static_cast<int>(it->second.value.floatVal);
|
||||
return true;
|
||||
|
||||
case nzParameterType_Integer:
|
||||
@@ -147,7 +147,7 @@ bool NzParameterList::GetIntegerParameter(const NzString& name, int* value) cons
|
||||
{
|
||||
if (converted <= std::numeric_limits<int>::max() && converted >= std::numeric_limits<int>::min())
|
||||
{
|
||||
*value = converted;
|
||||
*value = static_cast<int>(converted);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3129,7 +3129,7 @@ NzString NzString::SubStringFrom(char character, int startPos, bool fromLast, bo
|
||||
else
|
||||
pos = Find(character, startPos, flags);
|
||||
|
||||
if (pos == 0 and include)
|
||||
if (pos == 0 && include)
|
||||
return *this;
|
||||
else if (pos == npos)
|
||||
return NzString();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
@@ -81,12 +81,12 @@ void NzScene::Draw()
|
||||
if (m_renderTechniqueRanking > 0)
|
||||
{
|
||||
m_renderTechnique.reset(NzRenderTechniques::GetByRanking(m_renderTechniqueRanking-1, &m_renderTechniqueRanking));
|
||||
NazaraError("Render technique \"" + oldName + "\" failed, falling back to \"" + m_renderTechnique->GetName() + '"');
|
||||
NazaraError("Render technique \"" + oldName + "\" failed (" + NzString(e.what()) + "), falling back to \"" + m_renderTechnique->GetName() + '"');
|
||||
}
|
||||
else
|
||||
{
|
||||
NzErrorFlags errFlags(nzErrorFlag_ThrowException);
|
||||
NazaraError("Render technique \"" + oldName + "\" failed and no fallback is available");
|
||||
NazaraError("Render technique \"" + oldName + "\" failed (" + NzString(e.what()) + ") and no fallback is available");
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -294,7 +294,7 @@ void NzView::UpdateProjectionMatrix() const
|
||||
if (!m_viewportUpdated)
|
||||
UpdateViewport();
|
||||
|
||||
m_projectionMatrix.MakeOrtho(0.f, m_viewport.width, 0.f, m_viewport.height, m_zNear, m_zFar);
|
||||
m_projectionMatrix.MakeOrtho(0.f, static_cast<float>(m_viewport.width), 0.f, static_cast<float>(m_viewport.height), m_zNear, m_zFar);
|
||||
}
|
||||
else
|
||||
m_projectionMatrix.MakeOrtho(0.f, m_size.x, 0.f, m_size.y, m_zNear, m_zFar);
|
||||
|
||||
@@ -173,7 +173,7 @@ bool NzLuaInstance::CheckBoolean(int index) const
|
||||
return false;
|
||||
}
|
||||
|
||||
return lua_toboolean(m_state, index);
|
||||
return lua_toboolean(m_state, index) != 0;
|
||||
}
|
||||
|
||||
bool NzLuaInstance::CheckBoolean(int index, bool defValue) const
|
||||
@@ -181,7 +181,7 @@ bool NzLuaInstance::CheckBoolean(int index, bool defValue) const
|
||||
if (lua_isnoneornil(m_state, index))
|
||||
return defValue;
|
||||
|
||||
return lua_toboolean(m_state, index);
|
||||
return lua_toboolean(m_state, index) != 0;
|
||||
}
|
||||
|
||||
long long NzLuaInstance::CheckInteger(int index) const
|
||||
@@ -257,7 +257,7 @@ bool NzLuaInstance::Compare(int index1, int index2, nzLuaComparison comparison)
|
||||
}
|
||||
#endif
|
||||
|
||||
return (lua_compare(m_state, index1, index2, s_comparisons[comparison]) == 1);
|
||||
return (lua_compare(m_state, index1, index2, s_comparisons[comparison]) != 0);
|
||||
}
|
||||
|
||||
void NzLuaInstance::Compute(nzLuaOperation operation)
|
||||
@@ -476,7 +476,7 @@ nzLuaType NzLuaInstance::GetMetatable(const NzString& tname) const
|
||||
|
||||
bool NzLuaInstance::GetMetatable(int index) const
|
||||
{
|
||||
return lua_getmetatable(m_state, index) == 1;
|
||||
return lua_getmetatable(m_state, index) != 0;
|
||||
}
|
||||
|
||||
unsigned int NzLuaInstance::GetStackTop() const
|
||||
@@ -522,34 +522,34 @@ bool NzLuaInstance::IsOfType(int index, nzLuaType type) const
|
||||
switch (type)
|
||||
{
|
||||
case nzLuaType_Boolean:
|
||||
return lua_isboolean(m_state, index) == 1;
|
||||
return lua_isboolean(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_Function:
|
||||
return lua_isfunction(m_state, index) == 1;
|
||||
return lua_isfunction(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_LightUserdata:
|
||||
return lua_islightuserdata(m_state, index) == 1;
|
||||
return lua_islightuserdata(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_Nil:
|
||||
return lua_isnil(m_state, index) == 1;
|
||||
return lua_isnil(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_None:
|
||||
return lua_isnone(m_state, index) == 1;
|
||||
return lua_isnone(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_Number:
|
||||
return lua_isnumber(m_state, index) == 1;
|
||||
return lua_isnumber(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_String:
|
||||
return lua_isstring(m_state, index) == 1;
|
||||
return lua_isstring(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_Table:
|
||||
return lua_istable(m_state, index) == 1;
|
||||
return lua_istable(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_Thread:
|
||||
return lua_isthread(m_state, index) == 1;
|
||||
return lua_isthread(m_state, index) != 0;
|
||||
|
||||
case nzLuaType_Userdata:
|
||||
return lua_isuserdata(m_state, index) == 1;
|
||||
return lua_isuserdata(m_state, index) != 0;
|
||||
}
|
||||
|
||||
NazaraError("Lua type not handled (0x" + NzString::Number(type, 16) + ')');
|
||||
@@ -569,7 +569,7 @@ bool NzLuaInstance::IsOfType(int index, const NzString& tname) const
|
||||
|
||||
bool NzLuaInstance::IsValid(int index) const
|
||||
{
|
||||
return !lua_isnoneornil(m_state, index);
|
||||
return lua_isnoneornil(m_state, index) == 0;
|
||||
}
|
||||
|
||||
unsigned int NzLuaInstance::Length(int index) const
|
||||
@@ -584,17 +584,17 @@ void NzLuaInstance::MoveTo(NzLuaInstance* instance, int n)
|
||||
|
||||
bool NzLuaInstance::NewMetatable(const char* str)
|
||||
{
|
||||
return luaL_newmetatable(m_state, str) == 1;
|
||||
return luaL_newmetatable(m_state, str) != 0;
|
||||
}
|
||||
|
||||
bool NzLuaInstance::NewMetatable(const NzString& str)
|
||||
{
|
||||
return luaL_newmetatable(m_state, str.GetConstBuffer());
|
||||
return luaL_newmetatable(m_state, str.GetConstBuffer()) != 0;
|
||||
}
|
||||
|
||||
bool NzLuaInstance::Next(int index)
|
||||
{
|
||||
return lua_next(m_state, index) == 1;
|
||||
return lua_next(m_state, index) != 0;
|
||||
}
|
||||
|
||||
void NzLuaInstance::Pop(unsigned int n)
|
||||
@@ -604,7 +604,7 @@ void NzLuaInstance::Pop(unsigned int n)
|
||||
|
||||
void NzLuaInstance::PushBoolean(bool value)
|
||||
{
|
||||
lua_pushboolean(m_state, value);
|
||||
lua_pushboolean(m_state, (value) ? 1 : 0);
|
||||
}
|
||||
|
||||
void NzLuaInstance::PushCFunction(NzLuaCFunction func, int upvalueCount)
|
||||
@@ -750,7 +750,7 @@ void NzLuaInstance::SetTimeLimit(nzUInt32 timeLimit)
|
||||
|
||||
bool NzLuaInstance::ToBoolean(int index) const
|
||||
{
|
||||
return lua_toboolean(m_state, index);
|
||||
return lua_toboolean(m_state, index) != 0;
|
||||
}
|
||||
|
||||
long long NzLuaInstance::ToInteger(int index, bool* succeeded) const
|
||||
@@ -759,7 +759,7 @@ long long NzLuaInstance::ToInteger(int index, bool* succeeded) const
|
||||
long long result = lua_tointegerx(m_state, index, &success);
|
||||
|
||||
if (succeeded)
|
||||
*succeeded = (success == 1);
|
||||
*succeeded = (success != 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -770,7 +770,7 @@ double NzLuaInstance::ToNumber(int index, bool* succeeded) const
|
||||
double result = lua_tonumberx(m_state, index, &success);
|
||||
|
||||
if (succeeded)
|
||||
*succeeded = (success == 1);
|
||||
*succeeded = (success != 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ NzUberShaderInstance* NzUberShaderPreprocessor::Get(const NzParameterList& param
|
||||
// On construit l'instant
|
||||
shaderIt = m_cache.emplace(flags, shader.Get()).first;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
catch (const std::exception&)
|
||||
{
|
||||
NzErrorFlags errFlags(nzErrorFlag_ThrowExceptionDisabled);
|
||||
|
||||
|
||||
@@ -212,12 +212,12 @@ namespace
|
||||
|
||||
bool HasKerning() const override
|
||||
{
|
||||
return FT_HAS_KERNING(m_face);
|
||||
return FT_HAS_KERNING(m_face) != 0;
|
||||
}
|
||||
|
||||
bool IsScalable() const override
|
||||
{
|
||||
return FT_IS_SCALABLE(m_face);
|
||||
return FT_IS_SCALABLE(m_face) != 0;
|
||||
}
|
||||
|
||||
bool Open()
|
||||
|
||||
@@ -296,5 +296,5 @@ void NzSimpleTextDrawer::UpdateGlyphs() const
|
||||
m_glyphs.push_back(glyph);
|
||||
}
|
||||
|
||||
m_bounds.Set(std::floor(textBounds.x), std::floor(textBounds.y), std::ceil(textBounds.width), std::ceil(textBounds.height));
|
||||
m_bounds.Set(NzRectf(std::floor(textBounds.x), std::floor(textBounds.y), std::ceil(textBounds.width), std::ceil(textBounds.height)));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/Utility/Win32/CursorImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
bool NzCursorImpl::Create(const NzImage& cursor, int hotSpotX, int hotSpotY)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/Utility/Win32/IconImpl.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
bool NzIconImpl::Create(const NzImage& icon)
|
||||
|
||||
Reference in New Issue
Block a user