Restore safe reinterpret_casts in XWindowsUtil

This commit is contained in:
Andrew Nelless 2016-09-09 15:51:42 +01:00
parent 50807bfcb6
commit 5272c9dde4
1 changed files with 5 additions and 5 deletions

View File

@ -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(static_cast<char*>(&zero), sizeof(zero)); data.append(reinterpret_cast<char*>(&zero), sizeof(zero));
} }
} }
void void
XWindowsUtil::appendAtomData(String& data, Atom atom) XWindowsUtil::appendAtomData(String& data, Atom atom)
{ {
data.append(static_cast<char*>(&atom), sizeof(Atom)); data.append(reinterpret_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),
static_cast<const char*>(&atom), reinterpret_cast<const char*>(&atom),
sizeof(Atom)); sizeof(Atom));
} }
void void
XWindowsUtil::appendTimeData(String& data, Time time) XWindowsUtil::appendTimeData(String& data, Time time)
{ {
data.append(static_cast<char*>(&time), sizeof(Time)); data.append(reinterpret_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 =
static_cast<PropertyNotifyPredicateInfo*>(arg); reinterpret_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 &&