Restore safe reinterpret_cast in clipboard converter

This commit is contained in:
Andrew Nelless 2016-09-09 15:35:21 +01:00
parent fb5e2bb171
commit 055370412c
1 changed files with 2 additions and 2 deletions

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 = static_cast<const UInt8*>(bmp.data()); const UInt8* rawBMPInfoHeader = reinterpret_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(static_cast<const char*>(infoHeader), return String(reinterpret_cast<const char*>(infoHeader),
sizeof(infoHeader)) + rawBMP; sizeof(infoHeader)) + rawBMP;
} }