aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMatthew Hoops2012-08-26 12:38:35 -0400
committerMatthew Hoops2012-08-26 12:38:35 -0400
commit6f9d84665fd090ae55386b1373a69e080b34e089 (patch)
tree871171da7f52b8129408cf59dd2faa78c4937042 /common
parentc7222ed5a4428c51cdf325fc0eb172f46a991d86 (diff)
downloadscummvm-rg350-6f9d84665fd090ae55386b1373a69e080b34e089.tar.gz
scummvm-rg350-6f9d84665fd090ae55386b1373a69e080b34e089.tar.bz2
scummvm-rg350-6f9d84665fd090ae55386b1373a69e080b34e089.zip
COMMON: Add MKTAG16 for 16-bit multi-character constants
Diffstat (limited to 'common')
-rw-r--r--common/endian.h6
-rw-r--r--common/winexe_pe.cpp2
2 files changed, 7 insertions, 1 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);