aboutsummaryrefslogtreecommitdiff
path: root/sound/decoders
diff options
context:
space:
mode:
authorMax Horn2010-10-30 21:27:42 +0000
committerMax Horn2010-10-30 21:27:42 +0000
commit44393b2dc8ba78342dcbb7df39eca2e9e1f6e429 (patch)
treeb5b2d7013d64ca317072453a7fbbc391174e2851 /sound/decoders
parentff34a778318355ffba2ee5700524fccba9fe5cf3 (diff)
downloadscummvm-rg350-44393b2dc8ba78342dcbb7df39eca2e9e1f6e429.tar.gz
scummvm-rg350-44393b2dc8ba78342dcbb7df39eca2e9e1f6e429.tar.bz2
scummvm-rg350-44393b2dc8ba78342dcbb7df39eca2e9e1f6e429.zip
ALL: Add code to help stop people from accidentally using "bad" APIs
A new header file common/forbidden.h is included by scummsys.h and it re-#defines numerous symbols like fopen(), fread(), system(), etc. with garbage, in order to provoke compile errors in any code using them. If a .cpp file really *must* use any of these (e.g. because it is a backend file), then these redefinitions can be disabled by #defining FORBIDDEN_SYMBOL_ALLOW_ALL as the first thing in the .cpp file. Whenever this is done, an explanatory comment should be added. Note that this system cannot catch all "bad" usages (notably the Lua code in the sword25 engine), as it can only work if scummsys.h is included. svn-id: r53961
Diffstat (limited to 'sound/decoders')
-rw-r--r--sound/decoders/flac.cpp3
-rw-r--r--sound/decoders/vorbis.cpp5
2 files changed, 8 insertions, 0 deletions
diff --git a/sound/decoders/flac.cpp b/sound/decoders/flac.cpp
index d01e0d0a79..65f3306106 100644
--- a/sound/decoders/flac.cpp
+++ b/sound/decoders/flac.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides for FILE as that is used in FLAC headers
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+
#include "sound/decoders/flac.h"
#ifdef USE_FLAC
diff --git a/sound/decoders/vorbis.cpp b/sound/decoders/vorbis.cpp
index 7673c53010..ee31bbc38d 100644
--- a/sound/decoders/vorbis.cpp
+++ b/sound/decoders/vorbis.cpp
@@ -23,6 +23,11 @@
*
*/
+// Disable symbol overrides for FILE and fseek as those are used in the
+// Vorbis headers.
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#define FORBIDDEN_SYMBOL_EXCEPTION_fseek
+
#include "sound/decoders/vorbis.h"
#ifdef USE_VORBIS