This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Restore safe reinterpret_casts in misc Windows code

  • Loading branch information...
nlyan committed Sep 12, 2016
1 parent f1cd215 commit 5a03e37d154560951b86bae76d1753bc8c4820ea
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/lib/arch/win32/ArchMiscWindows.cpp
@@ -234,7 +234,7 @@ ArchMiscWindows::setValue(HKEY key,
return;
}
RegSetValueEx(key, name, 0, REG_SZ,
- static_cast<const BYTE*>(value.c_str()),
+ reinterpret_cast<const BYTE*>(value.c_str()),
(DWORD)value.size() + 1);
}
@@ -247,7 +247,7 @@ ArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value)
return;
}
RegSetValueEx(key, name, 0, REG_DWORD,
- static_cast<CONST BYTE*>(&value),
+ reinterpret_cast<CONST BYTE*>(&value),
sizeof(DWORD));
}
@@ -262,7 +262,7 @@ ArchMiscWindows::setValueBinary(HKEY key,
return;
}
RegSetValueEx(key, name, 0, REG_BINARY,
- static_cast<const BYTE*>(value.data()),
+ reinterpret_cast<const BYTE*>(value.data()),
(DWORD)value.size());
}
@@ -287,7 +287,7 @@ ArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR* name, DWORD type)
// read it
result = RegQueryValueEx(key, name, 0, &actualType,
- static_cast<BYTE*>(buffer), &size);
+ reinterpret_cast<BYTE*>(buffer), &size);
if (result != ERROR_SUCCESS || actualType != type) {
delete[] buffer;
return std::string();
@@ -322,7 +322,7 @@ ArchMiscWindows::readValueInt(HKEY key, const TCHAR* name)
DWORD value;
DWORD size = sizeof(value);
LONG result = RegQueryValueEx(key, name, 0, &type,
- static_cast<BYTE*>(&value), &size);
+ reinterpret_cast<BYTE*>(&value), &size);
if (result != ERROR_SUCCESS || type != REG_DWORD) {
return 0;
}
@@ -374,7 +374,7 @@ ArchMiscWindows::setThreadExecutionState(DWORD busyModes)
if (s_stes == NULL) {
HINSTANCE kernel = LoadLibrary("kernel32.dll");
if (kernel != NULL) {
- s_stes = static_cast<STES_t>(GetProcAddress(kernel,
+ s_stes = reinterpret_cast<STES_t>(GetProcAddress(kernel,
"SetThreadExecutionState"));
}
if (s_stes == NULL) {
@@ -414,7 +414,7 @@ ArchMiscWindows::wakeupDisplay()
if (s_stes == NULL) {
HINSTANCE kernel = LoadLibrary("kernel32.dll");
if (kernel != NULL) {
- s_stes = static_cast<STES_t>(GetProcAddress(kernel,
+ s_stes = reinterpret_cast<STES_t>(GetProcAddress(kernel,
"SetThreadExecutionState"));
}
if (s_stes == NULL) {

0 comments on commit 5a03e37

Please sign in to comment.