Fix a shitload of warnings in 64 bits mode

Former-commit-id: c7792a7d5b1f85ab934da25324831b9daa3f47ff [formerly 3469974c48432be1f65808bff0ea39d9e22f5b50]
Former-commit-id: 5080815e9e1a3aebe237ff9a291b908ce0292eca
This commit is contained in:
Lynix
2016-06-13 21:09:55 +02:00
parent f36eec7346
commit 819b46f5fc
39 changed files with 191 additions and 188 deletions

View File

@@ -96,7 +96,7 @@ namespace Nz
//UInt64 oldCursorPos = GetCursorPos();
DWORD read = 0;
if (ReadFile(m_handle, buffer, size, &read, nullptr))
if (ReadFile(m_handle, buffer, static_cast<DWORD>(size), &read, nullptr))
{
m_endOfFile = (read != size);
m_endOfFileUpdated = true;
@@ -191,9 +191,9 @@ namespace Nz
LARGE_INTEGER cursorPos;
cursorPos.QuadPart = GetCursorPos();
LockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, size, 0);
WriteFile(m_handle, buffer, size, &written, nullptr);
UnlockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, size, 0);
LockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, static_cast<DWORD>(size), 0);
WriteFile(m_handle, buffer, static_cast<DWORD>(size), &written, nullptr);
UnlockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, static_cast<DWORD>(size), 0);
m_endOfFileUpdated = false;

View File

@@ -24,7 +24,7 @@ namespace Nz
}
#endif
s_workerCount = workerCount;
s_workerCount = static_cast<DWORD>(workerCount);
s_doneEvents.reset(new HANDLE[workerCount]);
s_workers.reset(new Worker[workerCount]);
s_workerThreads.reset(new HANDLE[workerCount]);
@@ -64,7 +64,7 @@ namespace Nz
// On s'assure que des tâches ne sont pas déjà en cours
WaitForMultipleObjects(s_workerCount, &s_doneEvents[0], true, INFINITE);
std::ldiv_t div = std::ldiv(count, s_workerCount); // Division et modulo en une opération, y'a pas de petit profit
std::lldiv_t div = std::lldiv(count, s_workerCount); // Division et modulo en une opération, y'a pas de petit profit
for (std::size_t i = 0; i < s_workerCount; ++i)
{
// On va maintenant répartir les tâches entre chaque worker et les envoyer dans la queue de chacun
@@ -78,7 +78,7 @@ namespace Nz
}
// On les lance une fois qu'ils sont tous initialisés (pour éviter qu'un worker ne passe en pause détectant une absence de travaux)
for (unsigned int i = 0; i < s_workerCount; ++i)
for (std::size_t i = 0; i < s_workerCount; ++i)
{
ResetEvent(s_doneEvents[i]);
SetEvent(s_workers[i].wakeEvent);
@@ -244,5 +244,5 @@ namespace Nz
std::unique_ptr<HANDLE[]> TaskSchedulerImpl::s_doneEvents; // Doivent être contigus
std::unique_ptr<TaskSchedulerImpl::Worker[]> TaskSchedulerImpl::s_workers;
std::unique_ptr<HANDLE[]> TaskSchedulerImpl::s_workerThreads; // Doivent être contigus
std::size_t TaskSchedulerImpl::s_workerCount;
DWORD TaskSchedulerImpl::s_workerCount;
}

View File

@@ -44,7 +44,7 @@ namespace Nz
static std::unique_ptr<HANDLE[]> s_doneEvents; // Doivent être contigus
static std::unique_ptr<Worker[]> s_workers;
static std::unique_ptr<HANDLE[]> s_workerThreads; // Doivent être contigus
static std::size_t s_workerCount;
static DWORD s_workerCount;
};
}

View File

@@ -64,8 +64,8 @@ namespace Nz
pair.second.used = false;
// ... until they are marked as used by the drawer
unsigned int fontCount = drawer.GetFontCount();
for (unsigned int i = 0; i < fontCount; ++i)
std::size_t fontCount = drawer.GetFontCount();
for (std::size_t i = 0; i < fontCount; ++i)
{
Font* font = drawer.GetFont(i);
const AbstractAtlas* atlas = font->GetAtlas().get();
@@ -95,7 +95,7 @@ namespace Nz
++atlasIt;
}
unsigned int glyphCount = drawer.GetGlyphCount();
std::size_t glyphCount = drawer.GetGlyphCount();
m_localVertices.resize(glyphCount * 4);
// Reset glyph count for every texture to zero
@@ -105,7 +105,7 @@ namespace Nz
// Count glyph count for each texture
Texture* lastTexture = nullptr;
unsigned int* count = nullptr;
for (unsigned int i = 0; i < glyphCount; ++i)
for (std::size_t i = 0; i < glyphCount; ++i)
{
const AbstractTextDrawer::Glyph& glyph = drawer.GetGlyph(i);

View File

@@ -401,7 +401,7 @@ namespace Nz
return false;
}
unsigned int length = static_cast<unsigned int>(file.GetSize());
std::size_t length = static_cast<std::size_t>(file.GetSize());
String source(length, '\0');
@@ -416,7 +416,7 @@ namespace Nz
return Execute(source);
}
bool LuaInstance::ExecuteFromMemory(const void* data, unsigned int size)
bool LuaInstance::ExecuteFromMemory(const void* data, std::size_t size)
{
MemoryView stream(data, size);
return ExecuteFromStream(stream);
@@ -679,7 +679,7 @@ namespace Nz
lua_pushstring(m_state, str);
}
void LuaInstance::PushString(const char* str, unsigned int size) const
void LuaInstance::PushString(const char* str, std::size_t size) const
{
lua_pushlstring(m_state, str, size);
}
@@ -694,7 +694,7 @@ namespace Nz
lua_createtable(m_state, sequenceElementCount, arrayElementCount);
}
void* LuaInstance::PushUserdata(unsigned int size) const
void* LuaInstance::PushUserdata(std::size_t size) const
{
return lua_newuserdata(m_state, size);
}
@@ -749,7 +749,7 @@ namespace Nz
lua_setmetatable(m_state, index);
}
void LuaInstance::SetMemoryLimit(UInt32 memoryLimit)
void LuaInstance::SetMemoryLimit(std::size_t memoryLimit)
{
m_memoryLimit = memoryLimit;
}
@@ -860,8 +860,8 @@ namespace Nz
void* LuaInstance::MemoryAllocator(void* ud, void* ptr, std::size_t osize, std::size_t nsize)
{
LuaInstance* instance = static_cast<LuaInstance*>(ud);
UInt32& memoryLimit = instance->m_memoryLimit;
UInt32& memoryUsage = instance->m_memoryUsage;
std::size_t& memoryLimit = instance->m_memoryLimit;
std::size_t& memoryUsage = instance->m_memoryUsage;
if (nsize == 0)
{
@@ -872,7 +872,7 @@ namespace Nz
}
else
{
UInt32 usage = memoryUsage + nsize;
std::size_t usage = memoryUsage + nsize;
if (ptr)
usage -= osize;

View File

@@ -56,7 +56,7 @@ namespace Nz
std::array<char, NI_MAXHOST> hostnameBuffer;
std::array<char, NI_MAXSERV> serviceBuffer;
int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), hostnameBuffer.size(), serviceBuffer.data(), serviceBuffer.size(), flags);
int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast<std::size_t>(hostnameBuffer.size()), serviceBuffer.data(), static_cast<std::size_t>(serviceBuffer.size()), flags);
if (result == 0)
{
if (hostname)

View File

@@ -328,7 +328,7 @@ namespace Nz
return code == TRUE;
}
unsigned int SocketImpl::QueryMaxDatagramSize(SocketHandle handle, SocketError* error)
std::size_t SocketImpl::QueryMaxDatagramSize(SocketHandle handle, SocketError* error)
{
unsigned int code;
int codeLength = sizeof(code);

View File

@@ -227,7 +227,8 @@ namespace Nz
}
GLenum type;
UInt8* offset = reinterpret_cast<UInt8*>(s_indexBuffer->GetStartOffset());
UInt8* offset = nullptr;
offset += s_indexBuffer->GetStartOffset();
if (s_indexBuffer->HasLargeIndices())
{
@@ -290,7 +291,8 @@ namespace Nz
}
GLenum type;
UInt8* offset = reinterpret_cast<UInt8*>(s_indexBuffer->GetStartOffset());
UInt8* offset = nullptr;
offset += s_indexBuffer->GetStartOffset();
if (s_indexBuffer->HasLargeIndices())
{

View File

@@ -364,7 +364,7 @@ namespace Nz
return Image::GetMaxLevel(m_impl->type, m_impl->width, m_impl->height, m_impl->depth);
}
unsigned int Texture::GetMemoryUsage() const
std::size_t Texture::GetMemoryUsage() const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -399,7 +399,7 @@ namespace Nz
return size * PixelFormat::GetBytesPerPixel(m_impl->format);
}
unsigned int Texture::GetMemoryUsage(UInt8 level) const
std::size_t Texture::GetMemoryUsage(UInt8 level) const
{
#if NAZARA_UTILITY_SAFE
if (!m_impl)

View File

@@ -127,7 +127,7 @@ namespace Nz
return m_atlas;
}
unsigned int Font::GetCachedGlyphCount(unsigned int characterSize, UInt32 style) const
std::size_t Font::GetCachedGlyphCount(unsigned int characterSize, UInt32 style) const
{
UInt64 key = ComputeKey(characterSize, style);
auto it = m_glyphes.find(key);
@@ -137,9 +137,9 @@ namespace Nz
return it->second.size();
}
unsigned int Font::GetCachedGlyphCount() const
std::size_t Font::GetCachedGlyphCount() const
{
unsigned int count = 0;
std::size_t count = 0;
for (auto& pair : m_glyphes)
count += pair.second.size();

View File

@@ -37,10 +37,10 @@ namespace Nz
}
const MD5AnimParser::Frame* frames = parser.GetFrames();
unsigned int frameCount = parser.GetFrameCount();
unsigned int frameRate = parser.GetFrameRate();
std::size_t frameCount = parser.GetFrameCount();
std::size_t frameRate = parser.GetFrameRate();
const MD5AnimParser::Joint* joints = parser.GetJoints();
unsigned int jointCount = parser.GetJointCount();
std::size_t jointCount = parser.GetJointCount();
// À ce stade, nous sommes censés avoir assez d'informations pour créer l'animation
animation->CreateSkeletal(frameCount, jointCount);
@@ -59,10 +59,10 @@ namespace Nz
Quaternionf rotationQuat = Quaternionf::RotationBetween(Vector3f::UnitX(), Vector3f::Forward()) *
Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up());
for (unsigned int i = 0; i < jointCount; ++i)
for (std::size_t i = 0; i < jointCount; ++i)
{
int parent = joints[i].parent;
for (unsigned int j = 0; j < frameCount; ++j)
for (std::size_t j = 0; j < frameCount; ++j)
{
SequenceJoint& sequenceJoint = sequenceJoints[j*jointCount + i];

View File

@@ -48,7 +48,7 @@ namespace Nz
return Ternary_False;
}
unsigned int MD5AnimParser::GetAnimatedComponentCount() const
std::size_t MD5AnimParser::GetAnimatedComponentCount() const
{
return m_animatedComponents.size();
}
@@ -58,12 +58,12 @@ namespace Nz
return m_frames.data();
}
unsigned int MD5AnimParser::GetFrameCount() const
std::size_t MD5AnimParser::GetFrameCount() const
{
return m_frames.size();
}
unsigned int MD5AnimParser::GetFrameRate() const
std::size_t MD5AnimParser::GetFrameRate() const
{
return m_frameRate;
}
@@ -73,7 +73,7 @@ namespace Nz
return m_joints.data();
}
unsigned int MD5AnimParser::GetJointCount() const
std::size_t MD5AnimParser::GetJointCount() const
{
return m_joints.size();
}

View File

@@ -53,15 +53,15 @@ namespace Nz
const MD5MeshParser::Joint* joints = parser.GetJoints();
const MD5MeshParser::Mesh* meshes = parser.GetMeshes();
unsigned int jointCount = parser.GetJointCount();
unsigned int meshCount = parser.GetMeshCount();
std::size_t jointCount = parser.GetJointCount();
std::size_t meshCount = parser.GetMeshCount();
if (parameters.animated)
{
mesh->CreateSkeletal(jointCount);
Skeleton* skeleton = mesh->GetSkeleton();
for (unsigned int i = 0; i < jointCount; ++i)
for (std::size_t i = 0; i < jointCount; ++i)
{
Joint* joint = skeleton->GetJoint(i);
@@ -82,12 +82,12 @@ namespace Nz
}
mesh->SetMaterialCount(meshCount);
for (unsigned int i = 0; i < meshCount; ++i)
for (std::size_t i = 0; i < meshCount; ++i)
{
const MD5MeshParser::Mesh& md5Mesh = meshes[i];
unsigned int indexCount = md5Mesh.triangles.size()*3;
unsigned int vertexCount = md5Mesh.vertices.size();
std::size_t indexCount = md5Mesh.triangles.size()*3;
std::size_t vertexCount = md5Mesh.vertices.size();
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -227,11 +227,11 @@ namespace Nz
}
mesh->SetMaterialCount(meshCount);
for (unsigned int i = 0; i < meshCount; ++i)
for (std::size_t i = 0; i < meshCount; ++i)
{
const MD5MeshParser::Mesh& md5Mesh = meshes[i];
unsigned int indexCount = md5Mesh.triangles.size()*3;
unsigned int vertexCount = md5Mesh.vertices.size();
std::size_t indexCount = md5Mesh.triangles.size()*3;
std::size_t vertexCount = md5Mesh.vertices.size();
// Index buffer
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());

View File

@@ -58,7 +58,7 @@ namespace Nz
return m_joints.data();
}
unsigned int MD5MeshParser::GetJointCount() const
std::size_t MD5MeshParser::GetJointCount() const
{
return m_joints.size();
}
@@ -68,7 +68,7 @@ namespace Nz
return m_meshes.data();
}
unsigned int MD5MeshParser::GetMeshCount() const
std::size_t MD5MeshParser::GetMeshCount() const
{
return m_meshes.size();
}

View File

@@ -70,7 +70,7 @@ namespace Nz
return layer.image.get();
}
unsigned int GuillotineImageAtlas::GetLayerCount() const
std::size_t GuillotineImageAtlas::GetLayerCount() const
{
return m_layers.size();
}

View File

@@ -666,7 +666,7 @@ namespace Nz
return GetMaxLevel(m_sharedImage->type, m_sharedImage->width, m_sharedImage->height, m_sharedImage->depth);
}
unsigned int Image::GetMemoryUsage() const
std::size_t Image::GetMemoryUsage() const
{
unsigned int width = m_sharedImage->width;
unsigned int height = m_sharedImage->height;
@@ -693,7 +693,7 @@ namespace Nz
return size * PixelFormat::GetBytesPerPixel(m_sharedImage->format);
}
unsigned int Image::GetMemoryUsage(UInt8 level) const
std::size_t Image::GetMemoryUsage(UInt8 level) const
{
return PixelFormat::ComputeSize(m_sharedImage->format, GetLevelSize(m_sharedImage->width, level), GetLevelSize(m_sharedImage->height, level), ((m_sharedImage->type == ImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level)));
}

View File

@@ -72,19 +72,19 @@ namespace Nz
return m_font;
}
Font* SimpleTextDrawer::GetFont(unsigned int index) const
Font* SimpleTextDrawer::GetFont(std::size_t index) const
{
NazaraAssert(index == 0, "Font index out of range");
return m_font;
}
unsigned int SimpleTextDrawer::GetFontCount() const
std::size_t SimpleTextDrawer::GetFontCount() const
{
return 1;
}
const AbstractTextDrawer::Glyph& SimpleTextDrawer::GetGlyph(unsigned int index) const
const AbstractTextDrawer::Glyph& SimpleTextDrawer::GetGlyph(std::size_t index) const
{
if (!m_glyphUpdated)
UpdateGlyphs();
@@ -94,7 +94,7 @@ namespace Nz
return m_glyphs[index];
}
unsigned int SimpleTextDrawer::GetGlyphCount() const
std::size_t SimpleTextDrawer::GetGlyphCount() const
{
if (!m_glyphUpdated)
UpdateGlyphs();

View File

@@ -394,7 +394,7 @@ namespace Nz
void WindowImpl::SetMaximumSize(int width, int height)
{
RECT rect = {0, 0, width, height};
AdjustWindowRect(&rect, GetWindowLongPtr(m_handle, GWL_STYLE), false);
AdjustWindowRect(&rect, static_cast<DWORD>(GetWindowLongPtr(m_handle, GWL_STYLE)), false);
if (width != -1)
m_maxSize.x = rect.right-rect.left;
@@ -410,7 +410,7 @@ namespace Nz
void WindowImpl::SetMinimumSize(int width, int height)
{
RECT rect = {0, 0, width, height};
AdjustWindowRect(&rect, GetWindowLongPtr(m_handle, GWL_STYLE), false);
AdjustWindowRect(&rect, static_cast<DWORD>(GetWindowLongPtr(m_handle, GWL_STYLE)), false);
if (width != -1)
m_minSize.x = rect.right-rect.left;
@@ -432,7 +432,7 @@ namespace Nz
{
// SetWindowPos demande la taille totale de la fenêtre
RECT rect = {0, 0, static_cast<LONG>(width), static_cast<LONG>(height)};
AdjustWindowRect(&rect, GetWindowLongPtr(m_handle, GWL_STYLE), false);
AdjustWindowRect(&rect, static_cast<DWORD>(GetWindowLongPtr(m_handle, GWL_STYLE)), false);
SetWindowPos(m_handle, nullptr, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER);
}