aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorMax Horn2011-04-12 16:53:15 +0200
committerMax Horn2011-04-12 16:53:15 +0200
commit0ce2ca4e006a70d787481040fa844c85aac43222 (patch)
tree25fb61d7e7165ec2570ecf14a4af52e9bdb6b176 /graphics
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 'graphics')
-rw-r--r--graphics/dither.cpp4
-rw-r--r--graphics/jpeg.cpp2
-rw-r--r--graphics/png.cpp10
-rw-r--r--graphics/sjis.cpp2
-rw-r--r--graphics/thumbnail.cpp4
5 files changed, 11 insertions, 11 deletions
diff --git a/graphics/dither.cpp b/graphics/dither.cpp
index 6a37679b0a..5f423d1c7a 100644
--- a/graphics/dither.cpp
+++ b/graphics/dither.cpp
@@ -174,7 +174,7 @@ bool PaletteLUT::save(Common::WriteStream &stream) {
while (_got < _dim1)
buildNext();
- stream.writeUint32BE(MKID_BE('PLUT')); // Magic
+ stream.writeUint32BE(MKTAG('P','L','U','T')); // Magic
stream.writeUint32BE(kVersion);
stream.writeByte(_depth1);
if (stream.write(_realPal, 768) != 768)
@@ -200,7 +200,7 @@ bool PaletteLUT::load(Common::SeekableReadStream &stream) {
return false;
// Magic
- if (stream.readUint32BE() != MKID_BE('PLUT'))
+ if (stream.readUint32BE() != MKTAG('P','L','U','T'))
return false;
if (stream.readUint32BE() != kVersion)
diff --git a/graphics/jpeg.cpp b/graphics/jpeg.cpp
index 5ddd675273..169c3b5f1b 100644
--- a/graphics/jpeg.cpp
+++ b/graphics/jpeg.cpp
@@ -226,7 +226,7 @@ bool JPEG::read(Common::SeekableReadStream *stream) {
bool JPEG::readJFIF() {
uint16 length = _stream->readUint16BE();
uint32 tag = _stream->readUint32BE();
- if (tag != MKID_BE('JFIF')) {
+ if (tag != MKTAG('J','F','I','F')) {
warning("JPEG::readJFIF() tag mismatch");
return false;
}
diff --git a/graphics/png.cpp b/graphics/png.cpp
index 5292ea0100..eb066efa57 100644
--- a/graphics/png.cpp
+++ b/graphics/png.cpp
@@ -67,12 +67,12 @@ namespace Graphics {
enum PNGChunks {
// == Critical chunks =====================================================
- kChunkIHDR = MKID_BE('IHDR'), // Image header
- kChunkIDAT = MKID_BE('IDAT'), // Image data
- kChunkPLTE = MKID_BE('PLTE'), // Palette
- kChunkIEND = MKID_BE('IEND'), // Image trailer
+ kChunkIHDR = MKTAG('I','H','D','R'), // Image header
+ kChunkIDAT = MKTAG('I','D','A','T'), // Image data
+ kChunkPLTE = MKTAG('P','L','T','E'), // Palette
+ kChunkIEND = MKTAG('I','E','N','D'), // Image trailer
// == Ancillary chunks ====================================================
- kChunktRNS = MKID_BE('tRNS') // Transparency
+ kChunktRNS = MKTAG('t','R','N','S') // Transparency
// All of the other ancillary chunks are ignored. They're added here for
// reference only.
// cHRM - Primary chromacities and white point
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index bb9f33aa26..c581f9b265 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -362,7 +362,7 @@ bool FontSjisSVM::loadData() {
uint32 magic1 = data->readUint32BE();
uint32 magic2 = data->readUint32BE();
- if (magic1 != MKID_BE('SCVM') || magic2 != MKID_BE('SJIS')) {
+ if (magic1 != MKTAG('S','C','V','M') || magic2 != MKTAG('S','J','I','S')) {
delete data;
return false;
}
diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp
index b245cfc5fa..8688096c3d 100644
--- a/graphics/thumbnail.cpp
+++ b/graphics/thumbnail.cpp
@@ -49,7 +49,7 @@ bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool ou
// We also accept the bad 'BMHT' header here, for the sake of compatibility
// with some older savegames which were written incorrectly due to a bug in
// ScummVM which wrote the thumb header type incorrectly on LE systems.
- if (header.type != MKID_BE('THMB') && header.type != MKID_BE('BMHT')) {
+ if (header.type != MKTAG('T','H','M','B') && header.type != MKTAG('B','M','H','T')) {
if (outputWarnings)
warning("couldn't find thumbnail header type");
return false;
@@ -145,7 +145,7 @@ bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) {
}
ThumbnailHeader header;
- header.type = MKID_BE('THMB');
+ header.type = MKTAG('T','H','M','B');
header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel;
header.version = THMB_VERSION;
header.width = thumb.w;