aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/endian.h6
-rw-r--r--common/quicktime.h1
-rw-r--r--common/winexe_pe.cpp2
-rw-r--r--common/xmlparser.cpp18
4 files changed, 16 insertions, 11 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/quicktime.h b/common/quicktime.h
index 974502d075..08ca35ad51 100644
--- a/common/quicktime.h
+++ b/common/quicktime.h
@@ -35,6 +35,7 @@
#include "common/scummsys.h"
#include "common/stream.h"
#include "common/rational.h"
+#include "common/types.h"
namespace Common {
class MacResManager;
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/common/xmlparser.cpp b/common/xmlparser.cpp
index ea3d44cf87..f0b7f1cc81 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -20,15 +20,11 @@
*
*/
-// FIXME: Avoid using fprintf
-#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
-#define FORBIDDEN_SYMBOL_EXCEPTION_stderr
-
-
#include "common/xmlparser.h"
#include "common/archive.h"
#include "common/fs.h"
#include "common/memstream.h"
+#include "common/system.h"
namespace Common {
@@ -123,17 +119,19 @@ bool XMLParser::parserError(const String &errStr) {
keyClosing = currentPosition;
}
- fprintf(stderr, "\n File <%s>, line %d:\n", _fileName.c_str(), lineCount);
+ Common::String errorMessage = Common::String::format("\n File <%s>, line %d:\n", _fileName.c_str(), lineCount);
currentPosition = (keyClosing - keyOpening);
_stream->seek(keyOpening, SEEK_SET);
while (currentPosition--)
- fprintf(stderr, "%c", _stream->readByte());
+ errorMessage += (char)_stream->readByte();
+
+ errorMessage += "\n\nParser error: ";
+ errorMessage += errStr;
+ errorMessage += "\n\n";
- fprintf(stderr, "\n\nParser error: ");
- fprintf(stderr, "%s", errStr.c_str());
- fprintf(stderr, "\n\n");
+ g_system->logMessage(LogMessageType::kError, errorMessage.c_str());
return false;
}