diff --git a/include/Nazara/Core/Endianness.inl b/include/Nazara/Core/Endianness.inl index 400224920..2949e3f19 100644 --- a/include/Nazara/Core/Endianness.inl +++ b/include/Nazara/Core/Endianness.inl @@ -34,7 +34,7 @@ namespace Nz inline void SwapBytes(void* buffer, unsigned int size) { - UInt8* bytes = reinterpret_cast(buffer); + UInt8* bytes = static_cast(buffer); unsigned int i = 0; unsigned int j = size - 1; diff --git a/include/Nazara/Core/SparsePtr.inl b/include/Nazara/Core/SparsePtr.inl index 166efe751..0da69b0ad 100644 --- a/include/Nazara/Core/SparsePtr.inl +++ b/include/Nazara/Core/SparsePtr.inl @@ -161,7 +161,7 @@ namespace Nz template void SparsePtr::SetPtr(VoidPtr ptr) { - m_ptr = reinterpret_cast(ptr); + m_ptr = static_cast(ptr); } /*! diff --git a/src/Nazara/Core/Error.cpp b/src/Nazara/Core/Error.cpp index ae6f0cc09..05dea1232 100644 --- a/src/Nazara/Core/Error.cpp +++ b/src/Nazara/Core/Error.cpp @@ -87,12 +87,12 @@ namespace Nz wchar_t* buffer = nullptr; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, - code, - 0, - reinterpret_cast(&buffer), - 0, - nullptr); + nullptr, + code, + 0, + reinterpret_cast(&buffer), + 0, + nullptr); String error(String::Unicode(buffer)); LocalFree(buffer); diff --git a/src/Nazara/Core/MemoryManager.cpp b/src/Nazara/Core/MemoryManager.cpp index 5ee1755d7..3a4883bec 100644 --- a/src/Nazara/Core/MemoryManager.cpp +++ b/src/Nazara/Core/MemoryManager.cpp @@ -110,7 +110,7 @@ namespace Nz pthread_mutex_lock(&s_mutex); #endif - Block* ptr = reinterpret_cast(std::malloc(size+sizeof(Block))); + Block* ptr = static_cast(std::malloc(size+sizeof(Block))); if (!ptr) { char timeStr[23]; @@ -209,7 +209,7 @@ namespace Nz if (!pointer) return; - Block* ptr = reinterpret_cast(reinterpret_cast(pointer) - sizeof(Block)); + Block* ptr = reinterpret_cast(static_cast(pointer) - sizeof(Block)); if (ptr->magic != s_allocatedId) { char timeStr[23]; diff --git a/src/Nazara/Core/MemoryView.cpp b/src/Nazara/Core/MemoryView.cpp index 02c8b26c2..e501a031f 100644 --- a/src/Nazara/Core/MemoryView.cpp +++ b/src/Nazara/Core/MemoryView.cpp @@ -26,7 +26,7 @@ namespace Nz MemoryView::MemoryView(void* ptr, UInt64 size) : Stream(StreamOption_None, OpenMode_ReadWrite), - m_ptr(reinterpret_cast(ptr)), + m_ptr(static_cast(ptr)), m_pos(0), m_size(size) { @@ -43,7 +43,7 @@ namespace Nz MemoryView::MemoryView(const void* ptr, UInt64 size) : Stream(StreamOption_None, OpenMode_ReadOnly), - m_ptr(reinterpret_cast(const_cast(ptr))), //< Okay, right, const_cast is bad, but this pointer is still read-only + m_ptr(static_cast(const_cast(ptr))), //< Okay, right, const_cast is bad, but this pointer is still read-only m_pos(0), m_size(size) { diff --git a/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp b/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp index c93859d68..5b5d7153d 100644 --- a/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp +++ b/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp @@ -195,7 +195,7 @@ namespace Nz unsigned int __stdcall TaskSchedulerImpl::WorkerProc(void* userdata) { - unsigned int workerID = *reinterpret_cast(userdata); + unsigned int workerID = *static_cast(userdata); SetEvent(s_doneEvents[workerID]); Worker& worker = s_workers[workerID]; diff --git a/src/Nazara/Graphics/ForwardRenderTechnique.cpp b/src/Nazara/Graphics/ForwardRenderTechnique.cpp index 2db03b7f9..36f6918fa 100644 --- a/src/Nazara/Graphics/ForwardRenderTechnique.cpp +++ b/src/Nazara/Graphics/ForwardRenderTechnique.cpp @@ -272,7 +272,7 @@ namespace Nz { // On ouvre le buffer en écriture BufferMapper vertexMapper(m_spriteBuffer, BufferAccess_DiscardAndWrite); - VertexStruct_XYZ_Color_UV* vertices = reinterpret_cast(vertexMapper.GetPointer()); + VertexStruct_XYZ_Color_UV* vertices = static_cast(vertexMapper.GetPointer()); unsigned int spriteCount = 0; unsigned int maxSpriteCount = std::min(s_maxQuads, m_spriteBuffer.GetVertexCount()/4); @@ -411,7 +411,7 @@ namespace Nz billboardCount -= renderedBillboardCount; BufferMapper vertexMapper(m_billboardPointBuffer, BufferAccess_DiscardAndWrite, 0, renderedBillboardCount*4); - BillboardPoint* vertices = reinterpret_cast(vertexMapper.GetPointer()); + BillboardPoint* vertices = static_cast(vertexMapper.GetPointer()); for (unsigned int i = 0; i < renderedBillboardCount; ++i) { diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index c6b6a45e5..8e437d759 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -633,7 +633,7 @@ namespace Nz void LuaInstance::PushFunction(LuaFunction func) const { - LuaFunction* luaFunc = reinterpret_cast(lua_newuserdata(m_state, sizeof(LuaFunction))); + LuaFunction* luaFunc = static_cast(lua_newuserdata(m_state, sizeof(LuaFunction))); PlacementNew(luaFunc, std::move(func)); lua_pushcclosure(m_state, ProxyFunc, 1); diff --git a/src/Nazara/Network/TcpClient.cpp b/src/Nazara/Network/TcpClient.cpp index 5b31b6bd5..a134cf870 100644 --- a/src/Nazara/Network/TcpClient.cpp +++ b/src/Nazara/Network/TcpClient.cpp @@ -221,7 +221,7 @@ namespace Nz { int sendSize = static_cast(std::min(size - totalByteSent, std::numeric_limits::max())); //< Handle very large send int sentSize; - if (!SocketImpl::Send(m_handle, reinterpret_cast(buffer) + totalByteSent, sendSize, &sentSize, &m_lastError)) + if (!SocketImpl::Send(m_handle, static_cast(buffer) + totalByteSent, sendSize, &sentSize, &m_lastError)) { switch (m_lastError) { diff --git a/src/Nazara/Network/Win32/SocketImpl.cpp b/src/Nazara/Network/Win32/SocketImpl.cpp index 1c5ee7ad0..35d4b2371 100644 --- a/src/Nazara/Network/Win32/SocketImpl.cpp +++ b/src/Nazara/Network/Win32/SocketImpl.cpp @@ -405,7 +405,7 @@ namespace Nz NazaraAssert(handle != InvalidHandle, "Invalid handle"); NazaraAssert(buffer && length > 0, "Invalid buffer"); - int byteRead = recv(handle, reinterpret_cast(buffer), length, 0); + int byteRead = recv(handle, static_cast(buffer), length, 0); if (byteRead == SOCKET_ERROR) { int errorCode = WSAGetLastError(); diff --git a/src/Nazara/Renderer/DebugDrawer.cpp b/src/Nazara/Renderer/DebugDrawer.cpp index 03b8b63a8..5623e6e8d 100644 --- a/src/Nazara/Renderer/DebugDrawer.cpp +++ b/src/Nazara/Renderer/DebugDrawer.cpp @@ -67,7 +67,7 @@ namespace Nz } BufferMapper mapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, 24); - VertexStruct_XYZ* vertex = reinterpret_cast(mapper.GetPointer()); + VertexStruct_XYZ* vertex = static_cast(mapper.GetPointer()); Vector3f max, min; max = box.GetMaximum(); @@ -158,7 +158,7 @@ namespace Nz } BufferMapper mapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, 24); - VertexStruct_XYZ* vertex = reinterpret_cast(mapper.GetPointer()); + VertexStruct_XYZ* vertex = static_cast(mapper.GetPointer()); vertex->position.Set(frustum.GetCorner(BoxCorner_NearLeftBottom)); vertex++; @@ -240,7 +240,7 @@ namespace Nz } BufferMapper mapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, 24); - VertexStruct_XYZ* vertex = reinterpret_cast(mapper.GetPointer()); + VertexStruct_XYZ* vertex = static_cast(mapper.GetPointer()); vertex->position.Set(orientedBox.GetCorner(BoxCorner_NearLeftBottom)); vertex++; @@ -329,7 +329,7 @@ namespace Nz } BufferMapper mapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, jointCount*2); - VertexStruct_XYZ* vertex = reinterpret_cast(mapper.GetPointer()); + VertexStruct_XYZ* vertex = static_cast(mapper.GetPointer()); unsigned int vertexCount = 0; for (unsigned int i = 0; i < jointCount; ++i) @@ -407,8 +407,8 @@ namespace Nz BufferMapper inputMapper(subMesh->GetVertexBuffer(), BufferAccess_ReadOnly); BufferMapper outputMapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, vertexCount); - MeshVertex* inputVertex = reinterpret_cast(inputMapper.GetPointer()); - VertexStruct_XYZ* outputVertex = reinterpret_cast(outputMapper.GetPointer()); + MeshVertex* inputVertex = static_cast(inputMapper.GetPointer()); + VertexStruct_XYZ* outputVertex = static_cast(outputMapper.GetPointer()); for (unsigned int i = 0; i < normalCount; ++i) { @@ -449,7 +449,7 @@ namespace Nz transformMatrix.SetTranslation(origin); BufferMapper mapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, 16); - VertexStruct_XYZ* vertex = reinterpret_cast(mapper.GetPointer()); + VertexStruct_XYZ* vertex = static_cast(mapper.GetPointer()); // On calcule le reste des points Vector3f base(Vector3f::Forward()*length); @@ -575,8 +575,8 @@ namespace Nz BufferMapper inputMapper(subMesh->GetVertexBuffer(), BufferAccess_ReadOnly); BufferMapper outputMapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, vertexCount); - MeshVertex* inputVertex = reinterpret_cast(inputMapper.GetPointer()); - VertexStruct_XYZ* outputVertex = reinterpret_cast(outputMapper.GetPointer()); + MeshVertex* inputVertex = static_cast(inputMapper.GetPointer()); + VertexStruct_XYZ* outputVertex = static_cast(outputMapper.GetPointer()); for (unsigned int i = 0; i < normalCount; ++i) { @@ -622,8 +622,8 @@ namespace Nz BufferMapper inputMapper(subMesh->GetVertexBuffer(), BufferAccess_ReadOnly); BufferMapper outputMapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, vertexCount); - MeshVertex* inputVertex = reinterpret_cast(inputMapper.GetPointer()); - VertexStruct_XYZ* outputVertex = reinterpret_cast(outputMapper.GetPointer()); + MeshVertex* inputVertex = static_cast(inputMapper.GetPointer()); + VertexStruct_XYZ* outputVertex = static_cast(outputMapper.GetPointer()); for (unsigned int i = 0; i < tangentCount; ++i) { diff --git a/src/Nazara/Renderer/GpuQuery.cpp b/src/Nazara/Renderer/GpuQuery.cpp index 6c3d404ce..4e7ff228f 100644 --- a/src/Nazara/Renderer/GpuQuery.cpp +++ b/src/Nazara/Renderer/GpuQuery.cpp @@ -19,7 +19,7 @@ namespace Nz Context::EnsureContext(); m_id = 0; - glGenQueries(1, reinterpret_cast(&m_id)); + glGenQueries(1, static_cast(&m_id)); #ifdef NAZARA_DEBUG if (!m_id) diff --git a/src/Nazara/Utility/Formats/MD2Loader.cpp b/src/Nazara/Utility/Formats/MD2Loader.cpp index 856a73823..184adfe17 100644 --- a/src/Nazara/Utility/Formats/MD2Loader.cpp +++ b/src/Nazara/Utility/Formats/MD2Loader.cpp @@ -115,7 +115,7 @@ namespace Nz stream.Read(&triangles[0], header.num_tris*sizeof(MD2_Triangle)); BufferMapper indexMapper(indexBuffer, BufferAccess_DiscardAndWrite); - UInt16* index = reinterpret_cast(indexMapper.GetPointer()); + UInt16* index = static_cast(indexMapper.GetPointer()); for (unsigned int i = 0; i < header.num_tris; ++i) { @@ -190,7 +190,7 @@ namespace Nz translate *= s; BufferMapper vertexMapper(vertexBuffer, BufferAccess_DiscardAndWrite); - MeshVertex* vertex = reinterpret_cast(vertexMapper.GetPointer()); + MeshVertex* vertex = static_cast(vertexMapper.GetPointer()); /// Chargement des coordonnées de texture const unsigned int indexFix[3] = {0, 2, 1}; // Pour respécifier les indices dans le bon ordre diff --git a/src/Nazara/Utility/Formats/MD5MeshLoader.cpp b/src/Nazara/Utility/Formats/MD5MeshLoader.cpp index 4c4b61bae..629452161 100644 --- a/src/Nazara/Utility/Formats/MD5MeshLoader.cpp +++ b/src/Nazara/Utility/Formats/MD5MeshLoader.cpp @@ -249,7 +249,7 @@ namespace Nz VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent), vertexCount, parameters.storage); BufferMapper vertexMapper(vertexBuffer, BufferAccess_WriteOnly); - MeshVertex* vertex = reinterpret_cast(vertexMapper.GetPointer()); + MeshVertex* vertex = static_cast(vertexMapper.GetPointer()); for (const MD5MeshParser::Vertex& md5Vertex : md5Mesh.vertices) { // Skinning MD5 (Formule d'Id Tech) diff --git a/src/Nazara/Utility/IndexMapper.cpp b/src/Nazara/Utility/IndexMapper.cpp index e95f9b3cd..adf80a764 100644 --- a/src/Nazara/Utility/IndexMapper.cpp +++ b/src/Nazara/Utility/IndexMapper.cpp @@ -14,25 +14,25 @@ namespace Nz { UInt32 Getter16(const void* buffer, unsigned int i) { - const UInt16* ptr = reinterpret_cast(buffer); + const UInt16* ptr = static_cast(buffer); return ptr[i]; } UInt32 Getter32(const void* buffer, unsigned int i) { - const UInt32* ptr = reinterpret_cast(buffer); + const UInt32* ptr = static_cast(buffer); return ptr[i]; } void Setter16(void* buffer, unsigned int i, UInt32 value) { - UInt16* ptr = reinterpret_cast(buffer); + UInt16* ptr = static_cast(buffer); ptr[i] = static_cast(value); } void Setter32(void* buffer, unsigned int i, UInt32 value) { - UInt32* ptr = reinterpret_cast(buffer); + UInt32* ptr = static_cast(buffer); ptr[i] = value; } diff --git a/src/Nazara/Utility/Win32/InputImpl.cpp b/src/Nazara/Utility/Win32/InputImpl.cpp index 443e38855..ba604deb8 100644 --- a/src/Nazara/Utility/Win32/InputImpl.cpp +++ b/src/Nazara/Utility/Win32/InputImpl.cpp @@ -213,7 +213,7 @@ namespace Nz Vector2i EventImpl::GetMousePosition(const Window& relativeTo) { - HWND handle = reinterpret_cast(relativeTo.GetHandle()); + HWND handle = static_cast(relativeTo.GetHandle()); if (handle) { POINT pos; @@ -283,7 +283,7 @@ namespace Nz void EventImpl::SetMousePosition(int x, int y, const Window& relativeTo) { - HWND handle = reinterpret_cast(relativeTo.GetHandle()); + HWND handle = static_cast(relativeTo.GetHandle()); if (handle) { POINT pos = {x, y}; diff --git a/src/Nazara/Utility/Win32/WindowImpl.cpp b/src/Nazara/Utility/Win32/WindowImpl.cpp index e910e8acc..2bf9c9d02 100644 --- a/src/Nazara/Utility/Win32/WindowImpl.cpp +++ b/src/Nazara/Utility/Win32/WindowImpl.cpp @@ -193,7 +193,7 @@ namespace Nz bool WindowImpl::Create(WindowHandle handle) { - m_handle = reinterpret_cast(handle); + m_handle = static_cast(handle); if (!m_handle || !IsWindow(m_handle)) { @@ -342,7 +342,7 @@ namespace Nz #endif if (cursor != WindowCursor_None) - m_cursor = reinterpret_cast(LoadImage(nullptr, windowsCursors[cursor], IMAGE_CURSOR, 0, 0, LR_SHARED)); + m_cursor = static_cast(LoadImage(nullptr, windowsCursors[cursor], IMAGE_CURSOR, 0, 0, LR_SHARED)); else m_cursor = nullptr; @@ -1125,7 +1125,7 @@ namespace Nz WindowImpl* me; if (message == WM_CREATE) { - me = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); + me = static_cast(reinterpret_cast(lParam)->lpCreateParams); SetWindowLongPtr(window, GWL_USERDATA, reinterpret_cast(me)); } else