diff --git a/Source/Core/Common/DynamicLibrary.cpp b/Source/Core/Common/DynamicLibrary.cpp index 7871198dda..73c25ce2a2 100644 --- a/Source/Core/Common/DynamicLibrary.cpp +++ b/Source/Core/Common/DynamicLibrary.cpp @@ -95,7 +95,7 @@ void DynamicLibrary::Close() return; #ifdef _WIN32 - FreeLibrary(reinterpret_cast(m_handle)); + FreeLibrary(static_cast(m_handle)); #else dlclose(m_handle); #endif @@ -105,7 +105,7 @@ void DynamicLibrary::Close() void* DynamicLibrary::GetSymbolAddress(const char* name) const { #ifdef _WIN32 - return reinterpret_cast(GetProcAddress(reinterpret_cast(m_handle), name)); + return reinterpret_cast(GetProcAddress(static_cast(m_handle), name)); #else return reinterpret_cast(dlsym(m_handle, name)); #endif diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index ffac0fc6c9..ae5b27f325 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -84,7 +84,7 @@ int SDCardDiskIOCtl(File::IOFile* image, u8 pdrv, u8 cmd, void* buff) case CTRL_SYNC: return RES_OK; case GET_SECTOR_COUNT: - *reinterpret_cast(buff) = image->GetSize() / SECTOR_SIZE; + *static_cast(buff) = image->GetSize() / SECTOR_SIZE; return RES_OK; default: WARN_LOG_FMT(COMMON, "Unexpected SD image ioctl {}", cmd); diff --git a/Source/Core/Common/GL/GLInterface/WGL.cpp b/Source/Core/Common/GL/GLInterface/WGL.cpp index 286859daf6..6a8bbfdb2e 100644 --- a/Source/Core/Common/GL/GLInterface/WGL.cpp +++ b/Source/Core/Common/GL/GLInterface/WGL.cpp @@ -234,7 +234,7 @@ bool GLContextWGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor return false; RECT window_rect = {}; - m_window_handle = reinterpret_cast(wsi.render_surface); + m_window_handle = static_cast(wsi.render_surface); if (!GetClientRect(m_window_handle, &window_rect)) return false; diff --git a/Source/Core/Common/IOFile.h b/Source/Core/Common/IOFile.h index b5895333b1..371012060d 100644 --- a/Source/Core/Common/IOFile.h +++ b/Source/Core/Common/IOFile.h @@ -87,14 +87,11 @@ public: return WriteArray(elements.data(), elements.size()); } - bool ReadBytes(void* data, size_t length) - { - return ReadArray(reinterpret_cast(data), length); - } + bool ReadBytes(void* data, size_t length) { return ReadArray(static_cast(data), length); } bool WriteBytes(const void* data, size_t length) { - return WriteArray(reinterpret_cast(data), length); + return WriteArray(static_cast(data), length); } bool WriteString(std::string_view str) { return WriteBytes(str.data(), str.size()); } diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp index ca40eb3fe1..a5d6eae1e7 100644 --- a/Source/Core/Common/Network.cpp +++ b/Source/Core/Common/Network.cpp @@ -293,7 +293,7 @@ u16 ComputeNetworkChecksum(const void* data, u16 length, u32 initial_value) { u32 checksum = initial_value; std::size_t index = 0; - const std::string_view data_view{reinterpret_cast(data), length}; + const std::string_view data_view{static_cast(data), length}; for (u8 b : data_view) { const bool is_hi = index++ % 2 == 0; diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index c724476ad7..ae25dcfce3 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -814,7 +814,7 @@ void AchievementManager::LeaderboardEntriesCallback(int result, const char* erro rc_client_leaderboard_entry_list_t* list, rc_client_t* client, void* userdata) { - u32* leaderboard_id = reinterpret_cast(userdata); + u32* leaderboard_id = static_cast(userdata); Common::ScopeGuard on_end_scope([&]() { delete leaderboard_id; }); if (result != RC_OK) diff --git a/Source/Core/Core/HW/DSP.cpp b/Source/Core/Core/HW/DSP.cpp index 869c0f42b5..17672b1924 100644 --- a/Source/Core/Core/HW/DSP.cpp +++ b/Source/Core/Core/HW/DSP.cpp @@ -431,7 +431,7 @@ void DSPManager::UpdateAudioDMA() // streaming output. auto& memory = m_system.GetMemory(); void* address = memory.GetPointerForRange(m_audio_dma.current_source_address, 32); - AudioCommon::SendAIBuffer(m_system, reinterpret_cast(address), 8); + AudioCommon::SendAIBuffer(m_system, static_cast(address), 8); if (m_audio_dma.remaining_blocks_count != 0) { diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceModem.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceModem.cpp index fbe75e7a84..9d8bae9d2e 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceModem.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceModem.cpp @@ -252,13 +252,13 @@ void CEXIModem::HandleWriteModemTransfer(const void* data, u32 size) if ((m_transfer_descriptor & 0x0F000000) == 0x03000000) { // AT command buffer - m_at_command_data.append(reinterpret_cast(data), size); + m_at_command_data.append(static_cast(data), size); RunAllPendingATCommands(); m_regs[Register::AT_COMMAND_SIZE] = static_cast(m_at_command_data.size()); } else if ((m_transfer_descriptor & 0x0F000000) == 0x08000000) { // Packet send buffer - m_send_buffer.append(reinterpret_cast(data), size); + m_send_buffer.append(static_cast(data), size); // A more accurate implementation would only set this interrupt if the send // FIFO has enough space; however, we can clear the send FIFO "instantly" // from the emulated program's perspective, so we always tell it the send diff --git a/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp b/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp index 4cae4e5e83..73430ef816 100644 --- a/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp +++ b/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp @@ -179,7 +179,7 @@ static DRESULT vff_ioctl(IOS::HLE::FS::FileHandle* vff, BYTE pdrv, BYTE cmd, voi case CTRL_SYNC: return RES_OK; case GET_SECTOR_COUNT: - *reinterpret_cast(buff) = vff->GetStatus()->size / IOS::HLE::NWC24::SECTOR_SIZE; + *static_cast(buff) = vff->GetStatus()->size / IOS::HLE::NWC24::SECTOR_SIZE; return RES_OK; default: WARN_LOG_FMT(IOS_WC24, "Unexpected FAT ioctl {}", cmd); diff --git a/Source/Core/Core/NetworkCaptureLogger.cpp b/Source/Core/Core/NetworkCaptureLogger.cpp index d7da8e2469..bc645a05c4 100644 --- a/Source/Core/Core/NetworkCaptureLogger.cpp +++ b/Source/Core/Core/NetworkCaptureLogger.cpp @@ -158,8 +158,7 @@ void PCAPSSLCaptureLogger::Log(LogType log_type, const void* data, std::size_t l to = other ? reinterpret_cast(other) : &peer; } - LogIPv4(log_type, reinterpret_cast(data), static_cast(length), socket, *from, - *to); + LogIPv4(log_type, static_cast(data), static_cast(length), socket, *from, *to); } void PCAPSSLCaptureLogger::LogIPv4(LogType log_type, const u8* data, u16 length, s32 socket, diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index 687d40417b..06cbcbb9c4 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -60,7 +60,7 @@ void JitBaseBlockCache::Init() m_entry_points_ptr = nullptr; #ifdef _ARCH_64 if (Config::Get(Config::MAIN_LARGE_ENTRY_POINTS_MAP)) - m_entry_points_ptr = reinterpret_cast(m_entry_points_arena.Create(FAST_BLOCK_MAP_SIZE)); + m_entry_points_ptr = static_cast(m_entry_points_arena.Create(FAST_BLOCK_MAP_SIZE)); #endif Clear(); diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index 78a9cd783d..c78c563d5d 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -175,8 +175,7 @@ LRESULT PlatformWin32::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam { case WM_NCCREATE: { - platform = - reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); + platform = static_cast(reinterpret_cast(lParam)->lpCreateParams); SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(platform)); return DefWindowProc(hwnd, msg, wParam, lParam); } diff --git a/Source/Core/DolphinQt/RenderWidget.cpp b/Source/Core/DolphinQt/RenderWidget.cpp index d88a17e3d3..4ca6ece1a9 100644 --- a/Source/Core/DolphinQt/RenderWidget.cpp +++ b/Source/Core/DolphinQt/RenderWidget.cpp @@ -141,7 +141,7 @@ void RenderWidget::OnHandleChanged(void* handle) #ifdef _WIN32 // Remove rounded corners from the render window on Windows 11 const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND; - DwmSetWindowAttribute(reinterpret_cast(handle), DWMWA_WINDOW_CORNER_PREFERENCE, + DwmSetWindowAttribute(static_cast(handle), DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference, sizeof(corner_preference)); #endif } diff --git a/Source/Core/VideoBackends/D3D/D3DBoundingBox.cpp b/Source/Core/VideoBackends/D3D/D3DBoundingBox.cpp index b972b9dd6f..049d090a0d 100644 --- a/Source/Core/VideoBackends/D3D/D3DBoundingBox.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBoundingBox.cpp @@ -79,7 +79,7 @@ std::vector D3DBoundingBox::Read(u32 index, u32 length) HRESULT hr = D3D::context->Map(m_staging_buffer.Get(), 0, D3D11_MAP_READ, 0, &map); if (SUCCEEDED(hr)) { - std::memcpy(values.data(), reinterpret_cast(map.pData) + sizeof(BBoxType) * index, + std::memcpy(values.data(), static_cast(map.pData) + sizeof(BBoxType) * index, sizeof(BBoxType) * length); D3D::context->Unmap(m_staging_buffer.Get(), 0); diff --git a/Source/Core/VideoBackends/D3D/D3DVertexManager.cpp b/Source/Core/VideoBackends/D3D/D3DVertexManager.cpp index 5929788b03..d6b4c69883 100644 --- a/Source/Core/VideoBackends/D3D/D3DVertexManager.cpp +++ b/Source/Core/VideoBackends/D3D/D3DVertexManager.cpp @@ -244,7 +244,7 @@ void VertexManager::CommitBuffer(u32 num_vertices, u32 vertex_stride, u32 num_in *out_base_index = (cursor + vertexBufferSize) / sizeof(u16); D3D::context->Map(m_buffers[m_current_buffer].Get(), 0, MapType, 0, &map); - u8* mappedData = reinterpret_cast(map.pData); + u8* mappedData = static_cast(map.pData); if (vertexBufferSize > 0) std::memcpy(mappedData + cursor, m_base_buffer_pointer, vertexBufferSize); if (indexBufferSize > 0) diff --git a/Source/Core/VideoBackends/D3D/DXTexture.cpp b/Source/Core/VideoBackends/D3D/DXTexture.cpp index 5d791b5246..f53da4f1a5 100644 --- a/Source/Core/VideoBackends/D3D/DXTexture.cpp +++ b/Source/Core/VideoBackends/D3D/DXTexture.cpp @@ -327,7 +327,7 @@ bool DXStagingTexture::Map() if (FAILED(hr)) return false; - m_map_pointer = reinterpret_cast(sr.pData); + m_map_pointer = static_cast(sr.pData); m_map_stride = sr.RowPitch; return true; } diff --git a/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.cpp b/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.cpp index f5d0ebdd00..1f85ccf384 100644 --- a/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.cpp +++ b/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.cpp @@ -47,7 +47,7 @@ std::vector D3D12BoundingBox::Read(u32 index, u32 length) return values; // Copy out the values we want - std::memcpy(values.data(), reinterpret_cast(mapped_pointer) + sizeof(BBoxType) * index, + std::memcpy(values.data(), static_cast(mapped_pointer) + sizeof(BBoxType) * index, sizeof(BBoxType) * length); static constexpr D3D12_RANGE write_range = {0, 0}; diff --git a/Source/Core/VideoBackends/D3D12/DX12Texture.cpp b/Source/Core/VideoBackends/D3D12/DX12Texture.cpp index 4a1faf6f97..0b30502864 100644 --- a/Source/Core/VideoBackends/D3D12/DX12Texture.cpp +++ b/Source/Core/VideoBackends/D3D12/DX12Texture.cpp @@ -305,7 +305,7 @@ void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* { const u8* src_ptr = buffer; const u32 copy_size = std::min(source_stride, upload_stride); - u8* dst_ptr = reinterpret_cast(upload_buffer_ptr); + u8* dst_ptr = static_cast(upload_buffer_ptr); for (u32 i = 0; i < num_rows; i++) { std::memcpy(dst_ptr, src_ptr, copy_size); diff --git a/Source/Core/VideoBackends/OGL/OGLBoundingBox.cpp b/Source/Core/VideoBackends/OGL/OGLBoundingBox.cpp index 6936163f3e..9b36a75b63 100644 --- a/Source/Core/VideoBackends/OGL/OGLBoundingBox.cpp +++ b/Source/Core/VideoBackends/OGL/OGLBoundingBox.cpp @@ -55,7 +55,7 @@ std::vector OGLBoundingBox::Read(u32 index, u32 length) GL_MAP_READ_BIT); if (ptr) { - std::memcpy(values.data(), reinterpret_cast(ptr) + sizeof(BBoxType) * index, + std::memcpy(values.data(), static_cast(ptr) + sizeof(BBoxType) * index, sizeof(BBoxType) * length); glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.cpp b/Source/Core/VideoBackends/OGL/OGLTexture.cpp index 58f1b10a04..0fa829c53c 100644 --- a/Source/Core/VideoBackends/OGL/OGLTexture.cpp +++ b/Source/Core/VideoBackends/OGL/OGLTexture.cpp @@ -462,7 +462,7 @@ std::unique_ptr OGLStagingTexture::Create(StagingTextureType } glBufferStorage(target, buffer_size, nullptr, buffer_flags); - buffer_ptr = reinterpret_cast(glMapBufferRange(target, 0, buffer_size, map_flags)); + buffer_ptr = static_cast(glMapBufferRange(target, 0, buffer_size, map_flags)); ASSERT(buffer_ptr != nullptr); } else @@ -639,7 +639,7 @@ bool OGLStagingTexture::Map() else flags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT; glBindBuffer(m_target, m_buffer_name); - m_map_pointer = reinterpret_cast(glMapBufferRange(m_target, 0, m_buffer_size, flags)); + m_map_pointer = static_cast(glMapBufferRange(m_target, 0, m_buffer_size, flags)); glBindBuffer(m_target, 0); return m_map_pointer != nullptr; } diff --git a/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp b/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp index c053ced700..4c61b5f609 100644 --- a/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp +++ b/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp @@ -180,7 +180,7 @@ bool StagingBuffer::AllocateBuffer(STAGING_BUFFER_TYPE type, VkDeviceSize size, } } - *out_map_ptr = reinterpret_cast(alloc_info.pMappedData); + *out_map_ptr = static_cast(alloc_info.pMappedData); if (res != VK_SUCCESS) { diff --git a/Source/Core/VideoBackends/Vulkan/VKStreamBuffer.cpp b/Source/Core/VideoBackends/Vulkan/VKStreamBuffer.cpp index 3efa00f6fa..a098302e6f 100644 --- a/Source/Core/VideoBackends/Vulkan/VKStreamBuffer.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKStreamBuffer.cpp @@ -81,7 +81,7 @@ bool StreamBuffer::AllocateBuffer() // Replace with the new buffer m_buffer = buffer; m_alloc = alloc; - m_host_pointer = reinterpret_cast(alloc_info.pMappedData); + m_host_pointer = static_cast(alloc_info.pMappedData); m_current_offset = 0; m_current_gpu_position = 0; m_tracked_fences.clear(); diff --git a/Source/Core/VideoBackends/Vulkan/VKSwapChain.cpp b/Source/Core/VideoBackends/Vulkan/VKSwapChain.cpp index 1005cc034a..0a34b02b23 100644 --- a/Source/Core/VideoBackends/Vulkan/VKSwapChain.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKSwapChain.cpp @@ -46,7 +46,7 @@ VkSurfaceKHR SwapChain::CreateVulkanSurface(VkInstance instance, const WindowSys nullptr, // const void* pNext 0, // VkWin32SurfaceCreateFlagsKHR flags nullptr, // HINSTANCE hinstance - reinterpret_cast(wsi.render_surface) // HWND hwnd + static_cast(wsi.render_surface) // HWND hwnd }; VkSurfaceKHR surface; diff --git a/Source/Core/VideoCommon/AbstractStagingTexture.cpp b/Source/Core/VideoCommon/AbstractStagingTexture.cpp index ef7e33db60..fdfb2807fb 100644 --- a/Source/Core/VideoCommon/AbstractStagingTexture.cpp +++ b/Source/Core/VideoCommon/AbstractStagingTexture.cpp @@ -57,7 +57,7 @@ void AbstractStagingTexture::ReadTexels(const MathUtil::Rectangle& rect, vo size_t copy_size = std::min(static_cast(rect.GetWidth() * m_texel_size), m_map_stride); int copy_height = rect.GetHeight(); - char* dst_ptr = reinterpret_cast(out_ptr); + char* dst_ptr = static_cast(out_ptr); for (int row = 0; row < copy_height; row++) { std::memcpy(dst_ptr, current_ptr, copy_size); @@ -101,7 +101,7 @@ void AbstractStagingTexture::WriteTexels(const MathUtil::Rectangle& rect, c size_t copy_size = std::min(static_cast(rect.GetWidth() * m_texel_size), m_map_stride); int copy_height = rect.GetHeight(); - const char* src_ptr = reinterpret_cast(in_ptr); + const char* src_ptr = static_cast(in_ptr); for (int row = 0; row < copy_height; row++) { std::memcpy(current_ptr, src_ptr, copy_size); diff --git a/Source/Core/VideoCommon/OnScreenUI.cpp b/Source/Core/VideoCommon/OnScreenUI.cpp index c755fcbfe7..affc07bf79 100644 --- a/Source/Core/VideoCommon/OnScreenUI.cpp +++ b/Source/Core/VideoCommon/OnScreenUI.cpp @@ -251,7 +251,7 @@ void OnScreenUI::DrawImGui() static_cast(cmd.ClipRect.x), static_cast(cmd.ClipRect.y), static_cast(cmd.ClipRect.z), static_cast(cmd.ClipRect.w)), g_gfx->GetCurrentFramebuffer())); - g_gfx->SetTexture(0, reinterpret_cast(cmd.TextureId)); + g_gfx->SetTexture(0, static_cast(cmd.TextureId)); g_gfx->DrawIndexed(base_index, cmd.ElemCount, base_vertex); base_index += cmd.ElemCount; } diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp index d25d49495a..54adb0e4d3 100644 --- a/Source/Core/VideoCommon/XFStructs.cpp +++ b/Source/Core/VideoCommon/XFStructs.cpp @@ -267,7 +267,7 @@ void LoadIndexedXF(CPArray array, u32 index, u16 address, u8 size) auto& fifo = system.GetFifo(); if (fifo.UseDeterministicGPUThread()) { - newData = reinterpret_cast(fifo.PopFifoAuxBuffer(buf_size)); + newData = static_cast(fifo.PopFifoAuxBuffer(buf_size)); } else {