aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/EventDispatcher.cpp3
-rw-r--r--common/EventRecorder.cpp6
-rw-r--r--common/EventRecorder.h5
-rw-r--r--common/algorithm.h10
-rw-r--r--common/archive.cpp5
-rw-r--r--common/archive.h4
-rw-r--r--common/array.h62
-rw-r--r--common/bufferedstream.h4
-rw-r--r--common/config-file.cpp5
-rw-r--r--common/config-file.h9
-rw-r--r--common/config-manager.cpp6
-rw-r--r--common/config-manager.h3
-rw-r--r--common/dcl.cpp7
-rw-r--r--common/dcl.h3
-rw-r--r--common/debug-channels.h3
-rw-r--r--common/debug.cpp5
-rw-r--r--common/debug.h3
-rw-r--r--common/endian.h45
-rw-r--r--common/error.cpp7
-rw-r--r--common/error.h6
-rw-r--r--common/events.h3
-rw-r--r--common/file.cpp6
-rw-r--r--common/file.h5
-rw-r--r--common/forbidden.h246
-rw-r--r--common/frac.h3
-rw-r--r--common/fs.cpp5
-rw-r--r--common/fs.h5
-rw-r--r--common/func.h3
-rw-r--r--common/hash-str.h3
-rw-r--r--common/hashmap.cpp3
-rw-r--r--common/hashmap.h5
-rw-r--r--common/iff_container.cpp3
-rw-r--r--common/iff_container.h5
-rw-r--r--common/keyboard.h3
-rw-r--r--common/list.h3
-rw-r--r--common/list_intern.h3
-rw-r--r--common/macresman.cpp133
-rw-r--r--common/macresman.h27
-rw-r--r--common/md5.cpp7
-rw-r--r--common/md5.h5
-rw-r--r--common/memorypool.cpp3
-rw-r--r--common/memorypool.h3
-rw-r--r--common/memstream.h4
-rw-r--r--common/mutex.cpp3
-rw-r--r--common/mutex.h3
-rw-r--r--common/noncopyable.h3
-rw-r--r--common/pack-end.h3
-rw-r--r--common/pack-start.h3
-rw-r--r--common/ptr.h3
-rw-r--r--common/queue.h3
-rw-r--r--common/random.cpp11
-rw-r--r--common/random.h20
-rw-r--r--common/rational.cpp3
-rw-r--r--common/rational.h3
-rw-r--r--common/rect.h3
-rw-r--r--common/savefile.h3
-rw-r--r--common/scummsys.h352
-rw-r--r--common/serializer.h3
-rw-r--r--common/singleton.h3
-rw-r--r--common/stack.h3
-rw-r--r--common/str-array.h3
-rw-r--r--common/str.cpp36
-rw-r--r--common/str.h3
-rw-r--r--common/stream.cpp12
-rw-r--r--common/stream.h31
-rw-r--r--common/substream.h23
-rw-r--r--common/system.cpp4
-rw-r--r--common/system.h29
-rw-r--r--common/textconsole.cpp6
-rw-r--r--common/textconsole.h5
-rw-r--r--common/timer.h3
-rw-r--r--common/tokenizer.cpp3
-rw-r--r--common/tokenizer.h3
-rw-r--r--common/translation.cpp5
-rw-r--r--common/translation.h7
-rw-r--r--common/types.h3
-rw-r--r--common/unarj.cpp5
-rw-r--r--common/unarj.h6
-rw-r--r--common/unzip.cpp6
-rw-r--r--common/unzip.h6
-rw-r--r--common/util.cpp7
-rw-r--r--common/util.h4
-rw-r--r--common/winexe.cpp3
-rw-r--r--common/winexe.h6
-rw-r--r--common/winexe_ne.cpp3
-rw-r--r--common/winexe_ne.h8
-rw-r--r--common/winexe_pe.cpp6
-rw-r--r--common/winexe_pe.h8
-rw-r--r--common/xmlparser.cpp11
-rw-r--r--common/xmlparser.h5
-rw-r--r--common/zlib.cpp6
-rw-r--r--common/zlib.h3
92 files changed, 633 insertions, 748 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index d295cb9f81..e97068c0d0 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/events.h"
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index 1dedbb5059..eb22e1ea88 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/EventRecorder.h"
@@ -28,6 +25,7 @@
#include "common/config-manager.h"
#include "common/random.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
DECLARE_SINGLETON(Common::EventRecorder);
@@ -253,7 +251,7 @@ void EventRecorder::deinit() {
g_system->deleteMutex(_recorderMutex);
}
-void EventRecorder::registerRandomSource(RandomSource &rnd, const char *name) {
+void EventRecorder::registerRandomSource(RandomSource &rnd, const String &name) {
if (_recordMode == kRecorderRecord) {
RandomSourceRecord rec;
rec.name = name;
diff --git a/common/EventRecorder.h b/common/EventRecorder.h
index 19272c4e29..8377d9e8bd 100644
--- a/common/EventRecorder.h
+++ b/common/EventRecorder.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_EVENTRECORDER_H
@@ -54,7 +51,7 @@ public:
void deinit();
/** Register random source so it can be serialized in game test purposes */
- void registerRandomSource(RandomSource &rnd, const char *name);
+ void registerRandomSource(RandomSource &rnd, const String &name);
/** TODO: Add documentation, this is only used by the backend */
void processMillis(uint32 &millis);
diff --git a/common/algorithm.h b/common/algorithm.h
index e5c5f81433..fa9d08b380 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_ALGORITHM_H
@@ -237,6 +234,11 @@ void sort(T first, T last) {
sort(first, last, Common::Less<typename T::ValueType>());
}
+// MSVC is complaining about the minus operator being applied to an unsigned type
+// We disable this warning for the affected section of code
+#pragma warning(push)
+#pragma warning(disable: 4146)
+
/**
* Euclid's algorithm to compute the greatest common divisor.
*/
@@ -259,6 +261,8 @@ T gcd(T a, T b) {
return b;
}
+#pragma warning(pop)
+
} // End of namespace Common
#endif
diff --git a/common/archive.cpp b/common/archive.cpp
index c65408b56e..0ef3893a8c 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -18,15 +18,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/archive.h"
#include "common/fs.h"
-#include "common/util.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace Common {
diff --git a/common/archive.h b/common/archive.h
index c12ca79be0..3c75970d60 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -18,16 +18,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_ARCHIVE_H
#define COMMON_ARCHIVE_H
#include "common/str.h"
-#include "common/hash-str.h"
#include "common/list.h"
#include "common/ptr.h"
#include "common/singleton.h"
diff --git a/common/array.h b/common/array.h
index e3aab66dc6..7ab4a1b042 100644
--- a/common/array.h
+++ b/common/array.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_ARRAY_H
@@ -27,6 +24,7 @@
#include "common/scummsys.h"
#include "common/algorithm.h"
+#include "common/textconsole.h" // For error()
namespace Common {
@@ -75,8 +73,7 @@ public:
Array(const Array<T> &array) : _capacity(array._size), _size(array._size), _storage(0) {
if (array._storage) {
- _storage = new T[_capacity];
- assert(_storage);
+ allocCapacity(_size);
copy(array._storage, array._storage + _size, _storage);
}
}
@@ -86,9 +83,8 @@ public:
*/
template<class T2>
Array(const T2 *data, int n) {
- _capacity = _size = n;
- _storage = new T[_capacity];
- assert(_storage);
+ _size = n;
+ allocCapacity(n);
copy(data, data + _size, _storage);
}
@@ -182,9 +178,7 @@ public:
delete[] _storage;
_size = array._size;
- _capacity = _size + 32;
- _storage = new T[_capacity];
- assert(_storage);
+ allocCapacity(_size);
copy(array._storage, array._storage + _size, _storage);
return *this;
@@ -241,15 +235,13 @@ public:
if (newCapacity <= _capacity)
return;
- T *old_storage = _storage;
- _capacity = newCapacity;
- _storage = new T[newCapacity];
- assert(_storage);
+ T *oldStorage = _storage;
+ allocCapacity(newCapacity);
- if (old_storage) {
+ if (oldStorage) {
// Copy old data
- copy(old_storage, old_storage + _size, _storage);
- delete[] old_storage;
+ copy(oldStorage, oldStorage + _size, _storage);
+ delete[] oldStorage;
}
}
@@ -270,6 +262,17 @@ protected:
return capa;
}
+ void allocCapacity(uint capacity) {
+ _capacity = capacity;
+ if (capacity) {
+ _storage = new T[capacity];
+ if (!_storage)
+ ::error("Common::Array: failure to allocate %d bytes", capacity);
+ } else {
+ _storage = 0;
+ }
+ }
+
/**
* Insert a range of elements coming from this or another array.
* Unlike std::vector::insert, this method does not accept
@@ -289,29 +292,28 @@ protected:
const uint n = last - first;
if (n) {
const uint idx = pos - _storage;
- T *newStorage = _storage;
- if (_size + n > _capacity) {
+ T *oldStorage = _storage;
+ if (_size + n > _capacity || (_storage <= first && first <= _storage + _size) ) {
// If there is not enough space, allocate more and
// copy old elements over.
- uint newCapacity = roundUpCapacity(_size + n);
- newStorage = new T[newCapacity];
- assert(newStorage);
- copy(_storage, _storage + idx, newStorage);
- pos = newStorage + idx;
+ // Likewise, if this is a self-insert, we allocate new
+ // storage to avoid conflicts. This is not the most efficient
+ // way to ensure that, but probably the simplest on.
+ allocCapacity(roundUpCapacity(_size + n));
+ copy(oldStorage, oldStorage + idx, _storage);
+ pos = _storage + idx;
}
// Make room for the new elements by shifting back
// existing ones.
- copy_backward(_storage + idx, _storage + _size, newStorage + _size + n);
+ copy_backward(oldStorage + idx, oldStorage + _size, _storage + _size + n);
// Insert the new elements.
copy(first, last, pos);
// Finally, update the internal state
- if (newStorage != _storage) {
- delete[] _storage;
- _capacity = roundUpCapacity(_size + n);
- _storage = newStorage;
+ if (_storage != oldStorage) {
+ delete[] oldStorage;
}
_size += n;
}
diff --git a/common/bufferedstream.h b/common/bufferedstream.h
index dc074422bb..55ea8dc13b 100644
--- a/common/bufferedstream.h
+++ b/common/bufferedstream.h
@@ -18,15 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_BUFFEREDSTREAM_H
#define COMMON_BUFFEREDSTREAM_H
#include "common/stream.h"
+#include "common/types.h"
namespace Common {
diff --git a/common/config-file.cpp b/common/config-file.cpp
index 878d29301f..55941131ac 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -18,16 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/config-file.h"
#include "common/file.h"
#include "common/savefile.h"
#include "common/system.h"
-#include "common/util.h"
+#include "common/textconsole.h"
#define MAXLINELEN 256
diff --git a/common/config-file.h b/common/config-file.h
index 2f7d9cb650..d28ad34036 100644
--- a/common/config-file.h
+++ b/common/config-file.h
@@ -18,21 +18,20 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_CONFIG_FILE_H
#define COMMON_CONFIG_FILE_H
-#include "common/config-manager.h"
+#include "common/hash-str.h"
#include "common/list.h"
#include "common/str.h"
-#include "common/stream.h"
namespace Common {
+class SeekableReadStream;
+class WriteStream;
+
/**
* This class allows reading/writing INI style config files.
* It is used by the ConfigManager for storage, but can also
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index 77c918dcae..03fcb20abf 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -18,16 +18,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/config-manager.h"
+#include "common/debug.h"
#include "common/file.h"
#include "common/fs.h"
-#include "common/util.h"
#include "common/system.h"
+#include "common/textconsole.h"
DECLARE_SINGLETON(Common::ConfigManager);
diff --git a/common/config-manager.h b/common/config-manager.h
index b9e4e32399..6f3f554459 100644
--- a/common/config-manager.h
+++ b/common/config-manager.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_CONFIG_MANAGER_H
diff --git a/common/dcl.cpp b/common/dcl.cpp
index ef45bc92ba..b75f7f3fa6 100644
--- a/common/dcl.cpp
+++ b/common/dcl.cpp
@@ -18,18 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/dcl.h"
#include "common/debug.h"
-#include "common/debug-channels.h"
-#include "common/endian.h"
#include "common/memstream.h"
#include "common/stream.h"
-#include "common/util.h"
+#include "common/textconsole.h"
namespace Common {
diff --git a/common/dcl.h b/common/dcl.h
index 88cf9335cf..12c4e12772 100644
--- a/common/dcl.h
+++ b/common/dcl.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
/**
diff --git a/common/debug-channels.h b/common/debug-channels.h
index 445d0e0261..54de9d491e 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_DEBUG_CHANNELS_H
diff --git a/common/debug.cpp b/common/debug.cpp
index c87d195b76..dbbb204deb 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -17,15 +17,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#include "common/debug.h"
#include "common/debug-channels.h"
-#include "common/util.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include <stdarg.h> // For va_list etc.
diff --git a/common/debug.h b/common/debug.h
index 03de7f4f77..dc94839082 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_DEBUG_H
diff --git a/common/endian.h b/common/endian.h
index e6c39d3a4c..9cb703858a 100644
--- a/common/endian.h
+++ b/common/endian.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_ENDIAN_H
@@ -149,51 +146,57 @@
*/
#define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24)))
-// Functions for reading/writing native Integers,
-// this transparently handles the need for alignment
+// Functions for reading/writing native integers.
+// They also transparently handle the need for alignment.
-#if !defined(SCUMM_NEED_ALIGNMENT)
+// Test for GCC >= 4.0. These implementations will automatically use
+// CPU-specific instructions for unaligned data when they are available (eg.
+// MIPS). See also this email thread on scummvm-devel for details:
+// <http://thread.gmane.org/gmane.games.devel.scummvm/8063>
+//
+// Moreover, we activate this code for GCC >= 3.3 but *only* if unaligned access
+// is allowed.
+#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3 && !defined(SCUMM_NEED_ALIGNMENT)))
FORCEINLINE uint16 READ_UINT16(const void *ptr) {
- return *(const uint16 *)(ptr);
+ struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
+ return ((const Unaligned16 *)ptr)->val;
}
FORCEINLINE uint32 READ_UINT32(const void *ptr) {
- return *(const uint32 *)(ptr);
+ struct Unaligned32 { uint32 val; } __attribute__ ((__packed__, __may_alias__));
+ return ((const Unaligned32 *)ptr)->val;
}
FORCEINLINE void WRITE_UINT16(void *ptr, uint16 value) {
- *(uint16 *)(ptr) = value;
+ struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
+ ((Unaligned16 *)ptr)->val = value;
}
FORCEINLINE void WRITE_UINT32(void *ptr, uint32 value) {
- *(uint32 *)(ptr) = value;
+ struct Unaligned32 { uint32 val; } __attribute__ ((__packed__, __may_alias__));
+ ((Unaligned32 *)ptr)->val = value;
}
-// test for GCC >= 4.0. these implementations will automatically use CPU-specific
-// instructions for unaligned data when they are available (eg. MIPS)
-#elif defined(__GNUC__) && (__GNUC__ >= 4)
+#elif !defined(SCUMM_NEED_ALIGNMENT)
FORCEINLINE uint16 READ_UINT16(const void *ptr) {
- struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
- return ((const Unaligned16 *)ptr)->val;
+ return *(const uint16 *)(ptr);
}
FORCEINLINE uint32 READ_UINT32(const void *ptr) {
- struct Unaligned32 { uint32 val; } __attribute__ ((__packed__, __may_alias__));
- return ((const Unaligned32 *)ptr)->val;
+ return *(const uint32 *)(ptr);
}
FORCEINLINE void WRITE_UINT16(void *ptr, uint16 value) {
- struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
- ((Unaligned16 *)ptr)->val = value;
+ *(uint16 *)(ptr) = value;
}
FORCEINLINE void WRITE_UINT32(void *ptr, uint32 value) {
- struct Unaligned32 { uint32 val; } __attribute__ ((__packed__, __may_alias__));
- ((Unaligned32 *)ptr)->val = value;
+ *(uint32 *)(ptr) = value;
}
+
// use software fallback by loading each byte explicitely
#else
diff --git a/common/error.cpp b/common/error.cpp
index 8fa58e2259..a6c52a0ce9 100644
--- a/common/error.cpp
+++ b/common/error.cpp
@@ -18,13 +18,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/error.h"
-#include "common/util.h"
#include "common/translation.h"
@@ -71,9 +67,6 @@ static String errorToString(ErrorCode errorCode) {
case kEnginePluginNotSupportSaves:
return _s("Engine plugin does not support save states");
- case kArgumentNotProcessed:
- return _s("Command line argument not processed");
-
case kUnknownError:
default:
return _s("Unknown error");
diff --git a/common/error.h b/common/error.h
index 1ffbba723a..23c12b67e4 100644
--- a/common/error.h
+++ b/common/error.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_ERROR_H
@@ -50,7 +47,6 @@ enum ErrorCode {
kUnsupportedGameidError, ///< Engine initialization: Gameid not supported by this (Meta)Engine
kUnsupportedColorMode, ///< Engine initialization: Engine does not support backend's color mode
-
kReadPermissionDenied, ///< Unable to read data due to missing read permission
kWritePermissionDenied, ///< Unable to write data due to missing write permission
@@ -66,8 +62,6 @@ enum ErrorCode {
kEnginePluginNotFound, ///< Failed to find plugin to handle target
kEnginePluginNotSupportSaves, ///< Failed if plugin does not support listing save states
- kArgumentNotProcessed, ///< Used in command line parsing
-
kUnknownError ///< Catch-all error, used if no other error code matches
};
diff --git a/common/events.h b/common/events.h
index 120d7d9dea..11eb0c316e 100644
--- a/common/events.h
+++ b/common/events.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_EVENTS_H
diff --git a/common/file.cpp b/common/file.cpp
index dec0f2a953..381bf12ecf 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -18,17 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/archive.h"
#include "common/debug.h"
#include "common/file.h"
#include "common/fs.h"
-#include "common/util.h"
-#include "common/system.h"
+#include "common/textconsole.h"
namespace Common {
diff --git a/common/file.h b/common/file.h
index d28cd9c308..86c67c077c 100644
--- a/common/file.h
+++ b/common/file.h
@@ -18,15 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_FILE_H
#define COMMON_FILE_H
#include "common/scummsys.h"
+#include "common/fs.h"
#include "common/noncopyable.h"
#include "common/str.h"
#include "common/stream.h"
@@ -34,7 +32,6 @@
namespace Common {
class Archive;
-class FSNode;
/**
* TODO: vital to document this core class properly!!! For both users and implementors
diff --git a/common/forbidden.h b/common/forbidden.h
index 92e662ccc6..c551110d0e 100644
--- a/common/forbidden.h
+++ b/common/forbidden.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_FORBIDDEN_H
@@ -41,18 +38,22 @@
#ifndef FORBIDDEN_SYMBOL_ALLOW_ALL
+// Make sure scummsys.h is always included first
+#include "common/scummsys.h"
+
+
/**
* The garbage string to use as replacement for forbidden symbols.
*
* The reason for this particular string is the following:
- * By including a space and "!" we try to ensure a compiler error.
- * By using the words "forbidden symbol" we try to make it a bit
- * clearer what is causing the error.
+ * By including a space and some non-alphanumeric symbols we trigger
+ * a compiler error. By including the words "forbidden symbol" (which
+ * the compiler will hopefully print along with its own error message),
+ * we try to make clear what is causing the error.
*/
-#define FORBIDDEN_SYMBOL_REPLACEMENT FORBIDDEN SYMBOL!
+#define FORBIDDEN_SYMBOL_REPLACEMENT FORBIDDEN SYMBOL !%*
-/*
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_printf
#undef printf
#define printf FORBIDDEN_SYMBOL_REPLACEMENT
@@ -62,7 +63,16 @@
#undef fprintf
#define fprintf FORBIDDEN_SYMBOL_REPLACEMENT
#endif
-*/
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_vprintf
+#undef vprintf
+#define vprintf FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_vfprintf
+#undef vfprintf
+#define vfprintf FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_FILE
#undef FILE
@@ -115,6 +125,27 @@
#endif
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_getc
+#undef getc
+#define getc(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_getchar
+#undef getchar
+#define getchar() FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_putc
+#undef putc
+#define putc(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_putchar
+#undef putchar
+#define putchar(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
#undef setjmp
#define setjmp(a) FORBIDDEN_SYMBOL_REPLACEMENT
@@ -130,30 +161,203 @@
#define system(a) FORBIDDEN_SYMBOL_REPLACEMENT
#endif
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_exit
+#undef exit
+#define exit(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_getenv
+#undef getenv
+#define getenv(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_putenv
+#undef putenv
+#define putenv(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setenv
+#undef setenv
+#define setenv(a,b,c) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_unsetenv
+#undef unsetenv
+#define unsetenv(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
+//
+// Disable various symbols from time.h
+//
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+ /*
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_time_t
+ #undef time_t
+ #define time_t FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+ */
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_asctime
+ #undef asctime
+ #define asctime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_clock
+ #undef clock
+ #define clock() FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_ctime
+ #undef ctime
+ #define ctime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_difftime
+ #undef difftime
+ #define difftime(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_getdate
+ #undef getdate
+ #define getdate(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_gmtime
+ #undef gmtime
+ #define gmtime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_localtime
+ #undef localtime
+ #define localtime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_mktime
+ #undef mktime
+ #define mktime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_time
+ #undef time
+ #define time(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+#endif // FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+//
+// Disable various symbols from unistd.h
+//
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_chdir
+ #undef chdir
+ #define chdir(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_getcwd
+ #undef getcwd
+ #define getcwd(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_getwd
+ #undef getwd
+ #define getwd(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_unlink
+ #undef unlink
+ #define unlink(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+#endif // FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#undef mkdir
+#define mkdir(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
/*
-time_t
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setlocale
+#undef setlocale
+#define setlocale(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+*/
-time
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setvbuf
+#undef setvbuf
+#define setvbuf(a,b,c,d) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-difftime
-mktime
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_tmpfile
+#undef tmpfile
+#define tmpfile() FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-localtime
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_tmpnam
+#undef tmpnam
+#define tmpnam(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-clock
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_tempnam
+#undef tempnam
+#define tempnam(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-gmtime
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_rand
+#undef rand
+#define rand() FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-system
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_srand
+#undef srand
+#define srand(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-remove
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_random
+#undef random
+#define random() FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
-setlocale
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_srandom
+#undef srandom
+#define srandom(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_stricmp
+#undef stricmp
+#define stricmp(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_strnicmp
+#undef strnicmp
+#define strnicmp(a,b,c) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp
+#undef strcasecmp
+#define strcasecmp(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp
+#undef strncasecmp
+#define strncasecmp(a,b,c) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
+/*
+ * We also would like to disable the following symbols;
+ * however, these are also frequently used in regular code,
+ * e.g. for method names, so we don't override them.
+ * - read
+ * - remove
+ * - write
+ * - ...
+ */
-setvbuf
-*/
#endif
diff --git a/common/frac.h b/common/frac.h
index b1e6c518d1..d402878825 100644
--- a/common/frac.h
+++ b/common/frac.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_FRAC_H
diff --git a/common/fs.cpp b/common/fs.cpp
index 87067df2cc..3dc8c289aa 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -17,13 +17,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
-#include "common/util.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "backends/fs/abstract-fs.h"
#include "backends/fs/fs-factory.h"
diff --git a/common/fs.h b/common/fs.h
index 6b20a05013..aeaa14718e 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_FS_H
@@ -27,6 +24,8 @@
#include "common/array.h"
#include "common/archive.h"
+#include "common/hash-str.h"
+#include "common/hashmap.h"
#include "common/ptr.h"
#include "common/str.h"
diff --git a/common/func.h b/common/func.h
index b89a64e5fb..e09ab1a438 100644
--- a/common/func.h
+++ b/common/func.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_FUNC_H
diff --git a/common/hash-str.h b/common/hash-str.h
index 40557037e7..1b8a57827a 100644
--- a/common/hash-str.h
+++ b/common/hash-str.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_HASH_STR_H
diff --git a/common/hashmap.cpp b/common/hashmap.cpp
index 5fe18f33ee..ff8f9db9ce 100644
--- a/common/hashmap.cpp
+++ b/common/hashmap.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
// The hash map (associative array) implementation in this file is
diff --git a/common/hashmap.h b/common/hashmap.h
index 233d7f5b16..f2a4d843b8 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
// The hash map (associative array) implementation in this file is
@@ -47,8 +44,6 @@
#include "common/func.h"
-#include "common/str.h"
-#include "common/util.h"
#ifdef DEBUG_HASH_COLLISIONS
#include "common/debug.h"
diff --git a/common/iff_container.cpp b/common/iff_container.cpp
index c447d93f12..02b445ae05 100644
--- a/common/iff_container.cpp
+++ b/common/iff_container.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/iff_container.h"
diff --git a/common/iff_container.h b/common/iff_container.h
index 01fc8017a9..1b12ef70e5 100644
--- a/common/iff_container.h
+++ b/common/iff_container.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_IFF_CONTAINER_H
@@ -29,7 +26,7 @@
#include "common/endian.h"
#include "common/func.h"
#include "common/stream.h"
-#include "common/util.h"
+#include "common/textconsole.h"
namespace Common {
diff --git a/common/keyboard.h b/common/keyboard.h
index 40491fda6b..74b8775a0f 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_KEYBOARD_H
diff --git a/common/list.h b/common/list.h
index ad6193c297..a1e761f55d 100644
--- a/common/list.h
+++ b/common/list.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_LIST_H
diff --git a/common/list_intern.h b/common/list_intern.h
index b7fbaffc47..daa7446781 100644
--- a/common/list_intern.h
+++ b/common/list_intern.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_LIST_INTERN_H
diff --git a/common/macresman.cpp b/common/macresman.cpp
index b06d986ca2..70c6e0a7ce 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/scummsys.h"
@@ -31,7 +28,7 @@
#include "common/macresman.h"
#include "common/md5.h"
#include "common/substream.h"
-#include "common/memstream.h"
+#include "common/textconsole.h"
#ifdef MACOSX
#include "common/config-manager.h"
@@ -550,132 +547,4 @@ void MacResManager::readMap() {
}
}
-void MacResManager::convertCrsrCursor(SeekableReadStream *data, byte **cursor, int &w, int &h, int &hotspotX,
- int &hotspotY, int &keycolor, bool colored, byte **palette, int &palSize) {
-
- data->readUint16BE(); // type
- data->readUint32BE(); // offset to pixel map
- data->readUint32BE(); // offset to pixel data
- data->readUint32BE(); // expanded cursor data
- data->readUint16BE(); // expanded data depth
- data->readUint32BE(); // reserved
-
- // Grab B/W icon data
- *cursor = new byte[16 * 16];
- for (int i = 0; i < 32; i++) {
- byte imageByte = data->readByte();
- for (int b = 0; b < 8; b++)
- cursor[0][i * 8 + b] = (byte)((imageByte & (0x80 >> b)) > 0 ? 0x0F : 0x00);
- }
-
- // Apply mask data
- for (int i = 0; i < 32; i++) {
- byte imageByte = data->readByte();
- for (int b = 0; b < 8; b++)
- if ((imageByte & (0x80 >> b)) == 0)
- cursor[0][i * 8 + b] = 0xff;
- }
-
- hotspotY = data->readUint16BE();
- hotspotX = data->readUint16BE();
- w = h = 16;
- keycolor = 0xff;
-
- // Use b/w cursor on backends which don't support cursor palettes
- if (!colored)
- return;
-
- data->readUint32BE(); // reserved
- data->readUint32BE(); // cursorID
-
- // Color version of cursor
- data->readUint32BE(); // baseAddr
-
- // Keep only lowbyte for now
- data->readByte();
- int iconRowBytes = data->readByte();
-
- if (!iconRowBytes)
- return;
-
- int iconBounds[4];
- iconBounds[0] = data->readUint16BE();
- iconBounds[1] = data->readUint16BE();
- iconBounds[2] = data->readUint16BE();
- iconBounds[3] = data->readUint16BE();
-
- data->readUint16BE(); // pmVersion
- data->readUint16BE(); // packType
- data->readUint32BE(); // packSize
-
- data->readUint32BE(); // hRes
- data->readUint32BE(); // vRes
-
- data->readUint16BE(); // pixelType
- data->readUint16BE(); // pixelSize
- data->readUint16BE(); // cmpCount
- data->readUint16BE(); // cmpSize
-
- data->readUint32BE(); // planeByte
- data->readUint32BE(); // pmTable
- data->readUint32BE(); // reserved
-
- // Pixel data for cursor
- int iconDataSize = iconRowBytes * (iconBounds[3] - iconBounds[1]);
- byte *iconData = new byte[iconDataSize];
-
- if (!iconData) {
- error("Cannot allocate iconData in macresman.cpp");
- }
-
- data->read(iconData, iconDataSize);
-
- // Color table
- data->readUint32BE(); // ctSeed
- data->readUint16BE(); // ctFlag
- uint16 ctSize = data->readUint16BE() + 1;
-
- *palette = new byte[ctSize * 3];
-
- // Read just high byte of 16-bit color
- for (int c = 0; c < ctSize; c++) {
- // We just use indices 0..ctSize, so ignore color ID
- data->readUint16BE(); // colorID[c]
-
- palette[0][c * 3 + 0] = data->readByte();
- data->readByte();
-
- palette[0][c * 3 + 1] = data->readByte();
- data->readByte();
-
- palette[0][c * 3 + 2] = data->readByte();
- data->readByte();
- }
-
- palSize = ctSize;
-
- int pixelsPerByte = (iconBounds[2] - iconBounds[0]) / iconRowBytes;
- int bpp = 8 / pixelsPerByte;
-
- // build a mask to make sure the pixels are properly shifted out
- int bitmask = 0;
- for (int m = 0; m < bpp; m++) {
- bitmask <<= 1;
- bitmask |= 1;
- }
-
- // Extract pixels from bytes
- for (int j = 0; j < iconDataSize; j++)
- for (int b = 0; b < pixelsPerByte; b++) {
- int idx = j * pixelsPerByte + (pixelsPerByte - 1 - b);
-
- if (cursor[0][idx] != 0xff) // if mask is not there
- cursor[0][idx] = (byte)((iconData[j] >> (b * bpp)) & bitmask);
- }
-
- delete[] iconData;
-
- assert(data->size() - data->pos() == 0);
-}
-
} // End of namespace Common
diff --git a/common/macresman.h b/common/macresman.h
index 2ad0b608a1..4d86e46d11 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
/**
@@ -33,15 +30,14 @@
*/
#include "common/array.h"
-#include "common/file.h"
+#include "common/fs.h"
+#include "common/str.h"
#ifndef COMMON_MACRESMAN_H
#define COMMON_MACRESMAN_H
namespace Common {
-class FSNode;
-
typedef Array<uint16> MacResIDArray;
typedef Array<uint32> MacResTagArray;
@@ -153,25 +149,6 @@ public:
String getBaseFileName() const { return _baseFileName; }
/**
- * Convert cursor from crsr format to format suitable for feeding to CursorMan
- * @param data Pointer to the cursor datax
- * @param cursor Pointer to memory where result cursor will be stored. The memory
- * block will be malloc()'ed
- * @param w Pointer to int where the cursor width will be stored
- * @param h Pointer to int where the cursor height will be stored
- * @param hotspotX Storage for cursor hotspot X coordinate
- * @param hotspotY Storage for cursor hotspot Y coordinate
- * @param keycolor Pointer to int where the transpared color value will be stored
- * @param colored If set to true then colored cursor will be returned (if any).
- * b/w version will be used otherwise
- * @param palette Pointer to memory where the cursor palette will be stored.
- * The memory will be malloc()'ed
- * @param palSize Pointer to integer where the palette size will be stored.
- */
- static void convertCrsrCursor(SeekableReadStream *data, byte **cursor, int &w, int &h, int &hotspotX,
- int &hotspotY, int &keycolor, bool colored, byte **palette, int &palSize);
-
- /**
* Return list of resource IDs with specified type ID
*/
MacResIDArray getResIDArray(uint32 typeID);
diff --git a/common/md5.cpp b/common/md5.cpp
index e4736e85ca..52fe8b8f8d 100644
--- a/common/md5.cpp
+++ b/common/md5.cpp
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
/*
@@ -28,10 +25,10 @@
* this program is licensed under the GPL.
*/
-#include "common/file.h"
-#include "common/fs.h"
#include "common/md5.h"
#include "common/endian.h"
+#include "common/str.h"
+#include "common/stream.h"
namespace Common {
diff --git a/common/md5.h b/common/md5.h
index 29f3aeeb4c..d1be8c8e39 100644
--- a/common/md5.h
+++ b/common/md5.h
@@ -17,20 +17,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_MD5_H
#define COMMON_MD5_H
#include "common/scummsys.h"
-#include "common/str.h"
namespace Common {
class ReadStream;
+class String;
/**
* Compute the MD5 checksum of the content of the given ReadStream.
diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index c4dbb5fbbd..3a570ac50e 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/memorypool.h"
diff --git a/common/memorypool.h b/common/memorypool.h
index e19d982913..5ba09cebed 100644
--- a/common/memorypool.h
+++ b/common/memorypool.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_MEMORYPOOL_H
diff --git a/common/memstream.h b/common/memstream.h
index 13b8e26e8a..69fe6ec18e 100644
--- a/common/memstream.h
+++ b/common/memstream.h
@@ -18,15 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_MEMSTREAM_H
#define COMMON_MEMSTREAM_H
#include "common/stream.h"
+#include "common/types.h"
namespace Common {
diff --git a/common/mutex.cpp b/common/mutex.cpp
index 8ebfa2254b..4e6316528c 100644
--- a/common/mutex.cpp
+++ b/common/mutex.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/debug.h"
diff --git a/common/mutex.h b/common/mutex.h
index 3addaa6b18..26f69a3996 100644
--- a/common/mutex.h
+++ b/common/mutex.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_MUTEX_H
diff --git a/common/noncopyable.h b/common/noncopyable.h
index f639d9abf7..0cbe41388a 100644
--- a/common/noncopyable.h
+++ b/common/noncopyable.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_NONCOPYABLE_H
diff --git a/common/pack-end.h b/common/pack-end.h
index 701b12dccc..04633b7635 100644
--- a/common/pack-end.h
+++ b/common/pack-end.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#if defined(SCUMMVM_USE_PRAGMA_PACK)
diff --git a/common/pack-start.h b/common/pack-start.h
index 0b2c3eff82..631a6529d3 100644
--- a/common/pack-start.h
+++ b/common/pack-start.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#if defined(SCUMMVM_USE_PRAGMA_PACK)
diff --git a/common/ptr.h b/common/ptr.h
index 4d7fff1fc2..e0d026f964 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_PTR_H
diff --git a/common/queue.h b/common/queue.h
index df8dcfe04c..3a2d6aad4b 100644
--- a/common/queue.h
+++ b/common/queue.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_QUEUE_H
diff --git a/common/random.cpp b/common/random.cpp
index 9fd9c33e30..55fa3cbd30 100644
--- a/common/random.cpp
+++ b/common/random.cpp
@@ -17,23 +17,26 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#include "common/random.h"
#include "common/system.h"
+#include "common/EventRecorder.h"
namespace Common {
-RandomSource::RandomSource() {
+RandomSource::RandomSource(const String &name) {
// Use system time as RNG seed. Normally not a good idea, if you are using
// a RNG for security purposes, but good enough for our purposes.
assert(g_system);
uint32 seed = g_system->getMillis();
setSeed(seed);
+
+ // Register this random source with the event recorder. This may end
+ // up querying or resetting the current seed, so we must call it
+ // *after* the initial seed has been set.
+ g_eventRec.registerRandomSource(*this, name);
}
void RandomSource::setSeed(uint32 seed) {
diff --git a/common/random.h b/common/random.h
index 8fc5c4cf7d..90f2ed5cb0 100644
--- a/common/random.h
+++ b/common/random.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_RANDOM_H
@@ -29,6 +26,8 @@
namespace Common {
+class String;
+
/**
* Simple random number generator. Although it is definitely not suitable for
* cryptographic purposes, it serves our purposes just fine.
@@ -38,10 +37,17 @@ private:
uint32 _randSeed;
public:
- RandomSource();
+ /**
+ * Construct a new randomness source with the specific name.
+ * The name used name must be globally unique, and is used to
+ * register the randomness source with the active event recorder,
+ * if any.
+ */
+ RandomSource(const String &name);
+
void setSeed(uint32 seed);
- uint32 getSeed() {
+ uint32 getSeed() const {
return _randSeed;
}
@@ -51,12 +57,14 @@ public:
* @return a random number in the interval [0, max]
*/
uint getRandomNumber(uint max);
+
/**
* Generates a random bit, i.e. either 0 or 1.
- * Identical to getRandomNumber(1), but faster, hopefully.
+ * Identical to getRandomNumber(1), but potentially faster.
* @return a random bit, either 0 or 1
*/
uint getRandomBit();
+
/**
* Generates a random unsigned integer in the interval [min, max].
* @param min the lower bound
diff --git a/common/rational.cpp b/common/rational.cpp
index af38dd9144..cb287869bb 100644
--- a/common/rational.cpp
+++ b/common/rational.cpp
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#include "common/debug.h"
diff --git a/common/rational.h b/common/rational.h
index bee09d8ddb..45aa6a7a20 100644
--- a/common/rational.h
+++ b/common/rational.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_RATIONAL_H
diff --git a/common/rect.h b/common/rect.h
index 03ad02d27a..768d1ebbb9 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_RECT_H
diff --git a/common/savefile.h b/common/savefile.h
index 793aec3ba9..40f316267f 100644
--- a/common/savefile.h
+++ b/common/savefile.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_SAVEFILE_H
diff --git a/common/scummsys.h b/common/scummsys.h
index 6554c70163..5cf3ba4dad 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_SCUMMSYS_H
@@ -110,11 +107,6 @@
#include "config.h"
#endif
-// make sure we really are compiling for WIN32
-#ifndef WIN32
-#undef _MSC_VER
-#endif
-
// In the following we configure various targets, in particular those
// which can't use our "configure" tool and hence don't use config.h.
@@ -126,20 +118,10 @@
// - Define this on a big endian target
// SCUMM_NEED_ALIGNMENT
// - Define this if your system has problems reading e.g. an int32 from an odd address
-// SCUMMVM_DONT_DEFINE_TYPES
-// - Define this if you need to provide your own typedefs, e.g. because your
-// system headers conflict with our typenames, or because you have odd
-// type requirements.
// SMALL_SCREEN_DEVICE
// - ...
// ...
-// We define all types in config.h, so we don't want to typedef those types
-// here again!
-#ifdef HAVE_CONFIG_H
-#define SCUMMVM_DONT_DEFINE_TYPES
-#endif
-
//
// By default we try to use pragma push/pop to ensure various structs we use
@@ -155,206 +137,84 @@
#define SCUMMVM_USE_PRAGMA_PACK
-#if defined(__SYMBIAN32__)
+#if defined(HAVE_CONFIG_H)
+ // All settings should have been set in config.h
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
+#elif defined(__SYMBIAN32__)
#define SCUMM_LITTLE_ENDIAN
#define SCUMM_NEED_ALIGNMENT
- #define SMALL_SCREEN_DEVICE
-
- // Enable Symbians own datatypes
- // This is done for two reasons
- // a) uint is already defined by Symbians libc component
- // b) Symbian is using its "own" datatyping, and the Scummvm port
- // should follow this to ensure the best compability possible.
- #define SCUMMVM_DONT_DEFINE_TYPES
- typedef unsigned char byte;
-
- typedef unsigned char uint8;
- typedef signed char int8;
-
- typedef unsigned short int uint16;
- typedef signed short int int16;
-
- typedef unsigned long int uint32;
- typedef signed long int int32;
-
#elif defined(_WIN32_WCE)
- #define scumm_stricmp stricmp
- #define scumm_strnicmp _strnicmp
- #define snprintf _snprintf
-
#define SCUMM_LITTLE_ENDIAN
- #ifndef __GNUC__
- #define FORCEINLINE __forceinline
- #define NORETURN_PRE __declspec(noreturn)
- #endif
- #define PLUGIN_EXPORT __declspec(dllexport)
-
- #if _WIN32_WCE < 300
- #define SMALL_SCREEN_DEVICE
- #endif
-
#elif defined(_MSC_VER)
- #define scumm_stricmp stricmp
- #define scumm_strnicmp _strnicmp
- #define snprintf _snprintf
-
#define SCUMM_LITTLE_ENDIAN
- #define FORCEINLINE __forceinline
- #define NORETURN_PRE __declspec(noreturn)
- #define PLUGIN_EXPORT __declspec(dllexport)
-
-
#elif defined(__MINGW32__)
- #define scumm_stricmp stricmp
- #define scumm_strnicmp strnicmp
-
#define SCUMM_LITTLE_ENDIAN
- #define PLUGIN_EXPORT __declspec(dllexport)
-
-#elif defined(UNIX)
-
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
- #ifndef CONFIG_H
- /* need this for the SDL_BYTEORDER define */
- #include <SDL_byteorder.h>
-
- #if SDL_BYTEORDER == SDL_LIL_ENDIAN
- #define SCUMM_LITTLE_ENDIAN
- #elif SDL_BYTEORDER == SDL_BIG_ENDIAN
- #define SCUMM_BIG_ENDIAN
- #else
- #error Neither SDL_BIG_ENDIAN nor SDL_LIL_ENDIAN is set.
- #endif
- #endif
-
- // You need to set this manually if necessary
-// #define SCUMM_NEED_ALIGNMENT
+#elif defined(SDL_BACKEND)
+ /* need this for the SDL_BYTEORDER define */
+ #include <SDL_byteorder.h>
- // Very BAD hack following, used to avoid triggering an assert in uClibc dingux library
- // "toupper" when pressing keyboard function keys.
- #if defined(DINGUX)
- #undef toupper
- #define toupper(c) (((c & 0xFF) >= 97) && ((c & 0xFF) <= 122) ? ((c & 0xFF) - 32) : (c & 0xFF))
+ #if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ #define SCUMM_LITTLE_ENDIAN
+ #elif SDL_BYTEORDER == SDL_BIG_ENDIAN
+ #define SCUMM_BIG_ENDIAN
+ #else
+ #error Neither SDL_BIG_ENDIAN nor SDL_LIL_ENDIAN is set.
#endif
#elif defined(__DC__)
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
#define SCUMM_LITTLE_ENDIAN
#define SCUMM_NEED_ALIGNMENT
#elif defined(__GP32__)
- #define scumm_stricmp stricmp
- #define scumm_strnicmp strnicmp
-
#define SCUMM_LITTLE_ENDIAN
#define SCUMM_NEED_ALIGNMENT
- // Override typenames. uint is already defined by system header files.
- #define SCUMMVM_DONT_DEFINE_TYPES
- typedef unsigned char byte;
-
- typedef unsigned char uint8;
- typedef signed char int8;
-
- typedef unsigned short int uint16;
- typedef signed short int int16;
-
- typedef unsigned long int uint32;
- typedef signed long int int32;
-
#elif defined(__PLAYSTATION2__)
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
#define SCUMM_LITTLE_ENDIAN
#define SCUMM_NEED_ALIGNMENT
#elif defined(__N64__)
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
#define SCUMM_BIG_ENDIAN
#define SCUMM_NEED_ALIGNMENT
- #define STRINGBUFLEN 256
-
- #define SCUMMVM_DONT_DEFINE_TYPES
- typedef unsigned char byte;
-
- typedef unsigned char uint8;
- typedef signed char int8;
-
- typedef unsigned short int uint16;
- typedef signed short int int16;
-
- typedef unsigned int uint32;
- typedef signed int int32;
-
- typedef unsigned long long uint64;
- typedef signed long long int64;
-
#elif defined(__PSP__)
- #include <malloc.h>
- #include "backends/platform/psp/memory.h"
-
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
#define SCUMM_LITTLE_ENDIAN
#define SCUMM_NEED_ALIGNMENT
- /* to make an efficient, inlined memcpy implementation */
- #define memcpy(dst, src, size) psp_memcpy(dst, src, size)
-
#elif defined(__amigaos4__)
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
#define SCUMM_BIG_ENDIAN
#define SCUMM_NEED_ALIGNMENT
-#elif defined (__DS__)
-
- #define scumm_stricmp stricmp
- #define scumm_strnicmp strnicmp
+#elif defined(__DS__)
#define SCUMM_NEED_ALIGNMENT
#define SCUMM_LITTLE_ENDIAN
- #define SCUMMVM_DONT_DEFINE_TYPES
-
- #define STRINGBUFLEN 256
-// #define printf(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__)
-
#elif defined(__WII__)
- #define scumm_stricmp strcasecmp
- #define scumm_strnicmp strncasecmp
-
#define SCUMM_BIG_ENDIAN
#define SCUMM_NEED_ALIGNMENT
+#elif defined(IPHONE)
+
+ #define SCUMM_LITTLE_ENDIAN
+ #define SCUMM_NEED_ALIGNMENT
+
+
#else
#error No system type defined
@@ -362,47 +222,96 @@
//
-// GCC specific stuff
+// Some more system specific settings.
+// TODO/FIXME: All of these should be moved to backend specific files (such as portdefs.h)
//
-#if defined(__GNUC__)
- #define NORETURN_POST __attribute__((__noreturn__))
- #define PACKED_STRUCT __attribute__((__packed__))
- #define GCC_PRINTF(x,y) __attribute__((__format__(printf, x, y)))
+#if defined(__SYMBIAN32__)
- #if !defined(FORCEINLINE) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
- #define FORCEINLINE inline __attribute__((__always_inline__))
+ #define SMALL_SCREEN_DEVICE
+
+#elif defined(_WIN32_WCE)
+
+ #if _WIN32_WCE < 300
+ #define SMALL_SCREEN_DEVICE
#endif
-#elif defined(__INTEL_COMPILER)
- #define NORETURN_POST __attribute__((__noreturn__))
- #define PACKED_STRUCT __attribute__((__packed__))
- #define GCC_PRINTF(x,y) __attribute__((__format__(printf, x, y)))
-#else
- #define PACKED_STRUCT
- #define GCC_PRINTF(x,y)
+
+#elif defined(DINGUX)
+
+ // Very BAD hack following, used to avoid triggering an assert in uClibc dingux library
+ // "toupper" when pressing keyboard function keys.
+ #undef toupper
+ #define toupper(c) (((c & 0xFF) >= 97) && ((c & 0xFF) <= 122) ? ((c & 0xFF) - 32) : (c & 0xFF))
+
+#elif defined(__PSP__)
+
+ #include <malloc.h>
+ #include "backends/platform/psp/memory.h"
+
+ /* to make an efficient, inlined memcpy implementation */
+ #define memcpy(dst, src, size) psp_memcpy(dst, src, size)
+
#endif
//
// Fallbacks / default values for various special macros
//
+#ifndef GCC_PRINTF
+ #if defined(__GNUC__) || defined(__INTEL_COMPILER)
+ #define GCC_PRINTF(x,y) __attribute__((__format__(__printf__, x, y)))
+ #else
+ #define GCC_PRINTF(x,y)
+ #endif
+#endif
+
+#ifndef PACKED_STRUCT
+ #if defined(__GNUC__) || defined(__INTEL_COMPILER)
+ #define PACKED_STRUCT __attribute__((__packed__))
+ #else
+ #define PACKED_STRUCT
+ #endif
+#endif
+
#ifndef FORCEINLINE
-#define FORCEINLINE inline
+ #if defined(_MSC_VER)
+ #define FORCEINLINE __forceinline
+ #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+ #define FORCEINLINE inline __attribute__((__always_inline__))
+ #else
+ #define FORCEINLINE inline
+ #endif
#endif
#ifndef PLUGIN_EXPORT
-#define PLUGIN_EXPORT
+ #if defined(_MSC_VER) || defined(_WIN32_WCE) || defined(__MINGW32__)
+ #define PLUGIN_EXPORT __declspec(dllexport)
+ #else
+ #define PLUGIN_EXPORT
+ #endif
#endif
#ifndef NORETURN_PRE
-#define NORETURN_PRE
+ #if defined(_MSC_VER)
+ #define NORETURN_PRE __declspec(noreturn)
+ #else
+ #define NORETURN_PRE
+ #endif
#endif
#ifndef NORETURN_POST
-#define NORETURN_POST
+ #if defined(__GNUC__) || defined(__INTEL_COMPILER)
+ #define NORETURN_POST __attribute__((__noreturn__))
+ #else
+ #define NORETURN_POST
+ #endif
#endif
#ifndef STRINGBUFLEN
-#define STRINGBUFLEN 1024
+ #if defined(__N64__) || defined(__DS__)
+ #define STRINGBUFLEN 256
+ #else
+ #define STRINGBUFLEN 1024
+ #endif
#endif
#ifndef MAXPATHLEN
@@ -411,19 +320,84 @@
//
-// Typedef our system types unless SCUMMVM_DONT_DEFINE_TYPES is set.
+// Typedef our system types
//
-#ifndef SCUMMVM_DONT_DEFINE_TYPES
- typedef unsigned char byte;
- typedef unsigned char uint8;
- typedef signed char int8;
- typedef unsigned short uint16;
- typedef signed short int16;
- typedef unsigned int uint32;
- typedef signed int int32;
- typedef unsigned int uint;
+#if !defined(HAVE_CONFIG_H)
+
+ #if defined(__SYMBIAN32__)
+
+ // Enable Symbians own datatypes
+ // This is done for two reasons
+ // a) uint is already defined by Symbians libc component
+ // b) Symbian is using its "own" datatyping, and the Scummvm port
+ // should follow this to ensure the best compability possible.
+ typedef unsigned char byte;
+
+ typedef unsigned char uint8;
+ typedef signed char int8;
+
+ typedef unsigned short int uint16;
+ typedef signed short int int16;
+
+ typedef unsigned long int uint32;
+ typedef signed long int int32;
+
+ #elif defined(__GP32__)
+
+ // Override typenames. uint is already defined by system header files.
+ typedef unsigned char byte;
+
+ typedef unsigned char uint8;
+ typedef signed char int8;
+
+ typedef unsigned short int uint16;
+ typedef signed short int int16;
+
+ typedef unsigned long int uint32;
+ typedef signed long int int32;
+
+ #elif defined(__N64__)
+
+ typedef unsigned char byte;
+
+ typedef unsigned char uint8;
+ typedef signed char int8;
+
+ typedef unsigned short int uint16;
+ typedef signed short int int16;
+
+ typedef unsigned int uint32;
+ typedef signed int int32;
+
+ #elif defined(__DS__)
+
+ // Do nothing, the SDK defines all types we need in nds/ndstypes.h,
+ // which we include in our portsdef.h
+
+ #else
+
+ typedef unsigned char byte;
+ typedef unsigned char uint8;
+ typedef signed char int8;
+ typedef unsigned short uint16;
+ typedef signed short int16;
+ typedef unsigned int uint32;
+ typedef signed int int32;
+ typedef unsigned int uint;
+
+ #endif
+
#endif
+//
+// Define scumm_stricmp and scumm_strnicmp
+//
+extern int scumm_stricmp(const char *s1, const char *s2);
+extern int scumm_strnicmp(const char *s1, const char *s2, uint n);
+#if defined(_WIN32_WCE) || defined(_MSC_VER)
+ // FIXME: Why is this necessary?
+ #define snprintf _snprintf
+#endif
//
@@ -437,6 +411,6 @@
typedef uint16 OverlayColor;
#endif
-#include "common/forbidden.h"
+#include "common/forbidden.h"
#endif
diff --git a/common/serializer.h b/common/serializer.h
index b8c62727d4..b874624d38 100644
--- a/common/serializer.h
+++ b/common/serializer.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_SERIALIZER_H
diff --git a/common/singleton.h b/common/singleton.h
index c5aa35f68d..2f5fa41877 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_SINGLETON_H
diff --git a/common/stack.h b/common/stack.h
index 5d447d5424..0d13049f2e 100644
--- a/common/stack.h
+++ b/common/stack.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_STACK_H
diff --git a/common/str-array.h b/common/str-array.h
index 5c8324bdea..57c76bf305 100644
--- a/common/str-array.h
+++ b/common/str-array.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_STRING_ARRAY_H
diff --git a/common/str.cpp b/common/str.cpp
index c21e4412db..740e7b6a06 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#include "common/str.h"
@@ -836,3 +833,36 @@ size_t strlcat(char *dst, const char *src, size_t size) {
}
} // End of namespace Common
+
+// Portable implementation of stricmp / strcasecmp / strcmpi.
+// TODO: Rename this to Common::strcasecmp
+int scumm_stricmp(const char *s1, const char *s2) {
+ byte l1, l2;
+ do {
+ // Don't use ++ inside tolower, in case the macro uses its
+ // arguments more than once.
+ l1 = (byte)*s1++;
+ l1 = tolower(l1);
+ l2 = (byte)*s2++;
+ l2 = tolower(l2);
+ } while (l1 == l2 && l1 != 0);
+ return l1 - l2;
+}
+
+// Portable implementation of strnicmp / strncasecmp / strncmpi.
+// TODO: Rename this to Common::strncasecmp
+int scumm_strnicmp(const char *s1, const char *s2, uint n) {
+ byte l1, l2;
+ do {
+ if (n-- == 0)
+ return 0; // no difference found so far -> signal equality
+
+ // Don't use ++ inside tolower, in case the macro uses its
+ // arguments more than once.
+ l1 = (byte)*s1++;
+ l1 = tolower(l1);
+ l2 = (byte)*s2++;
+ l2 = tolower(l2);
+ } while (l1 == l2 && l1 != 0);
+ return l1 - l2;
+}
diff --git a/common/str.h b/common/str.h
index 21c0483a04..b76e4f8448 100644
--- a/common/str.h
+++ b/common/str.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_STRING_H
diff --git a/common/stream.cpp b/common/stream.cpp
index 1be3fbffea..60b40d0df2 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -18,17 +18,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/stream.h"
#include "common/memstream.h"
#include "common/substream.h"
-#include "common/bufferedstream.h"
#include "common/str.h"
-#include "common/util.h"
namespace Common {
@@ -244,6 +239,13 @@ bool SeekableSubReadStream::seek(int32 offset, int whence) {
return ret;
}
+uint32 SafeSubReadStream::read(void *dataPtr, uint32 dataSize) {
+ // Make sure the parent stream is at the right position
+ seek(0, SEEK_CUR);
+
+ return SeekableSubReadStream::read(dataPtr, dataSize);
+}
+
#pragma mark -
diff --git a/common/stream.h b/common/stream.h
index 65b4971a72..26c04e5bf6 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -18,20 +18,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_STREAM_H
#define COMMON_STREAM_H
-#include "common/types.h"
#include "common/endian.h"
+#include "common/scummsys.h"
+#include "common/str.h"
namespace Common {
-class String;
class SeekableReadStream;
/**
@@ -45,12 +42,18 @@ public:
* Returns true if an I/O failure occurred.
* This flag is never cleared automatically. In order to clear it,
* client code has to call clearErr() explicitly.
+ *
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C ferror().
*/
virtual bool err() const { return false; }
/**
* Reset the I/O error status as returned by err().
* For a ReadStream, also reset the end-of-stream status returned by eos().
+ *
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C clearerr().
*/
virtual void clearErr() {}
};
@@ -64,6 +67,9 @@ public:
* Write data into the stream. Subclasses must implement this
* method; all other write methods are implemented using it.
*
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C fwrite().
+ *
* @param dataPtr pointer to the data to be written
* @param dataSize number of bytes to be written
* @return the number of bytes which were actually written.
@@ -75,6 +81,9 @@ public:
* storage medium; unbuffered streams can use the default
* implementation.
*
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C fflush().
+ *
* @return true on success, false in case of a failure
*/
virtual bool flush() { return true; }
@@ -158,6 +167,11 @@ public:
* Returns true if a read failed because the stream end has been reached.
* This flag is cleared by clearErr().
* For a SeekableReadStream, it is also cleared by a successful seek.
+ *
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C feof(). In particular, in a stream
+ * with N bytes, reading exactly N bytes from the start should *not*
+ * set eos; only reading *beyond* the available data should set it.
*/
virtual bool eos() const = 0;
@@ -165,6 +179,10 @@ public:
* Read data from the stream. Subclasses must implement this
* method; all other read methods are implemented using it.
*
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C fread(), in particular where
+ * it concerns setting error and end of file/stream flags.
+ *
* @param dataPtr pointer to a buffer into which the data is read
* @param dataSize number of bytes to be read
* @return the number of bytes which were actually read.
@@ -338,6 +356,9 @@ public:
* position indicator, or end-of-file, respectively. A successful call
* to the seek() method clears the end-of-file indicator for the stream.
*
+ * @note The semantics of any implementation of this method are
+ * supposed to match those of ISO C fseek().
+ *
* @param offset the relative offset in bytes
* @param whence the seek reference: SEEK_SET, SEEK_CUR, or SEEK_END
* @return true on success, false in case of a failure
diff --git a/common/substream.h b/common/substream.h
index 4d90ec5ced..f4f79ff02f 100644
--- a/common/substream.h
+++ b/common/substream.h
@@ -18,15 +18,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_SUBSTREAM_H
#define COMMON_SUBSTREAM_H
#include "common/stream.h"
+#include "common/types.h"
namespace Common {
@@ -101,6 +99,25 @@ public:
}
};
+/**
+ * A seekable substream that removes the exclusivity demand required by the
+ * normal SeekableSubReadStream, at the cost of seek()ing the parent stream
+ * before each read().
+ *
+ * More than one SafeSubReadStream to the same parent stream can be used
+ * at the same time; they won't mess up each other. They will, however,
+ * reposition the parent stream, so don't depend on its position to be
+ * the same after a read() or seek() on one of its SafeSubReadStream.
+ */
+class SafeSubReadStream : public SeekableSubReadStream {
+public:
+ SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO) :
+ SeekableSubReadStream(parentStream, begin, end, disposeParentStream) {
+ }
+
+ virtual uint32 read(void *dataPtr, uint32 dataSize);
+};
+
} // End of namespace Common
diff --git a/common/system.cpp b/common/system.cpp
index 1ec7c14617..1f2f8cc6d5 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
// Disable symbol overrides so that we can use system headers.
@@ -28,6 +25,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/system.h"
+#include "common/str.h"
#ifdef __PLAYSTATION2__
// for those replaced fopen/fread/etc functions
diff --git a/common/system.h b/common/system.h
index c487e727a8..e02779fe47 100644
--- a/common/system.h
+++ b/common/system.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_SYSTEM_H
@@ -28,29 +25,27 @@
#include "common/scummsys.h"
#include "common/noncopyable.h"
-#include "common/rect.h"
#include "common/list.h" // For OSystem::getSupportedFormats()
-
-#include "graphics/palette.h" // for PaletteManager
#include "graphics/pixelformat.h"
namespace Audio {
- class Mixer;
+class Mixer;
}
namespace Graphics {
- struct Surface;
+struct Surface;
}
namespace Common {
- struct Event;
- class EventManager;
- class SaveFileManager;
- class SearchSet;
- class TimerManager;
- class SeekableReadStream;
- class WriteStream;
- class HardwareKeySet;
+class EventManager;
+struct Rect;
+class SaveFileManager;
+class SearchSet;
+class String;
+class TimerManager;
+class SeekableReadStream;
+class WriteStream;
+class HardwareKeySet;
}
class AudioCDManager;
@@ -363,7 +358,7 @@ public:
/**
* Determine which graphics mode is currently active.
- * @return the active graphics mode
+ * @return the ID of the active graphics mode
*/
virtual int getGraphicsMode() const = 0;
diff --git a/common/textconsole.cpp b/common/textconsole.cpp
index 9c72699914..f2325ac9ad 100644
--- a/common/textconsole.cpp
+++ b/common/textconsole.cpp
@@ -17,13 +17,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+
#include "common/textconsole.h"
#include "common/system.h"
+#include "common/str.h"
namespace Common {
diff --git a/common/textconsole.h b/common/textconsole.h
index 963d674c3b..364c49b2e9 100644
--- a/common/textconsole.h
+++ b/common/textconsole.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_CONSOLE_H
@@ -66,8 +63,6 @@ void NORETURN_PRE error(const char *s, ...) GCC_PRINTF(1, 2) NORETURN_POST;
#ifdef DISABLE_TEXT_CONSOLE
-inline int printf(const char *s, ...) { return 0; }
-
inline void warning(const char *s, ...) {}
#else
diff --git a/common/timer.h b/common/timer.h
index c87c2b3240..40438f078c 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_TIMER_H
diff --git a/common/tokenizer.cpp b/common/tokenizer.cpp
index 8bca133b5b..395ff0767a 100644
--- a/common/tokenizer.cpp
+++ b/common/tokenizer.cpp
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#include "common/tokenizer.h"
diff --git a/common/tokenizer.h b/common/tokenizer.h
index 0ee6e37da7..8485094997 100644
--- a/common/tokenizer.h
+++ b/common/tokenizer.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_TOKENIZER_H
diff --git a/common/translation.cpp b/common/translation.cpp
index 407da2c883..dc71ddc52f 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifdef WIN32
@@ -32,11 +29,11 @@
#define TRANSLATIONS_DAT_VER 2
#include "common/translation.h"
-#include "common/archive.h"
#include "common/config-manager.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/system.h"
+#include "common/textconsole.h"
#ifdef USE_TRANSLATION
diff --git a/common/translation.h b/common/translation.h
index 523f2f4de7..9e5245702e 100644
--- a/common/translation.h
+++ b/common/translation.h
@@ -17,14 +17,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_TRANSLATION_H
#define COMMON_TRANSLATION_H
+#include "common/array.h"
+#include "common/fs.h"
+#include "common/str.h"
#include "common/singleton.h"
#include "common/str-array.h"
@@ -33,7 +33,6 @@
namespace Common {
class File;
-class FSNode;
enum TranslationIDs {
kTranslationAutodetectId = 0,
diff --git a/common/types.h b/common/types.h
index bed204ae1b..ab86f3afc2 100644
--- a/common/types.h
+++ b/common/types.h
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_TYPES_H
diff --git a/common/unarj.cpp b/common/unarj.cpp
index 2c4225f393..f45dddaa38 100644
--- a/common/unarj.cpp
+++ b/common/unarj.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
//
@@ -30,12 +27,12 @@
#include "common/scummsys.h"
#include "common/archive.h"
#include "common/debug.h"
-#include "common/util.h"
#include "common/unarj.h"
#include "common/file.h"
#include "common/hash-str.h"
#include "common/memstream.h"
#include "common/bufferedstream.h"
+#include "common/textconsole.h"
namespace Common {
diff --git a/common/unarj.h b/common/unarj.h
index fa7d388542..2be514c936 100644
--- a/common/unarj.h
+++ b/common/unarj.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
/**
@@ -32,10 +29,11 @@
#ifndef COMMON_UNARJ_H
#define COMMON_UNARJ_H
+#include "common/str.h"
+
namespace Common {
class Archive;
-class String;
/**
* This factory method creates an Archive instance corresponding to the content
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 7b78da0faf..f0590dcbfd 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -17,9 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
/* unzip.c -- IO on .zip files using zlib
@@ -68,6 +65,8 @@
PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */
+// Disable symbol overrides so that we can use zlib.h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/scummsys.h"
@@ -105,7 +104,6 @@ typedef struct {
#include "common/fs.h"
#include "common/unzip.h"
-#include "common/file.h"
#include "common/memstream.h"
#include "common/hashmap.h"
diff --git a/common/unzip.h b/common/unzip.h
index c460840f12..06480b0054 100644
--- a/common/unzip.h
+++ b/common/unzip.h
@@ -17,20 +17,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_UNZIP_H
#define COMMON_UNZIP_H
+#include "common/str.h"
+
namespace Common {
class Archive;
class FSNode;
class SeekableReadStream;
-class String;
/**
* This factory method creates an Archive instance corresponding to the content
diff --git a/common/util.cpp b/common/util.cpp
index cba921a142..eed7009f90 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -17,15 +17,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#include "common/util.h"
-#include "common/system.h"
#include "common/translation.h"
#include "common/config-manager.h"
+#include "common/debug.h"
namespace Common {
@@ -213,7 +210,7 @@ const PlatformDescription g_platforms[] = {
{ "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD },
{ "windows", "win", "win", "Windows", kPlatformWindows },
{ "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX },
- { "cdi", "cdi", "cdi", "Phillips CD-i", kPlatformCDi },
+ { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi },
{ 0, 0, 0, "Default", kPlatformUnknown }
};
diff --git a/common/util.h b/common/util.h
index b3dd6a4f64..5d965c4d31 100644
--- a/common/util.h
+++ b/common/util.h
@@ -17,16 +17,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
*/
#ifndef COMMON_UTIL_H
#define COMMON_UTIL_H
#include "common/scummsys.h"
-#include "common/textconsole.h"
#include "common/str.h"
diff --git a/common/winexe.cpp b/common/winexe.cpp
index 9602e84c88..7cfc140452 100644
--- a/common/winexe.cpp
+++ b/common/winexe.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/str.h"
diff --git a/common/winexe.h b/common/winexe.h
index af0d70c555..bec156d2e7 100644
--- a/common/winexe.h
+++ b/common/winexe.h
@@ -18,20 +18,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_WINEXE_H
#define COMMON_WINEXE_H
#include "common/hash-str.h"
+#include "common/str.h"
namespace Common {
-class String;
-
class WinResourceID {
public:
WinResourceID() { _idType = kIDTypeNull; }
diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp
index 844127b0e1..80266ba87e 100644
--- a/common/winexe_ne.cpp
+++ b/common/winexe_ne.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "common/debug.h"
diff --git a/common/winexe_ne.h b/common/winexe_ne.h
index c1d04080ba..4a1b2343df 100644
--- a/common/winexe_ne.h
+++ b/common/winexe_ne.h
@@ -18,23 +18,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_WINEXE_NE_H
#define COMMON_WINEXE_NE_H
-#include "common/array.h"
#include "common/list.h"
+#include "common/str.h"
#include "common/winexe.h"
namespace Common {
-class MemoryReadStream;
+template<class T> class Array;
class SeekableReadStream;
-class String;
/** The default Windows resources. */
enum NEResourceType {
diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp
index 99d44cabbd..e5f6a24bcd 100644
--- a/common/winexe_pe.cpp
+++ b/common/winexe_pe.cpp
@@ -18,14 +18,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
+#include "common/array.h"
#include "common/debug.h"
+#include "common/endian.h"
#include "common/file.h"
-#include "common/memstream.h"
#include "common/str.h"
#include "common/stream.h"
#include "common/winexe_pe.h"
diff --git a/common/winexe_pe.h b/common/winexe_pe.h
index 5298e993ad..cc1d0c9770 100644
--- a/common/winexe_pe.h
+++ b/common/winexe_pe.h
@@ -18,22 +18,20 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_WINEXE_PE_H
#define COMMON_WINEXE_PE_H
-#include "common/array.h"
+#include "common/hash-str.h"
#include "common/hashmap.h"
+#include "common/str.h"
#include "common/winexe.h"
namespace Common {
+template<class T> class Array;
class SeekableReadStream;
-class String;
/** The default Windows PE resources. */
enum PEResourceType {
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp
index b53a9a33c2..9bd052fb3d 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -18,13 +18,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
+// FIXME: Avoid using fprintf
+#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
+
+// FIXME: Avoid using vfprintf
+#define FORBIDDEN_SYMBOL_EXCEPTION_vfprintf
+
+
#include "common/xmlparser.h"
-#include "common/util.h"
#include "common/archive.h"
#include "common/fs.h"
#include "common/memstream.h"
diff --git a/common/xmlparser.h b/common/xmlparser.h
index ec8f371681..84fca294a0 100644
--- a/common/xmlparser.h
+++ b/common/xmlparser.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef XML_PARSER_H
@@ -29,6 +26,7 @@
#include "common/scummsys.h"
#include "common/types.h"
+#include "common/fs.h"
#include "common/list.h"
#include "common/hashmap.h"
#include "common/hash-str.h"
@@ -37,7 +35,6 @@
namespace Common {
-class FSNode;
class SeekableReadStream;
#define MAX_XML_DEPTH 8
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 98ecc10c1d..b047586af0 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -18,11 +18,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
+// Disable symbol overrides so that we can use zlib.h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/zlib.h"
#include "common/util.h"
#include "common/stream.h"
diff --git a/common/zlib.h b/common/zlib.h
index 641d4553cf..1925034310 100644
--- a/common/zlib.h
+++ b/common/zlib.h
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#ifndef COMMON_ZLIB_H