Brutally replace all reinterpret_casts with static_casts

This commit is contained in:
Andrew Nelless 2016-09-19 17:22:41 +01:00
parent e6a3caaf75
commit f3d1470e58
46 changed files with 213 additions and 213 deletions

View File

@ -221,7 +221,7 @@ MSWindowsClientTaskBarReceiver::primaryAction()
const IArchTaskBarReceiver::Icon const IArchTaskBarReceiver::Icon
MSWindowsClientTaskBarReceiver::getIcon() const MSWindowsClientTaskBarReceiver::getIcon() const
{ {
return reinterpret_cast<Icon>(m_icon[getStatus()]); return static_cast<Icon>(m_icon[getStatus()]);
} }
void void
@ -263,7 +263,7 @@ MSWindowsClientTaskBarReceiver::loadIcon(UINT id)
IMAGE_ICON, IMAGE_ICON,
0, 0, 0, 0,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
return reinterpret_cast<HICON>(icon); return static_cast<HICON>(icon);
} }
void void
@ -287,8 +287,8 @@ MSWindowsClientTaskBarReceiver::createWindow()
MAKEINTRESOURCE(IDD_TASKBAR_STATUS), MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL, NULL,
(DLGPROC)&MSWindowsClientTaskBarReceiver::staticDlgProc, (DLGPROC)&MSWindowsClientTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>( static_cast<LPARAM>(
reinterpret_cast<void*>(this))); static_cast<void*>(this)));
// window should appear on top of everything, including (especially) // window should appear on top of everything, including (especially)
// the task bar. // the task bar.
@ -337,8 +337,8 @@ MSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
// and put it in the extra window data then forward the call. // and put it in the extra window data then forward the call.
MSWindowsClientTaskBarReceiver* self = NULL; MSWindowsClientTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) { if (msg == WM_INITDIALOG) {
self = reinterpret_cast<MSWindowsClientTaskBarReceiver*>( self = static_cast<MSWindowsClientTaskBarReceiver*>(
reinterpret_cast<void*>(lParam)); static_cast<void*>(lParam));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) lParam); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) lParam);
} }
else { else {

View File

@ -238,7 +238,7 @@ MSWindowsPortableTaskBarReceiver::primaryAction()
const IArchTaskBarReceiver::Icon const IArchTaskBarReceiver::Icon
MSWindowsPortableTaskBarReceiver::getIcon() const MSWindowsPortableTaskBarReceiver::getIcon() const
{ {
return reinterpret_cast<Icon>(m_icon[getStatus()]); return static_cast<Icon>(m_icon[getStatus()]);
} }
void void
@ -280,7 +280,7 @@ MSWindowsPortableTaskBarReceiver::loadIcon(UINT id)
IMAGE_ICON, IMAGE_ICON,
0, 0, 0, 0,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
return reinterpret_cast<HICON>(icon); return static_cast<HICON>(icon);
} }
void void
@ -304,8 +304,8 @@ MSWindowsPortableTaskBarReceiver::createWindow()
MAKEINTRESOURCE(IDD_TASKBAR_STATUS), MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL, NULL,
(DLGPROC)&MSWindowsPortableTaskBarReceiver::staticDlgProc, (DLGPROC)&MSWindowsPortableTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>( static_cast<LPARAM>(
reinterpret_cast<void*>(this))); static_cast<void*>(this)));
// window should appear on top of everything, including (especially) // window should appear on top of everything, including (especially)
// the task bar. // the task bar.
@ -354,16 +354,16 @@ MSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
// and put it in the extra window data then forward the call. // and put it in the extra window data then forward the call.
MSWindowsPortableTaskBarReceiver* self = NULL; MSWindowsPortableTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) { if (msg == WM_INITDIALOG) {
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>( self = static_cast<MSWindowsPortableTaskBarReceiver*>(
reinterpret_cast<void*>(lParam)); static_cast<void*>(lParam));
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
} }
else { else {
// get the extra window data and forward the call // get the extra window data and forward the call
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA); LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (data != 0) { if (data != 0) {
self = reinterpret_cast<MSWindowsPortableTaskBarReceiver*>( self = static_cast<MSWindowsPortableTaskBarReceiver*>(
reinterpret_cast<void*>(data)); static_cast<void*>(data));
} }
} }

View File

@ -252,7 +252,7 @@ MSWindowsServerTaskBarReceiver::primaryAction()
const IArchTaskBarReceiver::Icon const IArchTaskBarReceiver::Icon
MSWindowsServerTaskBarReceiver::getIcon() const MSWindowsServerTaskBarReceiver::getIcon() const
{ {
return reinterpret_cast<Icon>(m_icon[getStatus()]); return static_cast<Icon>(m_icon[getStatus()]);
} }
void void
@ -294,7 +294,7 @@ MSWindowsServerTaskBarReceiver::loadIcon(UINT id)
IMAGE_ICON, IMAGE_ICON,
0, 0, 0, 0,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
return reinterpret_cast<HICON>(icon); return static_cast<HICON>(icon);
} }
void void
@ -318,8 +318,8 @@ MSWindowsServerTaskBarReceiver::createWindow()
MAKEINTRESOURCE(IDD_TASKBAR_STATUS), MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL, NULL,
(DLGPROC)&MSWindowsServerTaskBarReceiver::staticDlgProc, (DLGPROC)&MSWindowsServerTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>( static_cast<LPARAM>(
reinterpret_cast<void*>(this))); static_cast<void*>(this)));
// window should appear on top of everything, including (especially) // window should appear on top of everything, including (especially)
// the task bar. // the task bar.
@ -368,16 +368,16 @@ MSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
// and put it in the extra window data then forward the call. // and put it in the extra window data then forward the call.
MSWindowsServerTaskBarReceiver* self = NULL; MSWindowsServerTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) { if (msg == WM_INITDIALOG) {
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>( self = static_cast<MSWindowsServerTaskBarReceiver*>(
reinterpret_cast<void*>(lParam)); static_cast<void*>(lParam));
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
} }
else { else {
// get the extra window data and forward the call // get the extra window data and forward the call
LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA); LONG data = (LONG)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (data != 0) { if (data != 0) {
self = reinterpret_cast<MSWindowsServerTaskBarReceiver*>( self = static_cast<MSWindowsServerTaskBarReceiver*>(
reinterpret_cast<void*>(data)); static_cast<void*>(data));
} }
} }

View File

@ -29,7 +29,7 @@ SynergyLocale::SynergyLocale()
void SynergyLocale::loadLanguages() void SynergyLocale::loadLanguages()
{ {
QResource resource(":/res/lang/Languages.xml"); QResource resource(":/res/lang/Languages.xml");
QByteArray bytes(reinterpret_cast<const char*>(resource.data()), resource.size()); QByteArray bytes(static_cast<const char*>(resource.data()), resource.size());
QXmlStreamReader xml(bytes); QXmlStreamReader xml(bytes);
while (!xml.atEnd()) while (!xml.atEnd())

View File

@ -697,7 +697,7 @@ void*
ArchMultithreadPosix::threadFunc(void* vrep) ArchMultithreadPosix::threadFunc(void* vrep)
{ {
// get the thread // get the thread
ArchThreadImpl* thread = reinterpret_cast<ArchThreadImpl*>(vrep); ArchThreadImpl* thread = static_cast<ArchThreadImpl*>(vrep);
// setup pthreads // setup pthreads
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);

View File

@ -646,7 +646,7 @@ ArchNetworkBSD::newAnyAddr(EAddressFamily family)
switch (family) { switch (family) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
ipAddr->sin_family = AF_INET; ipAddr->sin_family = AF_INET;
ipAddr->sin_port = 0; ipAddr->sin_port = 0;
ipAddr->sin_addr.s_addr = INADDR_ANY; ipAddr->sin_addr.s_addr = INADDR_ANY;
@ -738,7 +738,7 @@ ArchNetworkBSD::addrToName(ArchNetAddress addr)
// mutexed name lookup (ugh) // mutexed name lookup (ugh)
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
struct hostent* info = gethostbyaddr( struct hostent* info = gethostbyaddr(
reinterpret_cast<const char*>(&addr->m_addr), static_cast<const char*>(&addr->m_addr),
addr->m_len, addr->m_addr.sa_family); addr->m_len, addr->m_addr.sa_family);
if (info == NULL) { if (info == NULL) {
ARCH->unlockMutex(m_mutex); ARCH->unlockMutex(m_mutex);
@ -762,7 +762,7 @@ ArchNetworkBSD::addrToString(ArchNetAddress addr)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
std::string s = inet_ntoa(ipAddr->sin_addr); std::string s = inet_ntoa(ipAddr->sin_addr);
ARCH->unlockMutex(m_mutex); ARCH->unlockMutex(m_mutex);
@ -797,7 +797,7 @@ ArchNetworkBSD::setAddrPort(ArchNetAddress addr, int port)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
ipAddr->sin_port = htons(port); ipAddr->sin_port = htons(port);
break; break;
} }
@ -816,7 +816,7 @@ ArchNetworkBSD::getAddrPort(ArchNetAddress addr)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
return ntohs(ipAddr->sin_port); return ntohs(ipAddr->sin_port);
} }
@ -834,7 +834,7 @@ ArchNetworkBSD::isAnyAddr(ArchNetAddress addr)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
return (ipAddr->sin_addr.s_addr == INADDR_ANY && return (ipAddr->sin_addr.s_addr == INADDR_ANY &&
addr->m_len == (socklen_t)sizeof(struct sockaddr_in)); addr->m_len == (socklen_t)sizeof(struct sockaddr_in));
} }

View File

@ -234,7 +234,7 @@ ArchMiscWindows::setValue(HKEY key,
return; return;
} }
RegSetValueEx(key, name, 0, REG_SZ, RegSetValueEx(key, name, 0, REG_SZ,
reinterpret_cast<const BYTE*>(value.c_str()), static_cast<const BYTE*>(value.c_str()),
(DWORD)value.size() + 1); (DWORD)value.size() + 1);
} }
@ -247,7 +247,7 @@ ArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value)
return; return;
} }
RegSetValueEx(key, name, 0, REG_DWORD, RegSetValueEx(key, name, 0, REG_DWORD,
reinterpret_cast<CONST BYTE*>(&value), static_cast<CONST BYTE*>(&value),
sizeof(DWORD)); sizeof(DWORD));
} }
@ -262,7 +262,7 @@ ArchMiscWindows::setValueBinary(HKEY key,
return; return;
} }
RegSetValueEx(key, name, 0, REG_BINARY, RegSetValueEx(key, name, 0, REG_BINARY,
reinterpret_cast<const BYTE*>(value.data()), static_cast<const BYTE*>(value.data()),
(DWORD)value.size()); (DWORD)value.size());
} }
@ -287,7 +287,7 @@ ArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR* name, DWORD type)
// read it // read it
result = RegQueryValueEx(key, name, 0, &actualType, result = RegQueryValueEx(key, name, 0, &actualType,
reinterpret_cast<BYTE*>(buffer), &size); static_cast<BYTE*>(buffer), &size);
if (result != ERROR_SUCCESS || actualType != type) { if (result != ERROR_SUCCESS || actualType != type) {
delete[] buffer; delete[] buffer;
return std::string(); return std::string();
@ -322,7 +322,7 @@ ArchMiscWindows::readValueInt(HKEY key, const TCHAR* name)
DWORD value; DWORD value;
DWORD size = sizeof(value); DWORD size = sizeof(value);
LONG result = RegQueryValueEx(key, name, 0, &type, LONG result = RegQueryValueEx(key, name, 0, &type,
reinterpret_cast<BYTE*>(&value), &size); static_cast<BYTE*>(&value), &size);
if (result != ERROR_SUCCESS || type != REG_DWORD) { if (result != ERROR_SUCCESS || type != REG_DWORD) {
return 0; return 0;
} }
@ -374,7 +374,7 @@ ArchMiscWindows::setThreadExecutionState(DWORD busyModes)
if (s_stes == NULL) { if (s_stes == NULL) {
HINSTANCE kernel = LoadLibrary("kernel32.dll"); HINSTANCE kernel = LoadLibrary("kernel32.dll");
if (kernel != NULL) { if (kernel != NULL) {
s_stes = reinterpret_cast<STES_t>(GetProcAddress(kernel, s_stes = static_cast<STES_t>(GetProcAddress(kernel,
"SetThreadExecutionState")); "SetThreadExecutionState"));
} }
if (s_stes == NULL) { if (s_stes == NULL) {
@ -414,7 +414,7 @@ ArchMiscWindows::wakeupDisplay()
if (s_stes == NULL) { if (s_stes == NULL) {
HINSTANCE kernel = LoadLibrary("kernel32.dll"); HINSTANCE kernel = LoadLibrary("kernel32.dll");
if (kernel != NULL) { if (kernel != NULL) {
s_stes = reinterpret_cast<STES_t>(GetProcAddress(kernel, s_stes = static_cast<STES_t>(GetProcAddress(kernel,
"SetThreadExecutionState")); "SetThreadExecutionState"));
} }
if (s_stes == NULL) { if (s_stes == NULL) {

View File

@ -303,7 +303,7 @@ ArchMultithreadWindows::newThread(ThreadFunc func, void* data)
// create thread // create thread
unsigned int id = 0; unsigned int id = 0;
thread->m_thread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0, thread->m_thread = static_cast<HANDLE>(_beginthreadex(NULL, 0,
threadFunc, (void*)thread, 0, &id)); threadFunc, (void*)thread, 0, &id));
thread->m_id = static_cast<DWORD>(id); thread->m_id = static_cast<DWORD>(id);
@ -661,7 +661,7 @@ unsigned int __stdcall
ArchMultithreadWindows::threadFunc(void* vrep) ArchMultithreadWindows::threadFunc(void* vrep)
{ {
// get the thread // get the thread
ArchThreadImpl* thread = reinterpret_cast<ArchThreadImpl*>(vrep); ArchThreadImpl* thread = static_cast<ArchThreadImpl*>(vrep);
// run thread // run thread
s_instance->doThreadFunc(thread); s_instance->doThreadFunc(thread);

View File

@ -754,7 +754,7 @@ ArchNetworkWinsock::addrToName(ArchNetAddress addr)
// name lookup // name lookup
struct hostent* info = gethostbyaddr_winsock( struct hostent* info = gethostbyaddr_winsock(
reinterpret_cast<const char FAR*>(&addr->m_addr), static_cast<const char FAR*>(&addr->m_addr),
addr->m_len, addr->m_addr.sa_family); addr->m_len, addr->m_addr.sa_family);
if (info == NULL) { if (info == NULL) {
throwNameError(getsockerror_winsock()); throwNameError(getsockerror_winsock());
@ -772,7 +772,7 @@ ArchNetworkWinsock::addrToString(ArchNetAddress addr)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
return inet_ntoa_winsock(ipAddr->sin_addr); return inet_ntoa_winsock(ipAddr->sin_addr);
} }
@ -804,7 +804,7 @@ ArchNetworkWinsock::setAddrPort(ArchNetAddress addr, int port)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
ipAddr->sin_port = htons_winsock(static_cast<u_short>(port)); ipAddr->sin_port = htons_winsock(static_cast<u_short>(port));
break; break;
} }
@ -823,7 +823,7 @@ ArchNetworkWinsock::getAddrPort(ArchNetAddress addr)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
return ntohs_winsock(ipAddr->sin_port); return ntohs_winsock(ipAddr->sin_port);
} }
@ -841,7 +841,7 @@ ArchNetworkWinsock::isAnyAddr(ArchNetAddress addr)
switch (getAddrFamily(addr)) { switch (getAddrFamily(addr)) {
case kINET: { case kINET: {
struct sockaddr_in* ipAddr = struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr); static_cast<struct sockaddr_in*>(&addr->m_addr);
return (addr->m_len == sizeof(struct sockaddr_in) && return (addr->m_len == sizeof(struct sockaddr_in) &&
ipAddr->sin_addr.s_addr == INADDR_ANY); ipAddr->sin_addr.s_addr == INADDR_ANY);
} }

View File

@ -245,7 +245,7 @@ ArchTaskBarWindows::modifyIconNoLock(
receiver->lock(); receiver->lock();
// get icon data // get icon data
HICON icon = reinterpret_cast<HICON>( HICON icon = static_cast<HICON>(
const_cast<IArchTaskBarReceiver::Icon>(receiver->getIcon())); const_cast<IArchTaskBarReceiver::Icon>(receiver->getIcon()));
// get tool tip // get tool tip
@ -414,17 +414,17 @@ ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
ArchTaskBarWindows* self = NULL; ArchTaskBarWindows* self = NULL;
if (msg == WM_NCCREATE) { if (msg == WM_NCCREATE) {
CREATESTRUCT* createInfo; CREATESTRUCT* createInfo;
createInfo = reinterpret_cast<CREATESTRUCT*>(lParam); createInfo = static_cast<CREATESTRUCT*>(lParam);
self = reinterpret_cast<ArchTaskBarWindows*>( self = static_cast<ArchTaskBarWindows*>(
createInfo->lpCreateParams); createInfo->lpCreateParams);
SetWindowLong(hwnd, 0, reinterpret_cast<LONG>(self)); SetWindowLong(hwnd, 0, static_cast<LONG>(self));
} }
else { else {
// get the extra window data and forward the call // get the extra window data and forward the call
LONG data = GetWindowLong(hwnd, 0); LONG data = GetWindowLong(hwnd, 0);
if (data != 0) { if (data != 0) {
self = reinterpret_cast<ArchTaskBarWindows*>( self = static_cast<ArchTaskBarWindows*>(
reinterpret_cast<void*>(data)); static_cast<void*>(data));
} }
} }
@ -461,14 +461,14 @@ ArchTaskBarWindows::threadMainLoop()
// create window // create window
m_hwnd = CreateWindowEx(WS_EX_TOOLWINDOW, m_hwnd = CreateWindowEx(WS_EX_TOOLWINDOW,
reinterpret_cast<LPCTSTR>(windowClass), static_cast<LPCTSTR>(windowClass),
TEXT("Synergy Task Bar"), TEXT("Synergy Task Bar"),
WS_POPUP, WS_POPUP,
0, 0, 1, 1, 0, 0, 1, 1,
NULL, NULL,
NULL, NULL,
instanceWin32(), instanceWin32(),
reinterpret_cast<void*>(this)); static_cast<void*>(this));
// signal ready // signal ready
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
@ -478,7 +478,7 @@ ArchTaskBarWindows::threadMainLoop()
// handle failure // handle failure
if (m_hwnd == NULL) { if (m_hwnd == NULL) {
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), instanceWin32()); UnregisterClass(static_cast<LPCTSTR>(windowClass), instanceWin32());
return; return;
} }
@ -494,13 +494,13 @@ ArchTaskBarWindows::threadMainLoop()
// clean up // clean up
removeAllIcons(); removeAllIcons();
DestroyWindow(m_hwnd); DestroyWindow(m_hwnd);
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), instanceWin32()); UnregisterClass(static_cast<LPCTSTR>(windowClass), instanceWin32());
} }
void* void*
ArchTaskBarWindows::threadEntry(void* self) ArchTaskBarWindows::threadEntry(void* self)
{ {
reinterpret_cast<ArchTaskBarWindows*>(self)->threadMainLoop(); static_cast<ArchTaskBarWindows*>(self)->threadMainLoop();
return NULL; return NULL;
} }

View File

@ -65,7 +65,7 @@ ArchTimeWindows::~ArchTimeWindows()
{ {
s_freq = 0.0; s_freq = 0.0;
if (s_mmInstance == NULL) { if (s_mmInstance == NULL) {
FreeLibrary(reinterpret_cast<HMODULE>(s_mmInstance)); FreeLibrary(static_cast<HMODULE>(s_mmInstance));
s_tgt = NULL; s_tgt = NULL;
s_mmInstance = NULL; s_mmInstance = NULL;
} }

View File

@ -54,7 +54,7 @@ static
void void
interrupt(Arch::ESignal, void* data) interrupt(Arch::ESignal, void* data)
{ {
EventQueue* events = reinterpret_cast<EventQueue*>(data); EventQueue* events = static_cast<EventQueue*>(data);
events->addEvent(Event(Event::kQuit)); events->addEvent(Event(Event::kQuit));
} }

View File

@ -101,7 +101,7 @@ bool
Unicode::isUTF8(const String& src) Unicode::isUTF8(const String& src)
{ {
// convert and test each character // convert and test each character
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str()); const UInt8* data = static_cast<const UInt8*>(src.c_str());
for (UInt32 n = (UInt32)src.size(); n > 0; ) { for (UInt32 n = (UInt32)src.size(); n > 0; ) {
if (fromUTF8(data, n) == s_invalid) { if (fromUTF8(data, n) == s_invalid) {
return false; return false;
@ -122,7 +122,7 @@ Unicode::UTF8ToUCS2(const String& src, bool* errors)
dst.reserve(2 * n); dst.reserve(2 * n);
// convert each character // convert each character
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str()); const UInt8* data = static_cast<const UInt8*>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); UInt32 c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
@ -133,7 +133,7 @@ Unicode::UTF8ToUCS2(const String& src, bool* errors)
c = s_replacement; c = s_replacement;
} }
UInt16 ucs2 = static_cast<UInt16>(c); UInt16 ucs2 = static_cast<UInt16>(c);
dst.append(reinterpret_cast<const char*>(&ucs2), 2); dst.append(static_cast<const char*>(&ucs2), 2);
} }
return dst; return dst;
@ -151,13 +151,13 @@ Unicode::UTF8ToUCS4(const String& src, bool* errors)
dst.reserve(4 * n); dst.reserve(4 * n);
// convert each character // convert each character
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str()); const UInt8* data = static_cast<const UInt8*>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); UInt32 c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
c = s_replacement; c = s_replacement;
} }
dst.append(reinterpret_cast<const char*>(&c), 4); dst.append(static_cast<const char*>(&c), 4);
} }
return dst; return dst;
@ -175,7 +175,7 @@ Unicode::UTF8ToUTF16(const String& src, bool* errors)
dst.reserve(2 * n); dst.reserve(2 * n);
// convert each character // convert each character
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str()); const UInt8* data = static_cast<const UInt8*>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); UInt32 c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
@ -187,14 +187,14 @@ Unicode::UTF8ToUTF16(const String& src, bool* errors)
} }
if (c < 0x00010000) { if (c < 0x00010000) {
UInt16 ucs2 = static_cast<UInt16>(c); UInt16 ucs2 = static_cast<UInt16>(c);
dst.append(reinterpret_cast<const char*>(&ucs2), 2); dst.append(static_cast<const char*>(&ucs2), 2);
} }
else { else {
c -= 0x00010000; c -= 0x00010000;
UInt16 utf16h = static_cast<UInt16>((c >> 10) + 0xd800); UInt16 utf16h = static_cast<UInt16>((c >> 10) + 0xd800);
UInt16 utf16l = static_cast<UInt16>((c & 0x03ff) + 0xdc00); UInt16 utf16l = static_cast<UInt16>((c & 0x03ff) + 0xdc00);
dst.append(reinterpret_cast<const char*>(&utf16h), 2); dst.append(static_cast<const char*>(&utf16h), 2);
dst.append(reinterpret_cast<const char*>(&utf16l), 2); dst.append(static_cast<const char*>(&utf16l), 2);
} }
} }
@ -213,7 +213,7 @@ Unicode::UTF8ToUTF32(const String& src, bool* errors)
dst.reserve(4 * n); dst.reserve(4 * n);
// convert each character // convert each character
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str()); const UInt8* data = static_cast<const UInt8*>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); UInt32 c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
@ -223,7 +223,7 @@ Unicode::UTF8ToUTF32(const String& src, bool* errors)
setError(errors); setError(errors);
c = s_replacement; c = s_replacement;
} }
dst.append(reinterpret_cast<const char*>(&c), 4); dst.append(static_cast<const char*>(&c), 4);
} }
return dst; return dst;
@ -260,7 +260,7 @@ Unicode::UCS2ToUTF8(const String& src, bool* errors)
// convert // convert
UInt32 n = (UInt32)src.size() >> 1; UInt32 n = (UInt32)src.size() >> 1;
return doUCS2ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors); return doUCS2ToUTF8(static_cast<const UInt8*>(src.data()), n, errors);
} }
String String
@ -271,7 +271,7 @@ Unicode::UCS4ToUTF8(const String& src, bool* errors)
// convert // convert
UInt32 n = (UInt32)src.size() >> 2; UInt32 n = (UInt32)src.size() >> 2;
return doUCS4ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors); return doUCS4ToUTF8(static_cast<const UInt8*>(src.data()), n, errors);
} }
String String
@ -282,7 +282,7 @@ Unicode::UTF16ToUTF8(const String& src, bool* errors)
// convert // convert
UInt32 n = (UInt32)src.size() >> 1; UInt32 n = (UInt32)src.size() >> 1;
return doUTF16ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors); return doUTF16ToUTF8(static_cast<const UInt8*>(src.data()), n, errors);
} }
String String
@ -293,7 +293,7 @@ Unicode::UTF32ToUTF8(const String& src, bool* errors)
// convert // convert
UInt32 n = (UInt32)src.size() >> 2; UInt32 n = (UInt32)src.size() >> 2;
return doUTF32ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors); return doUTF32ToUTF8(static_cast<const UInt8*>(src.data()), n, errors);
} }
String String
@ -361,16 +361,16 @@ Unicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors)
// the String's nul character). // the String's nul character).
switch (ARCH->getWideCharEncoding()) { switch (ARCH->getWideCharEncoding()) {
case IArchString::kUCS2: case IArchString::kUCS2:
return doUCS2ToUTF8(reinterpret_cast<const UInt8*>(src), size, errors); return doUCS2ToUTF8(static_cast<const UInt8*>(src), size, errors);
case IArchString::kUCS4: case IArchString::kUCS4:
return doUCS4ToUTF8(reinterpret_cast<const UInt8*>(src), size, errors); return doUCS4ToUTF8(static_cast<const UInt8*>(src), size, errors);
case IArchString::kUTF16: case IArchString::kUTF16:
return doUTF16ToUTF8(reinterpret_cast<const UInt8*>(src), size, errors); return doUTF16ToUTF8(static_cast<const UInt8*>(src), size, errors);
case IArchString::kUTF32: case IArchString::kUTF32:
return doUTF32ToUTF8(reinterpret_cast<const UInt8*>(src), size, errors); return doUTF32ToUTF8(static_cast<const UInt8*>(src), size, errors);
default: default:
assert(0 && "unknown wide character encoding"); assert(0 && "unknown wide character encoding");
@ -741,25 +741,25 @@ Unicode::toUTF8(String& dst, UInt32 c, bool* errors)
// convert to UTF-8 // convert to UTF-8
if (c < 0x00000080) { if (c < 0x00000080) {
data[0] = static_cast<UInt8>(c); data[0] = static_cast<UInt8>(c);
dst.append(reinterpret_cast<char*>(data), 1); dst.append(static_cast<char*>(data), 1);
} }
else if (c < 0x00000800) { else if (c < 0x00000800) {
data[0] = static_cast<UInt8>(((c >> 6) & 0x0000001f) + 0xc0); data[0] = static_cast<UInt8>(((c >> 6) & 0x0000001f) + 0xc0);
data[1] = static_cast<UInt8>((c & 0x0000003f) + 0x80); data[1] = static_cast<UInt8>((c & 0x0000003f) + 0x80);
dst.append(reinterpret_cast<char*>(data), 2); dst.append(static_cast<char*>(data), 2);
} }
else if (c < 0x00010000) { else if (c < 0x00010000) {
data[0] = static_cast<UInt8>(((c >> 12) & 0x0000000f) + 0xe0); data[0] = static_cast<UInt8>(((c >> 12) & 0x0000000f) + 0xe0);
data[1] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80); data[1] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80);
data[2] = static_cast<UInt8>((c & 0x0000003f) + 0x80); data[2] = static_cast<UInt8>((c & 0x0000003f) + 0x80);
dst.append(reinterpret_cast<char*>(data), 3); dst.append(static_cast<char*>(data), 3);
} }
else if (c < 0x00200000) { else if (c < 0x00200000) {
data[0] = static_cast<UInt8>(((c >> 18) & 0x00000007) + 0xf0); data[0] = static_cast<UInt8>(((c >> 18) & 0x00000007) + 0xf0);
data[1] = static_cast<UInt8>(((c >> 12) & 0x0000003f) + 0x80); data[1] = static_cast<UInt8>(((c >> 12) & 0x0000003f) + 0x80);
data[2] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80); data[2] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80);
data[3] = static_cast<UInt8>((c & 0x0000003f) + 0x80); data[3] = static_cast<UInt8>((c & 0x0000003f) + 0x80);
dst.append(reinterpret_cast<char*>(data), 4); dst.append(static_cast<char*>(data), 4);
} }
else if (c < 0x04000000) { else if (c < 0x04000000) {
data[0] = static_cast<UInt8>(((c >> 24) & 0x00000003) + 0xf8); data[0] = static_cast<UInt8>(((c >> 24) & 0x00000003) + 0xf8);
@ -767,7 +767,7 @@ Unicode::toUTF8(String& dst, UInt32 c, bool* errors)
data[2] = static_cast<UInt8>(((c >> 12) & 0x0000003f) + 0x80); data[2] = static_cast<UInt8>(((c >> 12) & 0x0000003f) + 0x80);
data[3] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80); data[3] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80);
data[4] = static_cast<UInt8>((c & 0x0000003f) + 0x80); data[4] = static_cast<UInt8>((c & 0x0000003f) + 0x80);
dst.append(reinterpret_cast<char*>(data), 5); dst.append(static_cast<char*>(data), 5);
} }
else if (c < 0x80000000) { else if (c < 0x80000000) {
data[0] = static_cast<UInt8>(((c >> 30) & 0x00000001) + 0xfc); data[0] = static_cast<UInt8>(((c >> 30) & 0x00000001) + 0xfc);
@ -776,7 +776,7 @@ Unicode::toUTF8(String& dst, UInt32 c, bool* errors)
data[3] = static_cast<UInt8>(((c >> 12) & 0x0000003f) + 0x80); data[3] = static_cast<UInt8>(((c >> 12) & 0x0000003f) + 0x80);
data[4] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80); data[4] = static_cast<UInt8>(((c >> 6) & 0x0000003f) + 0x80);
data[5] = static_cast<UInt8>((c & 0x0000003f) + 0x80); data[5] = static_cast<UInt8>((c & 0x0000003f) + 0x80);
dst.append(reinterpret_cast<char*>(data), 6); dst.append(static_cast<char*>(data), 6);
} }
else { else {
assert(0 && "character out of range"); assert(0 && "character out of range");

View File

@ -430,7 +430,7 @@ Client::sendConnectionFailedEvent(const char* msg)
void void
Client::sendFileChunk(const void* data) Client::sendFileChunk(const void* data)
{ {
FileChunk* chunk = reinterpret_cast<FileChunk*>(const_cast<void*>(data)); FileChunk* chunk = static_cast<FileChunk*>(const_cast<void*>(data));
LOG((CLOG_DEBUG1 "send file chunk")); LOG((CLOG_DEBUG1 "send file chunk"));
assert(m_server != NULL); assert(m_server != NULL);
@ -605,7 +605,7 @@ void
Client::handleConnectionFailed(const Event& event, void*) Client::handleConnectionFailed(const Event& event, void*)
{ {
IDataSocket::ConnectionFailedInfo* info = IDataSocket::ConnectionFailedInfo* info =
reinterpret_cast<IDataSocket::ConnectionFailedInfo*>(event.getData()); static_cast<IDataSocket::ConnectionFailedInfo*>(event.getData());
cleanupTimer(); cleanupTimer();
cleanupConnecting(); cleanupConnecting();
@ -661,7 +661,7 @@ Client::handleClipboardGrabbed(const Event& event, void*)
} }
const IScreen::ClipboardInfo* info = const IScreen::ClipboardInfo* info =
reinterpret_cast<const IScreen::ClipboardInfo*>(event.getData()); static_cast<const IScreen::ClipboardInfo*>(event.getData());
// grab ownership // grab ownership
m_server->onGrabClipboard(info->m_id); m_server->onGrabClipboard(info->m_id);
@ -810,14 +810,14 @@ Client::sendFileToServer(const char* filename)
m_sendFileThread = new Thread( m_sendFileThread = new Thread(
new TMethodJob<Client>( new TMethodJob<Client>(
this, &Client::sendFileThread, this, &Client::sendFileThread,
reinterpret_cast<void*>(const_cast<char*>(filename)))); static_cast<void*>(const_cast<char*>(filename))));
} }
void void
Client::sendFileThread(void* filename) Client::sendFileThread(void* filename)
{ {
try { try {
char* name = reinterpret_cast<char*>(filename); char* name = static_cast<char*>(filename);
StreamChunker::sendFile(name, m_events, this); StreamChunker::sendFile(name, m_events, this);
} }
catch (std::runtime_error error) { catch (std::runtime_error error) {

View File

@ -59,7 +59,7 @@ StreamBuffer::peek(UInt32 n)
scan = m_chunks.erase(scan); scan = m_chunks.erase(scan);
} }
return reinterpret_cast<const void*>(&(head->begin()[m_headUsed])); return static_cast<const void*>(&(head->begin()[m_headUsed]));
} }
void void
@ -104,7 +104,7 @@ StreamBuffer::write(const void* vdata, UInt32 n)
m_size += n; m_size += n;
// cast data to bytes // cast data to bytes
const UInt8* data = reinterpret_cast<const UInt8*>(vdata); const UInt8* data = static_cast<const UInt8*>(vdata);
// point to last chunk if it has space, otherwise append an empty chunk // point to last chunk if it has space, otherwise append an empty chunk
ChunkList::iterator scan = m_chunks.end(); ChunkList::iterator scan = m_chunks.end();

View File

@ -83,7 +83,7 @@ StreamFilter::shutdownOutput()
void* void*
StreamFilter::getEventTarget() const StreamFilter::getEventTarget() const
{ {
return const_cast<void*>(reinterpret_cast<const void*>(this)); return const_cast<void*>(static_cast<const void*>(this));
} }
bool bool

View File

@ -147,7 +147,7 @@ Thread::threadFunc(void* vjob)
} }
// get job // get job
IJob* job = reinterpret_cast<IJob*>(vjob); IJob* job = static_cast<IJob*>(vjob);
// run job // run job
void* result = NULL; void* result = NULL;

View File

@ -683,7 +683,7 @@ SecureSocket::verifyCertFingerprint()
} }
// format fingerprint into hexdecimal format with colon separator // format fingerprint into hexdecimal format with colon separator
String fingerprint(reinterpret_cast<char*>(tempFingerprint), tempFingerprintLen); String fingerprint(static_cast<char*>(tempFingerprint), tempFingerprintLen);
formatFingerprint(fingerprint); formatFingerprint(fingerprint);
LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str())); LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str()));

View File

@ -46,7 +46,7 @@ SocketMultiplexer::SocketMultiplexer() :
// this pointer just has to be unique and not NULL. it will // this pointer just has to be unique and not NULL. it will
// never be dereferenced. it's used to identify cursor nodes // never be dereferenced. it's used to identify cursor nodes
// in the jobs list. // in the jobs list.
m_cursorMark = reinterpret_cast<ISocketMultiplexerJob*>(this); m_cursorMark = static_cast<ISocketMultiplexerJob*>(this);
// start thread // start thread
m_thread = new Thread(new TMethodJob<SocketMultiplexer>( m_thread = new Thread(new TMethodJob<SocketMultiplexer>(

View File

@ -102,7 +102,7 @@ TCPListenSocket::close()
void* void*
TCPListenSocket::getEventTarget() const TCPListenSocket::getEventTarget() const
{ {
return const_cast<void*>(reinterpret_cast<const void*>(this)); return const_cast<void*>(static_cast<const void*>(this));
} }
IDataSocket* IDataSocket*

View File

@ -125,7 +125,7 @@ TCPSocket::close()
void* void*
TCPSocket::getEventTarget() const TCPSocket::getEventTarget() const
{ {
return const_cast<void*>(reinterpret_cast<const void*>(this)); return const_cast<void*>(static_cast<const void*>(this));
} }
UInt32 UInt32

View File

@ -78,7 +78,7 @@ MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
UInt32 srcSize = (UInt32)GlobalSize(data); UInt32 srcSize = (UInt32)GlobalSize(data);
// check image type // check image type
const BITMAPINFO* bitmap = reinterpret_cast<const BITMAPINFO*>(src); const BITMAPINFO* bitmap = static_cast<const BITMAPINFO*>(src);
LOG((CLOG_INFO "bitmap: %dx%d %d", bitmap->bmiHeader.biWidth, bitmap->bmiHeader.biHeight, (int)bitmap->bmiHeader.biBitCount)); LOG((CLOG_INFO "bitmap: %dx%d %d", bitmap->bmiHeader.biWidth, bitmap->bmiHeader.biHeight, (int)bitmap->bmiHeader.biBitCount));
if (bitmap->bmiHeader.biPlanes == 1 && if (bitmap->bmiHeader.biPlanes == 1 &&
(bitmap->bmiHeader.biBitCount == 24 || (bitmap->bmiHeader.biBitCount == 24 ||

View File

@ -241,7 +241,7 @@ void
MSWindowsDesks::getCursorPos(SInt32& x, SInt32& y) const MSWindowsDesks::getCursorPos(SInt32& x, SInt32& y) const
{ {
POINT pos; POINT pos;
sendMessage(SYNERGY_MSG_CURSOR_POS, reinterpret_cast<WPARAM>(&pos), 0); sendMessage(SYNERGY_MSG_CURSOR_POS, static_cast<WPARAM>(&pos), 0);
x = pos.x; x = pos.x;
y = pos.y; y = pos.y;
} }
@ -427,7 +427,7 @@ void
MSWindowsDesks::destroyClass(ATOM windowClass) const MSWindowsDesks::destroyClass(ATOM windowClass) const
{ {
if (windowClass != 0) { if (windowClass != 0) {
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), UnregisterClass(static_cast<LPCTSTR>(windowClass),
MSWindowsScreen::getWindowInstance()); MSWindowsScreen::getWindowInstance());
} }
} }
@ -437,7 +437,7 @@ MSWindowsDesks::createWindow(ATOM windowClass, const char* name) const
{ {
HWND window = CreateWindowEx(WS_EX_TRANSPARENT | HWND window = CreateWindowEx(WS_EX_TRANSPARENT |
WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW,
reinterpret_cast<LPCTSTR>(windowClass), static_cast<LPCTSTR>(windowClass),
name, name,
WS_POPUP, WS_POPUP,
0, 0, 1, 1, 0, 0, 1, 1,
@ -656,7 +656,7 @@ MSWindowsDesks::deskThread(void* vdesk)
MSG msg; MSG msg;
// use given desktop for this thread // use given desktop for this thread
Desk* desk = reinterpret_cast<Desk*>(vdesk); Desk* desk = static_cast<Desk*>(vdesk);
desk->m_threadID = GetCurrentThreadId(); desk->m_threadID = GetCurrentThreadId();
desk->m_window = NULL; desk->m_window = NULL;
desk->m_foregroundWindow = NULL; desk->m_foregroundWindow = NULL;
@ -757,7 +757,7 @@ MSWindowsDesks::deskThread(void* vdesk)
break; break;
case SYNERGY_MSG_CURSOR_POS: { case SYNERGY_MSG_CURSOR_POS: {
POINT* pos = reinterpret_cast<POINT*>(msg.wParam); POINT* pos = static_cast<POINT*>(msg.wParam);
if (!GetCursorPos(pos)) { if (!GetCursorPos(pos)) {
pos->x = m_xCenter; pos->x = m_xCenter;
pos->y = m_yCenter; pos->y = m_yCenter;

View File

@ -864,7 +864,7 @@ void
MSWindowsScreen::destroyClass(ATOM windowClass) const MSWindowsScreen::destroyClass(ATOM windowClass) const
{ {
if (windowClass != 0) { if (windowClass != 0) {
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), s_windowInstance); UnregisterClass(static_cast<LPCTSTR>(windowClass), s_windowInstance);
} }
} }
@ -874,7 +874,7 @@ MSWindowsScreen::createWindow(ATOM windowClass, const char* name) const
HWND window = CreateWindowEx(WS_EX_TOPMOST | HWND window = CreateWindowEx(WS_EX_TOPMOST |
WS_EX_TRANSPARENT | WS_EX_TRANSPARENT |
WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW,
reinterpret_cast<LPCTSTR>(windowClass), static_cast<LPCTSTR>(windowClass),
name, name,
WS_POPUP, WS_POPUP,
0, 0, 1, 1, 0, 0, 1, 1,
@ -895,7 +895,7 @@ MSWindowsScreen::createDropWindow(ATOM windowClass, const char* name) const
WS_EX_TOPMOST | WS_EX_TOPMOST |
WS_EX_TRANSPARENT | WS_EX_TRANSPARENT |
WS_EX_ACCEPTFILES, WS_EX_ACCEPTFILES,
reinterpret_cast<LPCTSTR>(m_class), static_cast<LPCTSTR>(m_class),
name, name,
WS_POPUP, WS_POPUP,
0, 0, m_dropWindowSize, m_dropWindowSize, 0, 0, m_dropWindowSize, m_dropWindowSize,
@ -941,7 +941,7 @@ MSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
void void
MSWindowsScreen::handleSystemEvent(const Event& event, void*) MSWindowsScreen::handleSystemEvent(const Event& event, void*)
{ {
MSG* msg = reinterpret_cast<MSG*>(event.getData()); MSG* msg = static_cast<MSG*>(event.getData());
assert(msg != NULL); assert(msg != NULL);
if (ArchMiscWindows::processDialog(msg)) { if (ArchMiscWindows::processDialog(msg)) {

View File

@ -162,7 +162,7 @@ MSWindowsScreenSaver::deactivate()
if (desktop != NULL) { if (desktop != NULL) {
EnumDesktopWindows(desktop, EnumDesktopWindows(desktop,
&MSWindowsScreenSaver::killScreenSaverFunc, &MSWindowsScreenSaver::killScreenSaverFunc,
reinterpret_cast<LPARAM>(&killed)); static_cast<LPARAM>(&killed));
CloseDesktop(desktop); CloseDesktop(desktop);
} }
@ -205,7 +205,7 @@ MSWindowsScreenSaver::killScreenSaverFunc(HWND hwnd, LPARAM arg)
HINSTANCE instance = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE); HINSTANCE instance = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
if (instance != MSWindowsScreen::getWindowInstance()) { if (instance != MSWindowsScreen::getWindowInstance()) {
PostMessage(hwnd, WM_CLOSE, 0, 0); PostMessage(hwnd, WM_CLOSE, 0, 0);
*reinterpret_cast<bool*>(arg) = true; *static_cast<bool*>(arg) = true;
} }
} }
return TRUE; return TRUE;

View File

@ -104,7 +104,7 @@ OSXClipboardBMPConverter::fromIClipboard(const String& bmp) const
toLE(dst, static_cast<UInt16>(0)); toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt16>(0)); toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt32>(14 + 40)); toLE(dst, static_cast<UInt32>(14 + 40));
return String(reinterpret_cast<const char*>(header), 14) + bmp; return String(static_cast<const char*>(header), 14) + bmp;
} }
String String
@ -116,7 +116,7 @@ OSXClipboardBMPConverter::toIClipboard(const String& bmp) const
} }
// check BMP file header // check BMP file header
const UInt8* rawBMPHeader = reinterpret_cast<const UInt8*>(bmp.data()); const UInt8* rawBMPHeader = static_cast<const UInt8*>(bmp.data());
if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') { if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') {
return String(); return String();
} }

View File

@ -415,7 +415,7 @@ OSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{ {
::KeyMap km; ::KeyMap km;
GetKeys(km); GetKeys(km);
const UInt8* m = reinterpret_cast<const UInt8*>(km); const UInt8* m = static_cast<const UInt8*>(km);
for (UInt32 i = 0; i < 16; ++i) { for (UInt32 i = 0; i < 16; ++i) {
for (UInt32 j = 0; j < 8; ++j) { for (UInt32 j = 0; j < 8; ++j) {
if ((m[i] & (1u << j)) != 0) { if ((m[i] & (1u << j)) != 0) {

View File

@ -986,7 +986,7 @@ OSXScreen::sendClipboardEvent(Event::Type type, ClipboardID id) const
void void
OSXScreen::handleSystemEvent(const Event& event, void*) OSXScreen::handleSystemEvent(const Event& event, void*)
{ {
EventRef* carbonEvent = reinterpret_cast<EventRef*>(event.getData()); EventRef* carbonEvent = static_cast<EventRef*>(event.getData());
assert(carbonEvent != NULL); assert(carbonEvent != NULL);
UInt32 eventClass = GetEventClass(*carbonEvent); UInt32 eventClass = GetEventClass(*carbonEvent);

View File

@ -31,7 +31,7 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource,
m_sri(NULL), m_sri(NULL),
m_st(NULL) m_st(NULL)
{ {
m_resource = reinterpret_cast<const UCKeyboardLayout*>(resource); m_resource = static_cast<const UCKeyboardLayout*>(resource);
if (m_resource == NULL) { if (m_resource == NULL) {
return; return;
} }
@ -56,19 +56,19 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource,
} }
// get tables for keyboard type // get tables for keyboard type
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource); const UInt8* base = static_cast<const UInt8*>(m_resource);
m_m = reinterpret_cast<const UCKeyModifiersToTableNum*>(base + m_m = static_cast<const UCKeyModifiersToTableNum*>(base +
th->keyModifiersToTableNumOffset); th->keyModifiersToTableNumOffset);
m_cti = reinterpret_cast<const UCKeyToCharTableIndex*>(base + m_cti = static_cast<const UCKeyToCharTableIndex*>(base +
th->keyToCharTableIndexOffset); th->keyToCharTableIndexOffset);
m_sdi = reinterpret_cast<const UCKeySequenceDataIndex*>(base + m_sdi = static_cast<const UCKeySequenceDataIndex*>(base +
th->keySequenceDataIndexOffset); th->keySequenceDataIndexOffset);
if (th->keyStateRecordsIndexOffset != 0) { if (th->keyStateRecordsIndexOffset != 0) {
m_sri = reinterpret_cast<const UCKeyStateRecordsIndex*>(base + m_sri = static_cast<const UCKeyStateRecordsIndex*>(base +
th->keyStateRecordsIndexOffset); th->keyStateRecordsIndexOffset);
} }
if (th->keyStateTerminatorsOffset != 0) { if (th->keyStateTerminatorsOffset != 0) {
m_st = reinterpret_cast<const UCKeyStateTerminators*>(base + m_st = static_cast<const UCKeyStateTerminators*>(base +
th->keyStateTerminatorsOffset); th->keyStateTerminatorsOffset);
} }
@ -81,7 +81,7 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource,
KeyID id = getKey(table, button); KeyID id = getKey(table, button);
if (id == 0x20) { if (id == 0x20) {
UCKeyOutput c = UCKeyOutput c =
reinterpret_cast<const UCKeyOutput*>(base + static_cast<const UCKeyOutput*>(base +
m_cti->keyToCharTableOffsets[table])[button]; m_cti->keyToCharTableOffsets[table])[button];
if ((c & kUCKeyOutputTestForIndexMask) == if ((c & kUCKeyOutputTestForIndexMask) ==
kUCKeyOutputStateIndexMask) { kUCKeyOutputStateIndexMask) {
@ -134,8 +134,8 @@ OSXUchrKeyResource::getKey(UInt32 table, UInt32 button) const
assert(table < getNumTables()); assert(table < getNumTables());
assert(button < getNumButtons()); assert(button < getNumButtons());
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource); const UInt8* base = static_cast<const UInt8*>(m_resource);
const UCKeyOutput* cPtr = reinterpret_cast<const UCKeyOutput*>(base + const UCKeyOutput* cPtr = static_cast<const UCKeyOutput*>(base +
m_cti->keyToCharTableOffsets[table]); m_cti->keyToCharTableOffsets[table]);
const UCKeyOutput c = cPtr[button]; const UCKeyOutput c = cPtr[button];
@ -211,12 +211,12 @@ bool
OSXUchrKeyResource::getKeyRecord( OSXUchrKeyResource::getKeyRecord(
KeySequence& keys, UInt16 index, UInt16& state) const KeySequence& keys, UInt16 index, UInt16& state) const
{ {
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource); const UInt8* base = static_cast<const UInt8*>(m_resource);
const UCKeyStateRecord* sr = const UCKeyStateRecord* sr =
reinterpret_cast<const UCKeyStateRecord*>(base + static_cast<const UCKeyStateRecord*>(base +
m_sri->keyStateRecordOffsets[index]); m_sri->keyStateRecordOffsets[index]);
const UCKeyStateEntryTerminal* kset = const UCKeyStateEntryTerminal* kset =
reinterpret_cast<const UCKeyStateEntryTerminal*>(sr->stateEntryData); static_cast<const UCKeyStateEntryTerminal*>(sr->stateEntryData);
UInt16 nextState = 0; UInt16 nextState = 0;
bool found = false; bool found = false;

View File

@ -516,7 +516,7 @@ XWindowsClipboard::icccmFillCache()
} }
XWindowsUtil::convertAtomProperty(data); XWindowsUtil::convertAtomProperty(data);
const Atom* targets = reinterpret_cast<const Atom*>(data.data()); const Atom* targets = static_cast<const Atom*>(data.data());
const UInt32 numTargets = data.size() / sizeof(Atom); const UInt32 numTargets = data.size() / sizeof(Atom);
LOG((CLOG_DEBUG " available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str())); LOG((CLOG_DEBUG " available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str()));
@ -594,7 +594,7 @@ XWindowsClipboard::icccmGetTime() const
String data; String data;
if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) && if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) &&
actualTarget == m_atomInteger) { actualTarget == m_atomInteger) {
Time time = *reinterpret_cast<const Time*>(data.data()); Time time = *static_cast<const Time*>(data.data());
LOG((CLOG_DEBUG1 "got ICCCM time %d", time)); LOG((CLOG_DEBUG1 "got ICCCM time %d", time));
return time; return time;
} }
@ -672,7 +672,7 @@ XWindowsClipboard::motifOwnsClipboard() const
// check the owner window against the current clipboard owner // check the owner window against the current clipboard owner
const MotifClipHeader* header = const MotifClipHeader* header =
reinterpret_cast<const MotifClipHeader*>(data.data()); static_cast<const MotifClipHeader*>(data.data());
if (data.size() >= sizeof(MotifClipHeader) && if (data.size() >= sizeof(MotifClipHeader) &&
header->m_id == kMotifClipHeader) { header->m_id == kMotifClipHeader) {
if (static_cast<Window>(header->m_selectionOwner) == owner) { if (static_cast<Window>(header->m_selectionOwner) == owner) {
@ -701,7 +701,7 @@ XWindowsClipboard::motifFillCache()
// check that the header is okay // check that the header is okay
const MotifClipHeader* header = const MotifClipHeader* header =
reinterpret_cast<const MotifClipHeader*>(data.data()); static_cast<const MotifClipHeader*>(data.data());
if (data.size() < sizeof(MotifClipHeader) || if (data.size() < sizeof(MotifClipHeader) ||
header->m_id != kMotifClipHeader || header->m_id != kMotifClipHeader ||
header->m_numItems < 1) { header->m_numItems < 1) {
@ -721,7 +721,7 @@ XWindowsClipboard::motifFillCache()
// check that the item is okay // check that the item is okay
const MotifClipItem* item = const MotifClipItem* item =
reinterpret_cast<const MotifClipItem*>(data.data()); static_cast<const MotifClipItem*>(data.data());
if (data.size() < sizeof(MotifClipItem) || if (data.size() < sizeof(MotifClipItem) ||
item->m_id != kMotifClipItem || item->m_id != kMotifClipItem ||
item->m_numFormats - item->m_numDeletedFormats < 1) { item->m_numFormats - item->m_numDeletedFormats < 1) {
@ -730,8 +730,8 @@ XWindowsClipboard::motifFillCache()
// format list is after static item structure elements // format list is after static item structure elements
const SInt32 numFormats = item->m_numFormats - item->m_numDeletedFormats; const SInt32 numFormats = item->m_numFormats - item->m_numDeletedFormats;
const SInt32* formats = reinterpret_cast<const SInt32*>(item->m_size + const SInt32* formats = static_cast<const SInt32*>(item->m_size +
reinterpret_cast<const char*>(data.data())); static_cast<const char*>(data.data()));
// get the available formats // get the available formats
typedef std::map<Atom, String> MotifFormatMap; typedef std::map<Atom, String> MotifFormatMap;
@ -749,7 +749,7 @@ XWindowsClipboard::motifFillCache()
// check that the format is okay // check that the format is okay
const MotifClipFormat* motifFormat = const MotifClipFormat* motifFormat =
reinterpret_cast<const MotifClipFormat*>(data.data()); static_cast<const MotifClipFormat*>(data.data());
if (data.size() < sizeof(MotifClipFormat) || if (data.size() < sizeof(MotifClipFormat) ||
motifFormat->m_id != kMotifClipFormat || motifFormat->m_id != kMotifClipFormat ||
motifFormat->m_length < 0 || motifFormat->m_length < 0 ||
@ -783,7 +783,7 @@ XWindowsClipboard::motifFillCache()
// get format // get format
const MotifClipFormat* motifFormat = const MotifClipFormat* motifFormat =
reinterpret_cast<const MotifClipFormat*>( static_cast<const MotifClipFormat*>(
index2->second.data()); index2->second.data());
const Atom target = motifFormat->m_type; const Atom target = motifFormat->m_type;
@ -855,7 +855,7 @@ XWindowsClipboard::insertMultipleReply(Window requestor,
// data is a list of atom pairs: target, property // data is a list of atom pairs: target, property
XWindowsUtil::convertAtomProperty(data); XWindowsUtil::convertAtomProperty(data);
const Atom* targets = reinterpret_cast<const Atom*>(data.data()); const Atom* targets = static_cast<const Atom*>(data.data());
const UInt32 numTargets = data.size() / sizeof(Atom); const UInt32 numTargets = data.size() / sizeof(Atom);
// add replies for each target // add replies for each target

View File

@ -127,7 +127,7 @@ XWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const
{ {
// fill BMP info header with native-endian data // fill BMP info header with native-endian data
CBMPInfoHeader infoHeader; CBMPInfoHeader infoHeader;
const UInt8* rawBMPInfoHeader = reinterpret_cast<const UInt8*>(bmp.data()); const UInt8* rawBMPInfoHeader = static_cast<const UInt8*>(bmp.data());
infoHeader.biSize = fromLEU32(rawBMPInfoHeader + 0); infoHeader.biSize = fromLEU32(rawBMPInfoHeader + 0);
infoHeader.biWidth = fromLES32(rawBMPInfoHeader + 4); infoHeader.biWidth = fromLES32(rawBMPInfoHeader + 4);
infoHeader.biHeight = fromLES32(rawBMPInfoHeader + 8); infoHeader.biHeight = fromLES32(rawBMPInfoHeader + 8);
@ -186,6 +186,6 @@ XWindowsClipboardAnyBitmapConverter::toIClipboard(const String& image) const
toLE(dst, static_cast<UInt32>(0)); toLE(dst, static_cast<UInt32>(0));
// construct image // construct image
return String(reinterpret_cast<const char*>(infoHeader), return String(static_cast<const char*>(infoHeader),
sizeof(infoHeader)) + rawBMP; sizeof(infoHeader)) + rawBMP;
} }

View File

@ -113,7 +113,7 @@ XWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const
toLE(dst, static_cast<UInt16>(0)); toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt16>(0)); toLE(dst, static_cast<UInt16>(0));
toLE(dst, static_cast<UInt32>(14 + 40)); toLE(dst, static_cast<UInt32>(14 + 40));
return String(reinterpret_cast<const char*>(header), 14) + bmp; return String(static_cast<const char*>(header), 14) + bmp;
} }
String String
@ -125,7 +125,7 @@ XWindowsClipboardBMPConverter::toIClipboard(const String& bmp) const
} }
// check BMP file header // check BMP file header
const UInt8* rawBMPHeader = reinterpret_cast<const UInt8*>(bmp.data()); const UInt8* rawBMPHeader = static_cast<const UInt8*>(bmp.data());
if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') { if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') {
return String(); return String();
} }

View File

@ -785,7 +785,7 @@ void
XWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group, XWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group,
synergy::KeyMap::KeyItem& item, void* vself) synergy::KeyMap::KeyItem& item, void* vself)
{ {
XWindowsKeyState* self = reinterpret_cast<XWindowsKeyState*>(vself); XWindowsKeyState* self = static_cast<XWindowsKeyState*>(vself);
item.m_required = item.m_required =
self->mapModifiersFromX(XkbBuildCoreState(item.m_required, group)); self->mapModifiersFromX(XkbBuildCoreState(item.m_required, group));
item.m_sensitive = item.m_sensitive =

View File

@ -1169,7 +1169,7 @@ XWindowsScreen::getKeyState() const
Bool Bool
XWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg) XWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
{ {
KeyEventFilter* filter = reinterpret_cast<KeyEventFilter*>(arg); KeyEventFilter* filter = static_cast<KeyEventFilter*>(arg);
return (xevent->type == filter->m_event && return (xevent->type == filter->m_event &&
xevent->xkey.window == filter->m_window && xevent->xkey.window == filter->m_window &&
xevent->xkey.time == filter->m_time && xevent->xkey.time == filter->m_time &&
@ -1179,7 +1179,7 @@ XWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
void void
XWindowsScreen::handleSystemEvent(const Event& event, void*) XWindowsScreen::handleSystemEvent(const Event& event, void*)
{ {
XEvent* xevent = reinterpret_cast<XEvent*>(event.getData()); XEvent* xevent = static_cast<XEvent*>(event.getData());
assert(xevent != NULL); assert(xevent != NULL);
// update key state // update key state
@ -1408,7 +1408,7 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*)
default: default:
#if HAVE_XKB_EXTENSION #if HAVE_XKB_EXTENSION
if (m_xkb && xevent->type == m_xkbEventBase) { if (m_xkb && xevent->type == m_xkbEventBase) {
XkbEvent* xkbEvent = reinterpret_cast<XkbEvent*>(xevent); XkbEvent* xkbEvent = static_cast<XkbEvent*>(xevent);
switch (xkbEvent->any.xkb_type) { switch (xkbEvent->any.xkb_type) {
case XkbMapNotify: case XkbMapNotify:
refreshKeyboard(xevent); refreshKeyboard(xevent);
@ -1426,7 +1426,7 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*)
if (m_xrandr) { if (m_xrandr) {
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify
|| xevent->type == m_xrandrEventBase + RRNotify || xevent->type == m_xrandrEventBase + RRNotify
&& reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) { && static_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) {
LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received")); LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received"));
// we're required to call back into XLib so XLib can update its internal state // we're required to call back into XLib so XLib can update its internal state

View File

@ -1386,7 +1386,7 @@ XWindowsUtil::setWindowProperty(Display* display, Window window,
Atom type, SInt32 format) Atom type, SInt32 format)
{ {
const UInt32 length = 4 * XMaxRequestSize(display); const UInt32 length = 4 * XMaxRequestSize(display);
const unsigned char* data = reinterpret_cast<const unsigned char*>(vdata); const unsigned char* data = static_cast<const unsigned char*>(vdata);
UInt32 datumSize = static_cast<UInt32>(format / 8); UInt32 datumSize = static_cast<UInt32>(format / 8);
// format 32 on 64bit systems is 8 bytes not 4. // format 32 on 64bit systems is 8 bytes not 4.
if (format == 32) { if (format == 32) {
@ -1665,35 +1665,35 @@ XWindowsUtil::convertAtomProperty(String& data)
// 64-bit numbers we have to ensure the last number is a full 64 bits. // 64-bit numbers we have to ensure the last number is a full 64 bits.
if (sizeof(Atom) != 4 && ((data.size() / 4) & 1) != 0) { if (sizeof(Atom) != 4 && ((data.size() / 4) & 1) != 0) {
UInt32 zero = 0; UInt32 zero = 0;
data.append(reinterpret_cast<char*>(&zero), sizeof(zero)); data.append(static_cast<char*>(&zero), sizeof(zero));
} }
} }
void void
XWindowsUtil::appendAtomData(String& data, Atom atom) XWindowsUtil::appendAtomData(String& data, Atom atom)
{ {
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom)); data.append(static_cast<char*>(&atom), sizeof(Atom));
} }
void void
XWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom) XWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom)
{ {
data.replace(index * sizeof(Atom), sizeof(Atom), data.replace(index * sizeof(Atom), sizeof(Atom),
reinterpret_cast<const char*>(&atom), static_cast<const char*>(&atom),
sizeof(Atom)); sizeof(Atom));
} }
void void
XWindowsUtil::appendTimeData(String& data, Time time) XWindowsUtil::appendTimeData(String& data, Time time)
{ {
data.append(reinterpret_cast<char*>(&time), sizeof(Time)); data.append(static_cast<char*>(&time), sizeof(Time));
} }
Bool Bool
XWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg) XWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
{ {
PropertyNotifyPredicateInfo* filter = PropertyNotifyPredicateInfo* filter =
reinterpret_cast<PropertyNotifyPredicateInfo*>(arg); static_cast<PropertyNotifyPredicateInfo*>(arg);
return (xevent->type == PropertyNotify && return (xevent->type == PropertyNotify &&
xevent->xproperty.window == filter->m_window && xevent->xproperty.window == filter->m_window &&
xevent->xproperty.atom == filter->m_property && xevent->xproperty.atom == filter->m_property &&
@ -1784,5 +1784,5 @@ void
XWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag) XWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
{ {
LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code)); LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
*reinterpret_cast<bool*>(flag) = true; *static_cast<bool*>(flag) = true;
} }

View File

@ -178,7 +178,7 @@ void
ClientListener::handleUnknownClient(const Event&, void* vclient) ClientListener::handleUnknownClient(const Event&, void* vclient)
{ {
ClientProxyUnknown* unknownClient = ClientProxyUnknown* unknownClient =
reinterpret_cast<ClientProxyUnknown*>(vclient); static_cast<ClientProxyUnknown*>(vclient);
// we should have the client in our new client list // we should have the client in our new client list
assert(m_newClients.count(unknownClient) == 1); assert(m_newClients.count(unknownClient) == 1);
@ -222,7 +222,7 @@ ClientListener::handleUnknownClient(const Event&, void* vclient)
void void
ClientListener::handleClientDisconnected(const Event&, void* vclient) ClientListener::handleClientDisconnected(const Event&, void* vclient)
{ {
ClientProxy* client = reinterpret_cast<ClientProxy*>(vclient); ClientProxy* client = static_cast<ClientProxy*>(vclient);
// find client in waiting clients queue // find client in waiting clients queue
for (WaitingClients::iterator i = m_waitingClients.begin(), for (WaitingClients::iterator i = m_waitingClients.begin(),

View File

@ -121,7 +121,7 @@ InputFilter::KeystrokeCondition::match(const Event& event)
// check if it's our hotkey // check if it's our hotkey
IPrimaryScreen::HotKeyInfo* kinfo = IPrimaryScreen::HotKeyInfo* kinfo =
reinterpret_cast<IPlatformScreen::HotKeyInfo*>(event.getData()); static_cast<IPlatformScreen::HotKeyInfo*>(event.getData());
if (kinfo->m_id != m_id) { if (kinfo->m_id != m_id) {
return kNoMatch; return kNoMatch;
} }
@ -217,7 +217,7 @@ InputFilter::MouseButtonCondition::match(const Event& event)
// check if it's the right button and modifiers. ignore modifiers // check if it's the right button and modifiers. ignore modifiers
// that cannot be combined with a mouse button. // that cannot be combined with a mouse button.
IPlatformScreen::ButtonInfo* minfo = IPlatformScreen::ButtonInfo* minfo =
reinterpret_cast<IPlatformScreen::ButtonInfo*>(event.getData()); static_cast<IPlatformScreen::ButtonInfo*>(event.getData());
if (minfo->m_button != m_button || if (minfo->m_button != m_button ||
(minfo->m_mask & ~s_ignoreMask) != m_mask) { (minfo->m_mask & ~s_ignoreMask) != m_mask) {
return kNoMatch; return kNoMatch;
@ -256,7 +256,7 @@ InputFilter::ScreenConnectedCondition::match(const Event& event)
{ {
if (event.getType() == m_events->forServer().connected()) { if (event.getType() == m_events->forServer().connected()) {
Server::ScreenConnectedInfo* info = Server::ScreenConnectedInfo* info =
reinterpret_cast<Server::ScreenConnectedInfo*>(event.getData()); static_cast<Server::ScreenConnectedInfo*>(event.getData());
if (m_screen == info->m_screen || m_screen.empty()) { if (m_screen == info->m_screen || m_screen.empty()) {
return kActivate; return kActivate;
} }
@ -357,7 +357,7 @@ InputFilter::SwitchToScreenAction::perform(const Event& event)
String screen = m_screen; String screen = m_screen;
if (screen.empty() && event.getType() == m_events->forServer().connected()) { if (screen.empty() && event.getType() == m_events->forServer().connected()) {
Server::ScreenConnectedInfo* info = Server::ScreenConnectedInfo* info =
reinterpret_cast<Server::ScreenConnectedInfo*>(event.getData()); static_cast<Server::ScreenConnectedInfo*>(event.getData());
screen = info->m_screen; screen = info->m_screen;
} }

View File

@ -1187,7 +1187,7 @@ void
Server::handleShapeChanged(const Event&, void* vclient) Server::handleShapeChanged(const Event&, void* vclient)
{ {
// ignore events from unknown clients // ignore events from unknown clients
BaseClientProxy* client = reinterpret_cast<BaseClientProxy*>(vclient); BaseClientProxy* client = static_cast<BaseClientProxy*>(vclient);
if (m_clientSet.count(client) == 0) { if (m_clientSet.count(client) == 0) {
return; return;
} }
@ -1224,12 +1224,12 @@ Server::handleClipboardGrabbed(const Event& event, void* vclient)
} }
// ignore events from unknown clients // ignore events from unknown clients
BaseClientProxy* grabber = reinterpret_cast<BaseClientProxy*>(vclient); BaseClientProxy* grabber = static_cast<BaseClientProxy*>(vclient);
if (m_clientSet.count(grabber) == 0) { if (m_clientSet.count(grabber) == 0) {
return; return;
} }
const IScreen::ClipboardInfo* info = const IScreen::ClipboardInfo* info =
reinterpret_cast<const IScreen::ClipboardInfo*>(event.getData()); static_cast<const IScreen::ClipboardInfo*>(event.getData());
// ignore grab if sequence number is old. always allow primary // ignore grab if sequence number is old. always allow primary
// screen to grab. // screen to grab.
@ -1270,12 +1270,12 @@ void
Server::handleClipboardChanged(const Event& event, void* vclient) Server::handleClipboardChanged(const Event& event, void* vclient)
{ {
// ignore events from unknown clients // ignore events from unknown clients
BaseClientProxy* sender = reinterpret_cast<BaseClientProxy*>(vclient); BaseClientProxy* sender = static_cast<BaseClientProxy*>(vclient);
if (m_clientSet.count(sender) == 0) { if (m_clientSet.count(sender) == 0) {
return; return;
} }
const IScreen::ClipboardInfo* info = const IScreen::ClipboardInfo* info =
reinterpret_cast<const IScreen::ClipboardInfo*>(event.getData()); static_cast<const IScreen::ClipboardInfo*>(event.getData());
onClipboardChanged(sender, info->m_id, info->m_sequenceNumber); onClipboardChanged(sender, info->m_id, info->m_sequenceNumber);
} }
@ -1283,7 +1283,7 @@ void
Server::handleKeyDownEvent(const Event& event, void*) Server::handleKeyDownEvent(const Event& event, void*)
{ {
IPlatformScreen::KeyInfo* info = IPlatformScreen::KeyInfo* info =
reinterpret_cast<IPlatformScreen::KeyInfo*>(event.getData()); static_cast<IPlatformScreen::KeyInfo*>(event.getData());
onKeyDown(info->m_key, info->m_mask, info->m_button, info->m_screens); onKeyDown(info->m_key, info->m_mask, info->m_button, info->m_screens);
} }
@ -1291,7 +1291,7 @@ void
Server::handleKeyUpEvent(const Event& event, void*) Server::handleKeyUpEvent(const Event& event, void*)
{ {
IPlatformScreen::KeyInfo* info = IPlatformScreen::KeyInfo* info =
reinterpret_cast<IPlatformScreen::KeyInfo*>(event.getData()); static_cast<IPlatformScreen::KeyInfo*>(event.getData());
onKeyUp(info->m_key, info->m_mask, info->m_button, info->m_screens); onKeyUp(info->m_key, info->m_mask, info->m_button, info->m_screens);
} }
@ -1299,7 +1299,7 @@ void
Server::handleKeyRepeatEvent(const Event& event, void*) Server::handleKeyRepeatEvent(const Event& event, void*)
{ {
IPlatformScreen::KeyInfo* info = IPlatformScreen::KeyInfo* info =
reinterpret_cast<IPlatformScreen::KeyInfo*>(event.getData()); static_cast<IPlatformScreen::KeyInfo*>(event.getData());
onKeyRepeat(info->m_key, info->m_mask, info->m_count, info->m_button); onKeyRepeat(info->m_key, info->m_mask, info->m_count, info->m_button);
} }
@ -1307,7 +1307,7 @@ void
Server::handleButtonDownEvent(const Event& event, void*) Server::handleButtonDownEvent(const Event& event, void*)
{ {
IPlatformScreen::ButtonInfo* info = IPlatformScreen::ButtonInfo* info =
reinterpret_cast<IPlatformScreen::ButtonInfo*>(event.getData()); static_cast<IPlatformScreen::ButtonInfo*>(event.getData());
onMouseDown(info->m_button); onMouseDown(info->m_button);
} }
@ -1315,7 +1315,7 @@ void
Server::handleButtonUpEvent(const Event& event, void*) Server::handleButtonUpEvent(const Event& event, void*)
{ {
IPlatformScreen::ButtonInfo* info = IPlatformScreen::ButtonInfo* info =
reinterpret_cast<IPlatformScreen::ButtonInfo*>(event.getData()); static_cast<IPlatformScreen::ButtonInfo*>(event.getData());
onMouseUp(info->m_button); onMouseUp(info->m_button);
} }
@ -1323,7 +1323,7 @@ void
Server::handleMotionPrimaryEvent(const Event& event, void*) Server::handleMotionPrimaryEvent(const Event& event, void*)
{ {
IPlatformScreen::MotionInfo* info = IPlatformScreen::MotionInfo* info =
reinterpret_cast<IPlatformScreen::MotionInfo*>(event.getData()); static_cast<IPlatformScreen::MotionInfo*>(event.getData());
onMouseMovePrimary(info->m_x, info->m_y); onMouseMovePrimary(info->m_x, info->m_y);
} }
@ -1331,7 +1331,7 @@ void
Server::handleMotionSecondaryEvent(const Event& event, void*) Server::handleMotionSecondaryEvent(const Event& event, void*)
{ {
IPlatformScreen::MotionInfo* info = IPlatformScreen::MotionInfo* info =
reinterpret_cast<IPlatformScreen::MotionInfo*>(event.getData()); static_cast<IPlatformScreen::MotionInfo*>(event.getData());
onMouseMoveSecondary(info->m_x, info->m_y); onMouseMoveSecondary(info->m_x, info->m_y);
} }
@ -1339,7 +1339,7 @@ void
Server::handleWheelEvent(const Event& event, void*) Server::handleWheelEvent(const Event& event, void*)
{ {
IPlatformScreen::WheelInfo* info = IPlatformScreen::WheelInfo* info =
reinterpret_cast<IPlatformScreen::WheelInfo*>(event.getData()); static_cast<IPlatformScreen::WheelInfo*>(event.getData());
onMouseWheel(info->m_xDelta, info->m_yDelta); onMouseWheel(info->m_xDelta, info->m_yDelta);
} }
@ -1374,7 +1374,7 @@ Server::handleClientDisconnected(const Event&, void* vclient)
{ {
// client has disconnected. it might be an old client or an // client has disconnected. it might be an old client or an
// active client. we don't care so just handle it both ways. // active client. we don't care so just handle it both ways.
BaseClientProxy* client = reinterpret_cast<BaseClientProxy*>(vclient); BaseClientProxy* client = static_cast<BaseClientProxy*>(vclient);
removeActiveClient(client); removeActiveClient(client);
removeOldClient(client); removeOldClient(client);
@ -1388,7 +1388,7 @@ void
Server::handleClientCloseTimeout(const Event&, void* vclient) Server::handleClientCloseTimeout(const Event&, void* vclient)
{ {
// client took too long to disconnect. just dump it. // client took too long to disconnect. just dump it.
BaseClientProxy* client = reinterpret_cast<BaseClientProxy*>(vclient); BaseClientProxy* client = static_cast<BaseClientProxy*>(vclient);
LOG((CLOG_NOTE "forced disconnection of client \"%s\"", getName(client).c_str())); LOG((CLOG_NOTE "forced disconnection of client \"%s\"", getName(client).c_str()));
removeOldClient(client); removeOldClient(client);
PacketStreamFilter* streamFileter = dynamic_cast<PacketStreamFilter*>(client->getStream()); PacketStreamFilter* streamFileter = dynamic_cast<PacketStreamFilter*>(client->getStream());
@ -1401,7 +1401,7 @@ void
Server::handleSwitchToScreenEvent(const Event& event, void*) Server::handleSwitchToScreenEvent(const Event& event, void*)
{ {
SwitchToScreenInfo* info = SwitchToScreenInfo* info =
reinterpret_cast<SwitchToScreenInfo*>(event.getData()); static_cast<SwitchToScreenInfo*>(event.getData());
ClientList::const_iterator index = m_clients.find(info->m_screen); ClientList::const_iterator index = m_clients.find(info->m_screen);
if (index == m_clients.end()) { if (index == m_clients.end()) {
@ -1416,7 +1416,7 @@ void
Server::handleSwitchInDirectionEvent(const Event& event, void*) Server::handleSwitchInDirectionEvent(const Event& event, void*)
{ {
SwitchInDirectionInfo* info = SwitchInDirectionInfo* info =
reinterpret_cast<SwitchInDirectionInfo*>(event.getData()); static_cast<SwitchInDirectionInfo*>(event.getData());
// jump to screen in chosen direction from center of this screen // jump to screen in chosen direction from center of this screen
SInt32 x = m_x, y = m_y; SInt32 x = m_x, y = m_y;
@ -1817,7 +1817,7 @@ Server::onMouseMovePrimary(SInt32 x, SInt32 y)
void void
Server::sendDragInfoThread(void* arg) Server::sendDragInfoThread(void* arg)
{ {
BaseClientProxy* newScreen = reinterpret_cast<BaseClientProxy*>(arg); BaseClientProxy* newScreen = static_cast<BaseClientProxy*>(arg);
m_dragFileList.clear(); m_dragFileList.clear();
String& dragFileList = m_screen->getDraggingFilename(); String& dragFileList = m_screen->getDraggingFilename();
@ -2053,7 +2053,7 @@ Server::onMouseWheel(SInt32 xDelta, SInt32 yDelta)
void void
Server::onFileChunkSending(const void* data) Server::onFileChunkSending(const void* data)
{ {
FileChunk* chunk = reinterpret_cast<FileChunk*>(const_cast<void*>(data)); FileChunk* chunk = static_cast<FileChunk*>(const_cast<void*>(data));
LOG((CLOG_DEBUG1 "sending file chunk")); LOG((CLOG_DEBUG1 "sending file chunk"));
assert(m_active != NULL); assert(m_active != NULL);
@ -2372,14 +2372,14 @@ Server::sendFileToClient(const char* filename)
m_sendFileThread = new Thread( m_sendFileThread = new Thread(
new TMethodJob<Server>( new TMethodJob<Server>(
this, &Server::sendFileThread, this, &Server::sendFileThread,
reinterpret_cast<void*>(const_cast<char*>(filename)))); static_cast<void*>(const_cast<char*>(filename))));
} }
void void
Server::sendFileThread(void* data) Server::sendFileThread(void* data)
{ {
try { try {
char* filename = reinterpret_cast<char*>(data); char* filename = static_cast<char*>(data);
LOG((CLOG_DEBUG "sending file to client, filename=%s", filename)); LOG((CLOG_DEBUG "sending file to client, filename=%s", filename));
StreamChunker::sendFile(filename, m_events, this); StreamChunker::sendFile(filename, m_events, this);
} }

View File

@ -268,7 +268,7 @@ void
ClientApp::handleClientRestart(const Event&, void* vtimer) ClientApp::handleClientRestart(const Event&, void* vtimer)
{ {
// discard old timer // discard old timer
EventQueueTimer* timer = reinterpret_cast<EventQueueTimer*>(vtimer); EventQueueTimer* timer = static_cast<EventQueueTimer*>(vtimer);
m_events->deleteTimer(timer); m_events->deleteTimer(timer);
m_events->removeHandler(Event::kTimer, timer); m_events->removeHandler(Event::kTimer, timer);
@ -301,7 +301,7 @@ void
ClientApp::handleClientFailed(const Event& e, void*) ClientApp::handleClientFailed(const Event& e, void*)
{ {
Client::FailInfo* info = Client::FailInfo* info =
reinterpret_cast<Client::FailInfo*>(e.getData()); static_cast<Client::FailInfo*>(e.getData());
updateStatus(String("Failed to connect to server: ") + info->m_what); updateStatus(String("Failed to connect to server: ") + info->m_what);
if (!args().m_restartable || !info->m_retry) { if (!args().m_restartable || !info->m_retry) {

View File

@ -41,7 +41,7 @@ ClipboardChunk::start(
char* chunk = start->m_chunk; char* chunk = start->m_chunk;
chunk[0] = id; chunk[0] = id;
UInt32* seq = reinterpret_cast<UInt32*>(&chunk[1]); UInt32* seq = static_cast<UInt32*>(&chunk[1]);
*seq = sequence; *seq = sequence;
chunk[5] = kDataStart; chunk[5] = kDataStart;
memcpy(&chunk[6], size.c_str(), sizeLength); memcpy(&chunk[6], size.c_str(), sizeLength);
@ -61,7 +61,7 @@ ClipboardChunk::data(
char* chunkData = chunk->m_chunk; char* chunkData = chunk->m_chunk;
chunkData[0] = id; chunkData[0] = id;
UInt32* seq = reinterpret_cast<UInt32*>(&chunkData[1]); UInt32* seq = static_cast<UInt32*>(&chunkData[1]);
*seq = sequence; *seq = sequence;
chunkData[5] = kDataChunk; chunkData[5] = kDataChunk;
memcpy(&chunkData[6], data.c_str(), dataSize); memcpy(&chunkData[6], data.c_str(), dataSize);
@ -77,7 +77,7 @@ ClipboardChunk::end(ClipboardID id, UInt32 sequence)
char* chunk = end->m_chunk; char* chunk = end->m_chunk;
chunk[0] = id; chunk[0] = id;
UInt32* seq = reinterpret_cast<UInt32*>(&chunk[1]); UInt32* seq = static_cast<UInt32*>(&chunk[1]);
*seq = sequence; *seq = sequence;
chunk[5] = kDataEnd; chunk[5] = kDataEnd;
chunk[CLIPBOARD_CHUNK_META_SIZE - 1] = '\0'; chunk[CLIPBOARD_CHUNK_META_SIZE - 1] = '\0';
@ -127,13 +127,13 @@ ClipboardChunk::assemble(synergy::IStream* stream,
void void
ClipboardChunk::send(synergy::IStream* stream, void* data) ClipboardChunk::send(synergy::IStream* stream, void* data)
{ {
ClipboardChunk* clipboardData = reinterpret_cast<ClipboardChunk*>(data); ClipboardChunk* clipboardData = static_cast<ClipboardChunk*>(data);
LOG((CLOG_DEBUG1 "sending clipboard chunk")); LOG((CLOG_DEBUG1 "sending clipboard chunk"));
char* chunk = clipboardData->m_chunk; char* chunk = clipboardData->m_chunk;
ClipboardID id = chunk[0]; ClipboardID id = chunk[0];
UInt32* seq = reinterpret_cast<UInt32*>(&chunk[1]); UInt32* seq = static_cast<UInt32*>(&chunk[1]);
UInt32 sequence = *seq; UInt32 sequence = *seq;
UInt8 mark = chunk[5]; UInt8 mark = chunk[5];
String dataChunk(&chunk[6], clipboardData->m_dataSize); String dataChunk(&chunk[6], clipboardData->m_dataSize);

View File

@ -151,7 +151,7 @@ IClipboard::copy(IClipboard* dst, const IClipboard* src, Time time)
UInt32 UInt32
IClipboard::readUInt32(const char* buf) IClipboard::readUInt32(const char* buf)
{ {
const unsigned char* ubuf = reinterpret_cast<const unsigned char*>(buf); const unsigned char* ubuf = static_cast<const unsigned char*>(buf);
return (static_cast<UInt32>(ubuf[0]) << 24) | return (static_cast<UInt32>(ubuf[0]) << 24) |
(static_cast<UInt32>(ubuf[1]) << 16) | (static_cast<UInt32>(ubuf[1]) << 16) |
(static_cast<UInt32>(ubuf[2]) << 8) | (static_cast<UInt32>(ubuf[2]) << 8) |

View File

@ -524,7 +524,7 @@ KeyState::addActiveModifierCB(KeyID, SInt32 group,
synergy::KeyMap::KeyItem& keyItem, void* vcontext) synergy::KeyMap::KeyItem& keyItem, void* vcontext)
{ {
AddActiveModifierContext* context = AddActiveModifierContext* context =
reinterpret_cast<AddActiveModifierContext*>(vcontext); static_cast<AddActiveModifierContext*>(vcontext);
if (group == context->m_activeGroup && if (group == context->m_activeGroup &&
(keyItem.m_generates & context->m_mask) != 0) { (keyItem.m_generates & context->m_mask) != 0) {
context->m_activeModifiers.insert(std::make_pair( context->m_activeModifiers.insert(std::make_pair(

View File

@ -120,27 +120,27 @@ ProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args)
switch (len) { switch (len) {
case 1: case 1:
// 1 byte integer // 1 byte integer
*reinterpret_cast<UInt8*>(v) = buffer[0]; *static_cast<UInt8*>(v) = buffer[0];
LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt8*>(v), *reinterpret_cast<UInt8*>(v))); LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *static_cast<UInt8*>(v), *static_cast<UInt8*>(v)));
break; break;
case 2: case 2:
// 2 byte integer // 2 byte integer
*reinterpret_cast<UInt16*>(v) = *static_cast<UInt16*>(v) =
static_cast<UInt16>( static_cast<UInt16>(
(static_cast<UInt16>(buffer[0]) << 8) | (static_cast<UInt16>(buffer[0]) << 8) |
static_cast<UInt16>(buffer[1])); static_cast<UInt16>(buffer[1]));
LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt16*>(v), *reinterpret_cast<UInt16*>(v))); LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *static_cast<UInt16*>(v), *static_cast<UInt16*>(v)));
break; break;
case 4: case 4:
// 4 byte integer // 4 byte integer
*reinterpret_cast<UInt32*>(v) = *static_cast<UInt32*>(v) =
(static_cast<UInt32>(buffer[0]) << 24) | (static_cast<UInt32>(buffer[0]) << 24) |
(static_cast<UInt32>(buffer[1]) << 16) | (static_cast<UInt32>(buffer[1]) << 16) |
(static_cast<UInt32>(buffer[2]) << 8) | (static_cast<UInt32>(buffer[2]) << 8) |
static_cast<UInt32>(buffer[3]); static_cast<UInt32>(buffer[3]);
LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt32*>(v), *reinterpret_cast<UInt32*>(v))); LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *static_cast<UInt32*>(v), *static_cast<UInt32*>(v)));
break; break;
} }
break; break;
@ -165,9 +165,9 @@ ProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args)
// 1 byte integer // 1 byte integer
for (UInt32 i = 0; i < n; ++i) { for (UInt32 i = 0; i < n; ++i) {
read(stream, buffer, 1); read(stream, buffer, 1);
reinterpret_cast<std::vector<UInt8>*>(v)->push_back( static_cast<std::vector<UInt8>*>(v)->push_back(
buffer[0]); buffer[0]);
LOG((CLOG_DEBUG2 "readf: read %d byte integer[%d]: %d (0x%x)", len, i, reinterpret_cast<std::vector<UInt8>*>(v)->back(), reinterpret_cast<std::vector<UInt8>*>(v)->back())); LOG((CLOG_DEBUG2 "readf: read %d byte integer[%d]: %d (0x%x)", len, i, static_cast<std::vector<UInt8>*>(v)->back(), static_cast<std::vector<UInt8>*>(v)->back()));
} }
break; break;
@ -175,11 +175,11 @@ ProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args)
// 2 byte integer // 2 byte integer
for (UInt32 i = 0; i < n; ++i) { for (UInt32 i = 0; i < n; ++i) {
read(stream, buffer, 2); read(stream, buffer, 2);
reinterpret_cast<std::vector<UInt16>*>(v)->push_back( static_cast<std::vector<UInt16>*>(v)->push_back(
static_cast<UInt16>( static_cast<UInt16>(
(static_cast<UInt16>(buffer[0]) << 8) | (static_cast<UInt16>(buffer[0]) << 8) |
static_cast<UInt16>(buffer[1]))); static_cast<UInt16>(buffer[1])));
LOG((CLOG_DEBUG2 "readf: read %d byte integer[%d]: %d (0x%x)", len, i, reinterpret_cast<std::vector<UInt16>*>(v)->back(), reinterpret_cast<std::vector<UInt16>*>(v)->back())); LOG((CLOG_DEBUG2 "readf: read %d byte integer[%d]: %d (0x%x)", len, i, static_cast<std::vector<UInt16>*>(v)->back(), static_cast<std::vector<UInt16>*>(v)->back()));
} }
break; break;
@ -187,12 +187,12 @@ ProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args)
// 4 byte integer // 4 byte integer
for (UInt32 i = 0; i < n; ++i) { for (UInt32 i = 0; i < n; ++i) {
read(stream, buffer, 4); read(stream, buffer, 4);
reinterpret_cast<std::vector<UInt32>*>(v)->push_back( static_cast<std::vector<UInt32>*>(v)->push_back(
(static_cast<UInt32>(buffer[0]) << 24) | (static_cast<UInt32>(buffer[0]) << 24) |
(static_cast<UInt32>(buffer[1]) << 16) | (static_cast<UInt32>(buffer[1]) << 16) |
(static_cast<UInt32>(buffer[2]) << 8) | (static_cast<UInt32>(buffer[2]) << 8) |
static_cast<UInt32>(buffer[3])); static_cast<UInt32>(buffer[3]));
LOG((CLOG_DEBUG2 "readf: read %d byte integer[%d]: %d (0x%x)", len, i, reinterpret_cast<std::vector<UInt32>*>(v)->back(), reinterpret_cast<std::vector<UInt32>*>(v)->back())); LOG((CLOG_DEBUG2 "readf: read %d byte integer[%d]: %d (0x%x)", len, i, static_cast<std::vector<UInt32>*>(v)->back(), static_cast<std::vector<UInt32>*>(v)->back()));
} }
break; break;
} }
@ -340,7 +340,7 @@ ProtocolUtil::getLength(const char* fmt, va_list args)
void void
ProtocolUtil::writef(void* buffer, const char* fmt, va_list args) ProtocolUtil::writef(void* buffer, const char* fmt, va_list args)
{ {
UInt8* dst = reinterpret_cast<UInt8*>(buffer); UInt8* dst = static_cast<UInt8*>(buffer);
while (*fmt) { while (*fmt) {
if (*fmt == '%') { if (*fmt == '%') {
@ -515,7 +515,7 @@ ProtocolUtil::read(synergy::IStream* stream, void* vbuffer, UInt32 count)
assert(stream != NULL); assert(stream != NULL);
assert(vbuffer != NULL); assert(vbuffer != NULL);
UInt8* buffer = reinterpret_cast<UInt8*>(vbuffer); UInt8* buffer = static_cast<UInt8*>(vbuffer);
while (count > 0) { while (count > 0) {
// read more // read more
UInt32 n = stream->read(buffer, count); UInt32 n = stream->read(buffer, count);

View File

@ -259,7 +259,7 @@ ServerApp::forceReconnect(const Event&, void*)
void void
ServerApp::handleClientConnected(const Event&, void* vlistener) ServerApp::handleClientConnected(const Event&, void* vlistener)
{ {
ClientListener* listener = reinterpret_cast<ClientListener*>(vlistener); ClientListener* listener = static_cast<ClientListener*>(vlistener);
ClientProxy* client = listener->getNextClient(); ClientProxy* client = listener->getNextClient();
if (client != NULL) { if (client != NULL) {
m_server->adoptClient(client); m_server->adoptClient(client);

View File

@ -49,7 +49,7 @@ StreamChunker::sendFile(
{ {
s_isChunkingFile = true; s_isChunkingFile = true;
std::fstream file(reinterpret_cast<char*>(filename), std::ios::in | std::ios::binary); std::fstream file(static_cast<char*>(filename), std::ios::in | std::ios::binary);
if (!file.is_open()) { if (!file.is_open()) {
throw runtime_error("failed to open file"); throw runtime_error("failed to open file");

View File

@ -328,7 +328,7 @@ TEST_F(NetworkTests, sendToServer_mockFile)
void void
NetworkTests::sendToClient_mockData_handleClientConnected(const Event&, void* vlistener) NetworkTests::sendToClient_mockData_handleClientConnected(const Event&, void* vlistener)
{ {
ClientListener* listener = reinterpret_cast<ClientListener*>(vlistener); ClientListener* listener = static_cast<ClientListener*>(vlistener);
Server* server = listener->getServer(); Server* server = listener->getServer();
ClientProxy* client = listener->getNextClient(); ClientProxy* client = listener->getNextClient();
@ -336,7 +336,7 @@ NetworkTests::sendToClient_mockData_handleClientConnected(const Event&, void* vl
throw runtime_error("client is null"); throw runtime_error("client is null");
} }
BaseClientProxy* bcp = reinterpret_cast<BaseClientProxy*>(client); BaseClientProxy* bcp = static_cast<BaseClientProxy*>(client);
server->adoptClient(bcp); server->adoptClient(bcp);
server->setActive(bcp); server->setActive(bcp);
@ -346,7 +346,7 @@ NetworkTests::sendToClient_mockData_handleClientConnected(const Event&, void* vl
void void
NetworkTests::sendToClient_mockData_fileRecieveCompleted(const Event& event, void*) NetworkTests::sendToClient_mockData_fileRecieveCompleted(const Event& event, void*)
{ {
Client* client = reinterpret_cast<Client*>(event.getTarget()); Client* client = static_cast<Client*>(event.getTarget());
EXPECT_TRUE(client->isReceivedFileSizeValid()); EXPECT_TRUE(client->isReceivedFileSizeValid());
m_events.raiseQuitEvent(); m_events.raiseQuitEvent();
@ -355,7 +355,7 @@ NetworkTests::sendToClient_mockData_fileRecieveCompleted(const Event& event, voi
void void
NetworkTests::sendToClient_mockFile_handleClientConnected(const Event&, void* vlistener) NetworkTests::sendToClient_mockFile_handleClientConnected(const Event&, void* vlistener)
{ {
ClientListener* listener = reinterpret_cast<ClientListener*>(vlistener); ClientListener* listener = static_cast<ClientListener*>(vlistener);
Server* server = listener->getServer(); Server* server = listener->getServer();
ClientProxy* client = listener->getNextClient(); ClientProxy* client = listener->getNextClient();
@ -363,7 +363,7 @@ NetworkTests::sendToClient_mockFile_handleClientConnected(const Event&, void* vl
throw runtime_error("client is null"); throw runtime_error("client is null");
} }
BaseClientProxy* bcp = reinterpret_cast<BaseClientProxy*>(client); BaseClientProxy* bcp = static_cast<BaseClientProxy*>(client);
server->adoptClient(bcp); server->adoptClient(bcp);
server->setActive(bcp); server->setActive(bcp);
@ -373,7 +373,7 @@ NetworkTests::sendToClient_mockFile_handleClientConnected(const Event&, void* vl
void void
NetworkTests::sendToClient_mockFile_fileRecieveCompleted(const Event& event, void*) NetworkTests::sendToClient_mockFile_fileRecieveCompleted(const Event& event, void*)
{ {
Client* client = reinterpret_cast<Client*>(event.getTarget()); Client* client = static_cast<Client*>(event.getTarget());
EXPECT_TRUE(client->isReceivedFileSizeValid()); EXPECT_TRUE(client->isReceivedFileSizeValid());
m_events.raiseQuitEvent(); m_events.raiseQuitEvent();
@ -382,14 +382,14 @@ NetworkTests::sendToClient_mockFile_fileRecieveCompleted(const Event& event, voi
void void
NetworkTests::sendToServer_mockData_handleClientConnected(const Event&, void* vclient) NetworkTests::sendToServer_mockData_handleClientConnected(const Event&, void* vclient)
{ {
Client* client = reinterpret_cast<Client*>(vclient); Client* client = static_cast<Client*>(vclient);
sendMockData(client); sendMockData(client);
} }
void void
NetworkTests::sendToServer_mockData_fileRecieveCompleted(const Event& event, void*) NetworkTests::sendToServer_mockData_fileRecieveCompleted(const Event& event, void*)
{ {
Server* server = reinterpret_cast<Server*>(event.getTarget()); Server* server = static_cast<Server*>(event.getTarget());
EXPECT_TRUE(server->isReceivedFileSizeValid()); EXPECT_TRUE(server->isReceivedFileSizeValid());
m_events.raiseQuitEvent(); m_events.raiseQuitEvent();
@ -398,14 +398,14 @@ NetworkTests::sendToServer_mockData_fileRecieveCompleted(const Event& event, voi
void void
NetworkTests::sendToServer_mockFile_handleClientConnected(const Event&, void* vclient) NetworkTests::sendToServer_mockFile_handleClientConnected(const Event&, void* vclient)
{ {
Client* client = reinterpret_cast<Client*>(vclient); Client* client = static_cast<Client*>(vclient);
client->sendFileToServer(kMockFilename); client->sendFileToServer(kMockFilename);
} }
void void
NetworkTests::sendToServer_mockFile_fileRecieveCompleted(const Event& event, void*) NetworkTests::sendToServer_mockFile_fileRecieveCompleted(const Event& event, void*)
{ {
Server* server = reinterpret_cast<Server*>(event.getTarget()); Server* server = static_cast<Server*>(event.getTarget());
EXPECT_TRUE(server->isReceivedFileSizeValid()); EXPECT_TRUE(server->isReceivedFileSizeValid());
m_events.raiseQuitEvent(); m_events.raiseQuitEvent();
@ -491,7 +491,7 @@ createFile(fstream& file, const char* filename, size_t size)
throw runtime_error("file not open"); throw runtime_error("file not open");
} }
file.write(reinterpret_cast<char*>(buffer), size); file.write(static_cast<char*>(buffer), size);
file.close(); file.close();
delete[] buffer; delete[] buffer;