mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 05:17:44 -07:00
Replace 'reinterpret_cast' with 'static_cast'
This commit is contained in:
parent
53ede795a2
commit
6d44afc7dd
@ -95,7 +95,7 @@ void DynamicLibrary::Close()
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(m_handle));
|
||||
FreeLibrary(static_cast<HMODULE>(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<void*>(GetProcAddress(reinterpret_cast<HMODULE>(m_handle), name));
|
||||
return reinterpret_cast<void*>(GetProcAddress(static_cast<HMODULE>(m_handle), name));
|
||||
#else
|
||||
return reinterpret_cast<void*>(dlsym(m_handle, name));
|
||||
#endif
|
||||
|
@ -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<LBA_t*>(buff) = image->GetSize() / SECTOR_SIZE;
|
||||
*static_cast<LBA_t*>(buff) = image->GetSize() / SECTOR_SIZE;
|
||||
return RES_OK;
|
||||
default:
|
||||
WARN_LOG_FMT(COMMON, "Unexpected SD image ioctl {}", cmd);
|
||||
|
@ -234,7 +234,7 @@ bool GLContextWGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
||||
return false;
|
||||
|
||||
RECT window_rect = {};
|
||||
m_window_handle = reinterpret_cast<HWND>(wsi.render_surface);
|
||||
m_window_handle = static_cast<HWND>(wsi.render_surface);
|
||||
if (!GetClientRect(m_window_handle, &window_rect))
|
||||
return false;
|
||||
|
||||
|
@ -87,14 +87,11 @@ public:
|
||||
return WriteArray(elements.data(), elements.size());
|
||||
}
|
||||
|
||||
bool ReadBytes(void* data, size_t length)
|
||||
{
|
||||
return ReadArray(reinterpret_cast<char*>(data), length);
|
||||
}
|
||||
bool ReadBytes(void* data, size_t length) { return ReadArray(static_cast<char*>(data), length); }
|
||||
|
||||
bool WriteBytes(const void* data, size_t length)
|
||||
{
|
||||
return WriteArray(reinterpret_cast<const char*>(data), length);
|
||||
return WriteArray(static_cast<const char*>(data), length);
|
||||
}
|
||||
|
||||
bool WriteString(std::string_view str) { return WriteBytes(str.data(), str.size()); }
|
||||
|
@ -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<const char*>(data), length};
|
||||
const std::string_view data_view{static_cast<const char*>(data), length};
|
||||
for (u8 b : data_view)
|
||||
{
|
||||
const bool is_hi = index++ % 2 == 0;
|
||||
|
@ -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<u32*>(userdata);
|
||||
u32* leaderboard_id = static_cast<u32*>(userdata);
|
||||
Common::ScopeGuard on_end_scope([&]() { delete leaderboard_id; });
|
||||
|
||||
if (result != RC_OK)
|
||||
|
@ -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<short*>(address), 8);
|
||||
AudioCommon::SendAIBuffer(m_system, static_cast<short*>(address), 8);
|
||||
|
||||
if (m_audio_dma.remaining_blocks_count != 0)
|
||||
{
|
||||
|
@ -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<const char*>(data), size);
|
||||
m_at_command_data.append(static_cast<const char*>(data), size);
|
||||
RunAllPendingATCommands();
|
||||
m_regs[Register::AT_COMMAND_SIZE] = static_cast<u8>(m_at_command_data.size());
|
||||
}
|
||||
else if ((m_transfer_descriptor & 0x0F000000) == 0x08000000)
|
||||
{ // Packet send buffer
|
||||
m_send_buffer.append(reinterpret_cast<const char*>(data), size);
|
||||
m_send_buffer.append(static_cast<const char*>(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
|
||||
|
@ -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<LBA_t*>(buff) = vff->GetStatus()->size / IOS::HLE::NWC24::SECTOR_SIZE;
|
||||
*static_cast<LBA_t*>(buff) = vff->GetStatus()->size / IOS::HLE::NWC24::SECTOR_SIZE;
|
||||
return RES_OK;
|
||||
default:
|
||||
WARN_LOG_FMT(IOS_WC24, "Unexpected FAT ioctl {}", cmd);
|
||||
|
@ -158,8 +158,7 @@ void PCAPSSLCaptureLogger::Log(LogType log_type, const void* data, std::size_t l
|
||||
to = other ? reinterpret_cast<sockaddr_in*>(other) : &peer;
|
||||
}
|
||||
|
||||
LogIPv4(log_type, reinterpret_cast<const u8*>(data), static_cast<u16>(length), socket, *from,
|
||||
*to);
|
||||
LogIPv4(log_type, static_cast<const u8*>(data), static_cast<u16>(length), socket, *from, *to);
|
||||
}
|
||||
|
||||
void PCAPSSLCaptureLogger::LogIPv4(LogType log_type, const u8* data, u16 length, s32 socket,
|
||||
|
@ -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<u8**>(m_entry_points_arena.Create(FAST_BLOCK_MAP_SIZE));
|
||||
m_entry_points_ptr = static_cast<u8**>(m_entry_points_arena.Create(FAST_BLOCK_MAP_SIZE));
|
||||
#endif
|
||||
|
||||
Clear();
|
||||
|
@ -175,8 +175,7 @@ LRESULT PlatformWin32::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
platform =
|
||||
reinterpret_cast<PlatformWin32*>(reinterpret_cast<CREATESTRUCT*>(lParam)->lpCreateParams);
|
||||
platform = static_cast<PlatformWin32*>(reinterpret_cast<CREATESTRUCT*>(lParam)->lpCreateParams);
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(platform));
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
@ -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<HWND>(handle), DWMWA_WINDOW_CORNER_PREFERENCE,
|
||||
DwmSetWindowAttribute(static_cast<HWND>(handle), DWMWA_WINDOW_CORNER_PREFERENCE,
|
||||
&corner_preference, sizeof(corner_preference));
|
||||
#endif
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ std::vector<BBoxType> 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<const u8*>(map.pData) + sizeof(BBoxType) * index,
|
||||
std::memcpy(values.data(), static_cast<const u8*>(map.pData) + sizeof(BBoxType) * index,
|
||||
sizeof(BBoxType) * length);
|
||||
|
||||
D3D::context->Unmap(m_staging_buffer.Get(), 0);
|
||||
|
@ -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<u8*>(map.pData);
|
||||
u8* mappedData = static_cast<u8*>(map.pData);
|
||||
if (vertexBufferSize > 0)
|
||||
std::memcpy(mappedData + cursor, m_base_buffer_pointer, vertexBufferSize);
|
||||
if (indexBufferSize > 0)
|
||||
|
@ -327,7 +327,7 @@ bool DXStagingTexture::Map()
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
|
||||
m_map_pointer = reinterpret_cast<char*>(sr.pData);
|
||||
m_map_pointer = static_cast<char*>(sr.pData);
|
||||
m_map_stride = sr.RowPitch;
|
||||
return true;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ std::vector<BBoxType> D3D12BoundingBox::Read(u32 index, u32 length)
|
||||
return values;
|
||||
|
||||
// Copy out the values we want
|
||||
std::memcpy(values.data(), reinterpret_cast<const u8*>(mapped_pointer) + sizeof(BBoxType) * index,
|
||||
std::memcpy(values.data(), static_cast<const u8*>(mapped_pointer) + sizeof(BBoxType) * index,
|
||||
sizeof(BBoxType) * length);
|
||||
|
||||
static constexpr D3D12_RANGE write_range = {0, 0};
|
||||
|
@ -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<u8*>(upload_buffer_ptr);
|
||||
u8* dst_ptr = static_cast<u8*>(upload_buffer_ptr);
|
||||
for (u32 i = 0; i < num_rows; i++)
|
||||
{
|
||||
std::memcpy(dst_ptr, src_ptr, copy_size);
|
||||
|
@ -55,7 +55,7 @@ std::vector<BBoxType> OGLBoundingBox::Read(u32 index, u32 length)
|
||||
GL_MAP_READ_BIT);
|
||||
if (ptr)
|
||||
{
|
||||
std::memcpy(values.data(), reinterpret_cast<const u8*>(ptr) + sizeof(BBoxType) * index,
|
||||
std::memcpy(values.data(), static_cast<const u8*>(ptr) + sizeof(BBoxType) * index,
|
||||
sizeof(BBoxType) * length);
|
||||
|
||||
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
|
||||
|
@ -462,7 +462,7 @@ std::unique_ptr<OGLStagingTexture> OGLStagingTexture::Create(StagingTextureType
|
||||
}
|
||||
|
||||
glBufferStorage(target, buffer_size, nullptr, buffer_flags);
|
||||
buffer_ptr = reinterpret_cast<char*>(glMapBufferRange(target, 0, buffer_size, map_flags));
|
||||
buffer_ptr = static_cast<char*>(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<char*>(glMapBufferRange(m_target, 0, m_buffer_size, flags));
|
||||
m_map_pointer = static_cast<char*>(glMapBufferRange(m_target, 0, m_buffer_size, flags));
|
||||
glBindBuffer(m_target, 0);
|
||||
return m_map_pointer != nullptr;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ bool StagingBuffer::AllocateBuffer(STAGING_BUFFER_TYPE type, VkDeviceSize size,
|
||||
}
|
||||
}
|
||||
|
||||
*out_map_ptr = reinterpret_cast<char*>(alloc_info.pMappedData);
|
||||
*out_map_ptr = static_cast<char*>(alloc_info.pMappedData);
|
||||
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ bool StreamBuffer::AllocateBuffer()
|
||||
// Replace with the new buffer
|
||||
m_buffer = buffer;
|
||||
m_alloc = alloc;
|
||||
m_host_pointer = reinterpret_cast<u8*>(alloc_info.pMappedData);
|
||||
m_host_pointer = static_cast<u8*>(alloc_info.pMappedData);
|
||||
m_current_offset = 0;
|
||||
m_current_gpu_position = 0;
|
||||
m_tracked_fences.clear();
|
||||
|
@ -46,7 +46,7 @@ VkSurfaceKHR SwapChain::CreateVulkanSurface(VkInstance instance, const WindowSys
|
||||
nullptr, // const void* pNext
|
||||
0, // VkWin32SurfaceCreateFlagsKHR flags
|
||||
nullptr, // HINSTANCE hinstance
|
||||
reinterpret_cast<HWND>(wsi.render_surface) // HWND hwnd
|
||||
static_cast<HWND>(wsi.render_surface) // HWND hwnd
|
||||
};
|
||||
|
||||
VkSurfaceKHR surface;
|
||||
|
@ -57,7 +57,7 @@ void AbstractStagingTexture::ReadTexels(const MathUtil::Rectangle<int>& rect, vo
|
||||
|
||||
size_t copy_size = std::min(static_cast<size_t>(rect.GetWidth() * m_texel_size), m_map_stride);
|
||||
int copy_height = rect.GetHeight();
|
||||
char* dst_ptr = reinterpret_cast<char*>(out_ptr);
|
||||
char* dst_ptr = static_cast<char*>(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<int>& rect, c
|
||||
|
||||
size_t copy_size = std::min(static_cast<size_t>(rect.GetWidth() * m_texel_size), m_map_stride);
|
||||
int copy_height = rect.GetHeight();
|
||||
const char* src_ptr = reinterpret_cast<const char*>(in_ptr);
|
||||
const char* src_ptr = static_cast<const char*>(in_ptr);
|
||||
for (int row = 0; row < copy_height; row++)
|
||||
{
|
||||
std::memcpy(current_ptr, src_ptr, copy_size);
|
||||
|
@ -251,7 +251,7 @@ void OnScreenUI::DrawImGui()
|
||||
static_cast<int>(cmd.ClipRect.x), static_cast<int>(cmd.ClipRect.y),
|
||||
static_cast<int>(cmd.ClipRect.z), static_cast<int>(cmd.ClipRect.w)),
|
||||
g_gfx->GetCurrentFramebuffer()));
|
||||
g_gfx->SetTexture(0, reinterpret_cast<const AbstractTexture*>(cmd.TextureId));
|
||||
g_gfx->SetTexture(0, static_cast<const AbstractTexture*>(cmd.TextureId));
|
||||
g_gfx->DrawIndexed(base_index, cmd.ElemCount, base_vertex);
|
||||
base_index += cmd.ElemCount;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void LoadIndexedXF(CPArray array, u32 index, u16 address, u8 size)
|
||||
auto& fifo = system.GetFifo();
|
||||
if (fifo.UseDeterministicGPUThread())
|
||||
{
|
||||
newData = reinterpret_cast<u32*>(fifo.PopFifoAuxBuffer(buf_size));
|
||||
newData = static_cast<u32*>(fifo.PopFifoAuxBuffer(buf_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user