diff options
-rw-r--r-- | common/endian.h | 6 | ||||
-rw-r--r-- | common/winexe_pe.cpp | 2 | ||||
-rw-r--r-- | video/avi_decoder.cpp | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/common/endian.h b/common/endian.h index 394437ec67..759513efef 100644 --- a/common/endian.h +++ b/common/endian.h @@ -146,6 +146,12 @@ */ #define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) +/** + * A wrapper macro used around two character constants, like 'wb', to + * ensure portability. Typical usage: MKTAG16('w','b'). + */ +#define MKTAG16(a0,a1) ((uint16)((a1) | ((a0) << 8))) + // Functions for reading/writing native integers. // They also transparently handle the need for alignment. diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp index 6c0f9c9962..b3c45ffe73 100644 --- a/common/winexe_pe.cpp +++ b/common/winexe_pe.cpp @@ -64,7 +64,7 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream) { if (!stream) return false; - if (stream->readUint16BE() != 'MZ') + if (stream->readUint16BE() != MKTAG16('M', 'Z')) return false; stream->skip(58); diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 0850d5656a..09b95d38ad 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -334,14 +334,14 @@ void AVIDecoder::readNextPacket() { _fileStream->skip(chunkSize & 1); if (track->getTrackType() == Track::kTrackTypeAudio) { - if (getStreamType(nextTag) != 'wb') + if (getStreamType(nextTag) != MKTAG16('w', 'b')) error("Invalid audio track tag '%s'", tag2str(nextTag)); ((AVIAudioTrack *)track)->queueSound(chunk); } else { AVIVideoTrack *videoTrack = (AVIVideoTrack *)track; - if (getStreamType(nextTag) == 'pc') { + if (getStreamType(nextTag) == MKTAG16('p', 'c')) { // Palette Change byte firstEntry = chunk->readByte(); uint16 numEntries = chunk->readByte(); @@ -362,7 +362,7 @@ void AVIDecoder::readNextPacket() { delete chunk; videoTrack->markPaletteDirty(); - } else if (getStreamType(nextTag) == 'db') { + } else if (getStreamType(nextTag) == MKTAG16('d', 'b')) { // TODO: Check if this really is uncompressed. Many videos // falsely put compressed data in here. error("Uncompressed AVI frame found"); |