From 8157860e322f74ef22168be4f6bbffa6ca3266ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Fri, 22 Jul 2016 18:54:16 +0300 Subject: [PATCH] Fixed|libdoomsday: Compiler warning (strict aliasing) --- doomsday/apps/libdoomsday/src/filesys/wad.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doomsday/apps/libdoomsday/src/filesys/wad.cpp b/doomsday/apps/libdoomsday/src/filesys/wad.cpp index caabd8d6fa..3815040f29 100644 --- a/doomsday/apps/libdoomsday/src/filesys/wad.cpp +++ b/doomsday/apps/libdoomsday/src/filesys/wad.cpp @@ -48,8 +48,8 @@ struct FileHeader if (readBytes != 12) throw ReadError("FileHeader::operator << (FileHandle &)", "Source file is truncated"); identification = Block(buf, 4); - lumpRecordsCount = littleEndianByteOrder.toHost(*(dint32 *)(buf + 4)); - lumpRecordsOffset = littleEndianByteOrder.toHost(*(dint32 *)(buf + 8)); + lumpRecordsCount = littleEndianByteOrder.toHost(*reinterpret_cast(buf + 4)); + lumpRecordsOffset = littleEndianByteOrder.toHost(*reinterpret_cast(buf + 8)); } }; @@ -68,8 +68,9 @@ struct IndexEntry if (readBytes != 16) throw ReadError("IndexEntry::operator << (FileHandle &)", "Source file is truncated"); name = Block(buf + 8, 8); - offset = littleEndianByteOrder.toHost(*(dint32 *)(buf)); - size = littleEndianByteOrder.toHost(*(dint32 *)(buf + 4)); + dint32 const *off = reinterpret_cast(buf); + offset = littleEndianByteOrder.toHost(*off); + size = littleEndianByteOrder.toHost(*reinterpret_cast(buf + 4)); } /// Perform all translations and encodings to the actual lump name.