diff options
| author | Max Horn | 2011-04-12 16:53:15 +0200 |
|---|---|---|
| committer | Max Horn | 2011-04-12 16:53:15 +0200 |
| commit | 0ce2ca4e006a70d787481040fa844c85aac43222 (patch) | |
| tree | 25fb61d7e7165ec2570ecf14a4af52e9bdb6b176 /engines/made | |
| parent | a8b3501252c46c3fc4fd129fa0a945eb87f47d0a (diff) | |
| download | scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.tar.gz scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.tar.bz2 scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.zip | |
COMMON: Replace MKID_BE by MKTAG
MKID_BE relied on unspecified behavior of the C++ compiler,
and as such was always a bit unsafe. The new MKTAG macro
is slightly less elegant, but does no longer depend on the
behavior of the compiler.
Inspired by FFmpeg, which has an almost identical macro.
Diffstat (limited to 'engines/made')
| -rw-r--r-- | engines/made/database.cpp | 6 | ||||
| -rw-r--r-- | engines/made/pmvplayer.cpp | 6 | ||||
| -rw-r--r-- | engines/made/resource.cpp | 12 | ||||
| -rw-r--r-- | engines/made/resource.h | 20 |
4 files changed, 22 insertions, 22 deletions
diff --git a/engines/made/database.cpp b/engines/made/database.cpp index 2aa378edf5..8d06aa0085 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -659,7 +659,7 @@ bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String } uint32 header = in->readUint32BE(); - if (header != MKID_BE('SGAM')) { + if (header != MKTAG('S','G','A','M')) { warning("Save game header missing"); delete in; return false; @@ -696,7 +696,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in return 6; } strncpy(desc, description, 64); - out->writeUint32BE(MKID_BE('SGAM')); + out->writeUint32BE(MKTAG('S','G','A','M')); out->writeUint32LE(size); out->writeUint16LE(version); out->write(desc, 64); @@ -715,7 +715,7 @@ int16 GameDatabaseV3::loadgame(const char *filename, int16 version) { } uint32 header = in->readUint32BE(); - if (header != MKID_BE('SGAM')) { + if (header != MKTAG('S','G','A','M')) { warning("Save game header missing"); delete in; return 1; diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index 87640f2b67..e37bd87a7e 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -50,14 +50,14 @@ bool PmvPlayer::play(const char *filename) { uint32 chunkType, chunkSize, prevChunkSize = 0; readChunk(chunkType, chunkSize); // "MOVE" - if (chunkType != MKID_BE('MOVE')) { + if (chunkType != MKTAG('M','O','V','E')) { warning("Unexpected PMV video header, expected 'MOVE'"); delete _fd; return false; } readChunk(chunkType, chunkSize); // "MHED" - if (chunkType != MKID_BE('MHED')) { + if (chunkType != MKTAG('M','H','E','D')) { warning("Unexpected PMV video header, expected 'MHED'"); delete _fd; return false; @@ -111,7 +111,7 @@ bool PmvPlayer::play(const char *filename) { int32 frameTime = _vm->_system->getMillis(); readChunk(chunkType, chunkSize); - if (chunkType != MKID_BE('MFRM')) { + if (chunkType != MKTAG('M','F','R','M')) { warning("Unknown chunk type"); } diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index f8582aec40..e556e4ab38 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -57,7 +57,7 @@ PictureResource::~PictureResource() { } void PictureResource::load(byte *source, int size) { - if (READ_BE_UINT32(source) == MKID_BE('Flex')) { + if (READ_BE_UINT32(source) == MKTAG('F','l','e','x')) { loadChunked(source, size); } else { loadRaw(source, size); @@ -126,13 +126,13 @@ void PictureResource::loadChunked(byte *source, int size) { debug(0, "chunkType = %08X; chunkSize = %d", chunkType, chunkSize); - if (chunkType == MKID_BE('Rect')) { + if (chunkType == MKTAG('R','e','c','t')) { debug(0, "Rect"); sourceS->skip(4); height = sourceS->readUint16BE(); width = sourceS->readUint16BE(); debug(0, "width = %d; height = %d", width, height); - } else if (chunkType == MKID_BE('fMap')) { + } else if (chunkType == MKTAG('f','M','a','p')) { debug(0, "fMap"); lineSize = sourceS->readUint16BE(); sourceS->skip(11); @@ -140,21 +140,21 @@ void PictureResource::loadChunked(byte *source, int size) { cmdOffs = sourceS->pos(); sourceS->skip(chunkSize - 14); debug(0, "lineSize = %d; cmdFlags = %d; cmdOffs = %04X", lineSize, cmdFlags, cmdOffs); - } else if (chunkType == MKID_BE('fLCo')) { + } else if (chunkType == MKTAG('f','L','C','o')) { debug(0, "fLCo"); sourceS->skip(9); pixelFlags = sourceS->readByte(); pixelOffs = sourceS->pos(); sourceS->skip(chunkSize - 10); debug(0, "pixelFlags = %d; pixelOffs = %04X", pixelFlags, pixelOffs); - } else if (chunkType == MKID_BE('fPix')) { + } else if (chunkType == MKTAG('f','P','i','x')) { debug(0, "fPix"); sourceS->skip(9); maskFlags = sourceS->readByte(); maskOffs = sourceS->pos(); sourceS->skip(chunkSize - 10); debug(0, "maskFlags = %d; maskOffs = %04X", maskFlags, maskOffs); - } else if (chunkType == MKID_BE('fGCo')) { + } else if (chunkType == MKTAG('f','G','C','o')) { debug(0, "fGCo"); _hasPalette = true; _paletteColorCount = chunkSize / 3; diff --git a/engines/made/resource.h b/engines/made/resource.h index 5d5664b4c7..ade6a23029 100644 --- a/engines/made/resource.h +++ b/engines/made/resource.h @@ -49,16 +49,16 @@ const int kMaxResourceCacheSize = 400 * 1024; enum ResourceType { - kResARCH = MKID_BE('ARCH'), - kResFREE = MKID_BE('FREE'), - kResOMNI = MKID_BE('OMNI'), - kResFLEX = MKID_BE('FLEX'), - kResSNDS = MKID_BE('SNDS'), - kResANIM = MKID_BE('ANIM'), - kResMENU = MKID_BE('MENU'), - kResFONT = MKID_BE('FONT'), - kResXMID = MKID_BE('XMID'), - kResMIDI = MKID_BE('MIDI') + kResARCH = MKTAG('A','R','C','H'), + kResFREE = MKTAG('F','R','E','E'), + kResOMNI = MKTAG('O','M','N','I'), + kResFLEX = MKTAG('F','L','E','X'), + kResSNDS = MKTAG('S','N','D','S'), + kResANIM = MKTAG('A','N','I','M'), + kResMENU = MKTAG('M','E','N','U'), + kResFONT = MKTAG('F','O','N','T'), + kResXMID = MKTAG('X','M','I','D'), + kResMIDI = MKTAG('M','I','D','I') }; struct ResourceSlot; |
