aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/smush
diff options
context:
space:
mode:
authorMax Horn2011-04-12 16:53:15 +0200
committerMax Horn2011-04-12 16:53:15 +0200
commit0ce2ca4e006a70d787481040fa844c85aac43222 (patch)
tree25fb61d7e7165ec2570ecf14a4af52e9bdb6b176 /engines/scumm/smush
parenta8b3501252c46c3fc4fd129fa0a945eb87f47d0a (diff)
downloadscummvm-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/scumm/smush')
-rw-r--r--engines/scumm/smush/imuse_channel.cpp14
-rw-r--r--engines/scumm/smush/saud_channel.cpp10
-rw-r--r--engines/scumm/smush/smush_player.cpp32
3 files changed, 28 insertions, 28 deletions
diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp
index a838fdba56..5af3c9ee8e 100644
--- a/engines/scumm/smush/imuse_channel.cpp
+++ b/engines/scumm/smush/imuse_channel.cpp
@@ -64,7 +64,7 @@ bool ImuseChannel::appendData(Common::SeekableReadStream &b, int32 size) {
assert(size > 8);
uint32 imus_type = b.readUint32BE();
/*uint32 imus_size =*/ b.readUint32BE();
- if (imus_type != MKID_BE('iMUS'))
+ if (imus_type != MKTAG('i','M','U','S'))
error("Invalid Chunk for imuse_channel");
size -= 8;
_tbufferSize = size;
@@ -115,7 +115,7 @@ bool ImuseChannel::handleMap(byte *data) {
size -= 8;
switch (subType) {
- case MKID_BE('FRMT'):
+ case MKTAG('F','R','M','T'):
if (subSize != 20)
error("invalid size for FRMT Chunk");
//uint32 imuse_start = READ_BE_UINT32(data);
@@ -125,14 +125,14 @@ bool ImuseChannel::handleMap(byte *data) {
_channels = READ_BE_UINT32(data+16);
assert(_channels == 1 || _channels == 2);
break;
- case MKID_BE('TEXT'):
+ case MKTAG('T','E','X','T'):
// Ignore this
break;
- case MKID_BE('REGN'):
+ case MKTAG('R','E','G','N'):
if (subSize != 8)
error("invalid size for REGN Chunk");
break;
- case MKID_BE('STOP'):
+ case MKTAG('S','T','O','P'):
if (subSize != 4)
error("invalid size for STOP Chunk");
break;
@@ -201,13 +201,13 @@ bool ImuseChannel::handleSubTags(int32 &offset) {
uint32 size = READ_BE_UINT32(_tbuffer + offset + 4);
uint32 available_size = _tbufferSize - offset;
switch (type) {
- case MKID_BE('MAP '):
+ case MKTAG('M','A','P',' '):
_inData = false;
if (available_size >= (size + 8)) {
handleMap((byte *)_tbuffer + offset);
}
break;
- case MKID_BE('DATA'):
+ case MKTAG('D','A','T','A'):
_inData = true;
_dataSize = size;
offset += 8;
diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp
index 94df70633f..04ed955224 100644
--- a/engines/scumm/smush/saud_channel.cpp
+++ b/engines/scumm/smush/saud_channel.cpp
@@ -50,7 +50,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
uint32 available_size = _tbufferSize - offset;
switch (type) {
- case MKID_BE('STRK'):
+ case MKTAG('S','T','R','K'):
_inData = false;
if (available_size >= (size + 8)) {
int32 subSize = READ_BE_UINT32((byte *)_tbuffer + offset + 4);
@@ -60,14 +60,14 @@ bool SaudChannel::handleSubTags(int32 &offset) {
} else
return false;
break;
- case MKID_BE('SMRK'):
+ case MKTAG('S','M','R','K'):
_inData = false;
if (available_size >= (size + 8))
_markReached = true;
else
return false;
break;
- case MKID_BE('SHDR'):
+ case MKTAG('S','H','D','R'):
_inData = false;
if (available_size >= (size + 8)) {
int32 subSize = READ_BE_UINT32((byte *)_tbuffer + offset + 4);
@@ -76,7 +76,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
} else
return false;
break;
- case MKID_BE('SDAT'):
+ case MKTAG('S','D','A','T'):
_inData = true;
_dataSize = size;
offset += 8;
@@ -123,7 +123,7 @@ bool SaudChannel::appendData(Common::SeekableReadStream &b, int32 size) {
assert(size > 8);
uint32 saud_type = b.readUint32BE();
/*uint32 saud_size =*/ b.readUint32BE();
- if (saud_type != MKID_BE('SAUD'))
+ if (saud_type != MKTAG('S','A','U','D'))
error("Invalid Chunk for SaudChannel : %X", saud_type);
size -= 8;
_dataSize = -2;
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index fe2b9d99ff..0e4f588593 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -190,7 +190,7 @@ static StringResource *getStrings(ScummEngine *vm, const char *file, bool is_enc
theFile.read(filebuffer, length);
filebuffer[length] = 0;
- if (is_encoded && READ_BE_UINT32(filebuffer) == MKID_BE('ETRS')) {
+ if (is_encoded && READ_BE_UINT32(filebuffer) == MKTAG('E','T','R','S')) {
assert(length > ETRS_HEADER_LENGTH);
length -= ETRS_HEADER_LENGTH;
for (int i = 0; i < length; ++i) {
@@ -507,7 +507,7 @@ void SmushPlayer::handleTextResource(uint32 subType, int32 subSize, Common::Seek
const char *str;
char *string = NULL, *string2 = NULL;
- if (subType == MKID_BE('TEXT')) {
+ if (subType == MKTAG('T','E','X','T')) {
string = (char *)malloc(subSize - 16);
str = string;
b.read(string, subSize - 16);
@@ -845,40 +845,40 @@ void SmushPlayer::handleFrame(int32 frameSize, Common::SeekableReadStream &b) {
const int32 subSize = b.readUint32BE();
const int32 subOffset = b.pos();
switch (subType) {
- case MKID_BE('NPAL'):
+ case MKTAG('N','P','A','L'):
handleNewPalette(subSize, b);
break;
- case MKID_BE('FOBJ'):
+ case MKTAG('F','O','B','J'):
handleFrameObject(subSize, b);
break;
#ifdef USE_ZLIB
- case MKID_BE('ZFOB'):
+ case MKTAG('Z','F','O','B'):
handleZlibFrameObject(subSize, b);
break;
#endif
- case MKID_BE('PSAD'):
+ case MKTAG('P','S','A','D'):
if (!_compressedFileMode)
handleSoundFrame(subSize, b);
break;
- case MKID_BE('TRES'):
+ case MKTAG('T','R','E','S'):
handleTextResource(subType, subSize, b);
break;
- case MKID_BE('XPAL'):
+ case MKTAG('X','P','A','L'):
handleDeltaPalette(subSize, b);
break;
- case MKID_BE('IACT'):
+ case MKTAG('I','A','C','T'):
handleIACT(subSize, b);
break;
- case MKID_BE('STOR'):
+ case MKTAG('S','T','O','R'):
handleStore(subSize, b);
break;
- case MKID_BE('FTCH'):
+ case MKTAG('F','T','C','H'):
handleFetch(subSize, b);
break;
- case MKID_BE('SKIP'):
+ case MKTAG('S','K','I','P'):
_vm->_insane->procSKIP(subSize, b);
break;
- case MKID_BE('TEXT'):
+ case MKTAG('T','E','X','T'):
handleTextResource(subType, subSize, b);
break;
default:
@@ -990,7 +990,7 @@ void SmushPlayer::parseNextFrame() {
const uint32 subType = _base->readUint32BE();
const int32 subSize = _base->readUint32BE();
const int32 subOffset = _base->pos();
- assert(subType == MKID_BE('AHDR'));
+ assert(subType == MKTAG('A','H','D','R'));
handleAnimHeader(subSize, *_base);
_base->seek(subOffset + subSize, SEEK_SET);
@@ -1029,10 +1029,10 @@ void SmushPlayer::parseNextFrame() {
debug(3, "Chunk: %s at %x", tag2str(subType), subOffset);
switch (subType) {
- case MKID_BE('AHDR'): // FT INSANE may seek file to the beginning
+ case MKTAG('A','H','D','R'): // FT INSANE may seek file to the beginning
handleAnimHeader(subSize, *_base);
break;
- case MKID_BE('FRME'):
+ case MKTAG('F','R','M','E'):
handleFrame(subSize, *_base);
break;
default: