Merge pull request #13181 from tygyh/Replace-'reinterpret_cast'

Replace 'reinterpret_cast' with 'static_cast'
This commit is contained in:
JosJuice
2025-03-15 15:31:38 +01:00
committed by GitHub
26 changed files with 31 additions and 36 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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()); }

View File

@ -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;