[Scummvm-cvs-logs] scummvm master -> 59dde5451908de79a89ee29937f3878cf221cc93

lordhoto lordhoto at gmail.com
Sat Jan 26 14:26:16 CET 2013


This automated email contains information about 14 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ff7a34aec5 SCUMM: Silence C++11 narrowing warnings.
b27736fc3f SKY: Silence C++11 narrowing warnings.
fa967e92b7 AGI: Silence C++11 narrowing warning.
7b18d4a468 PEGASUS: Silence C++11 narrowing warnings.
3d9d7ab4f8 SAGA: Silence C++11 narrowing warnings.
fe1a779441 SWORD25: Silence C++11 narrowing warnings.
0a495f7faa OPENGL: Silence C++11 narrowing warning.
9f22d60adf SDL: Silence C++ narrowing warnings.
0e3f8d68c4 VIDEO: Silence C++11 narrowing warnings.
cc0b8594ce AUDIO: Silence C++11 narrowing warnings.
d198ccac26 CONFIGURE: Add option to build as C++11.
178365f5e9 COMMON: Add a header for C++11 keywords for pre-C++11 compilers.
4d3ecbfcd2 KYRA: Use override in subclasses of Sound, which override voicePlay.
59dde54519 Merge pull request #301 from lordhoto/c++11-playground


Commit: ff7a34aec53aef060db50c45eaeaec611eb8c31d
    https://github.com/scummvm/scummvm/commit/ff7a34aec53aef060db50c45eaeaec611eb8c31d
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
SCUMM: Silence C++11 narrowing warnings.

Changed paths:
    engines/scumm/saveload.h



diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index 4bfa7d0..7b2ff91 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -74,7 +74,7 @@ namespace Scumm {
  * what POD means refer to <http://en.wikipedia.org/wiki/Plain_Old_Data_Structures> or
  * to <http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=32&rl=1>)
  */
-#define OFFS(type,item) (((ptrdiff_t)(&((type *)42)->type::item))-42)
+#define OFFS(type,item) ((uint32)(((ptrdiff_t)(&((type *)42)->type::item))-42))
 
 /**
  * Similar to the OFFS macro, this macro computes the size (in bytes) of a
@@ -84,19 +84,19 @@ namespace Scumm {
 
 // Any item that is still in use automatically gets a maxVersion equal to CURRENT_VER
 #define MKLINE(type,item,saveas,minVer) {OFFS(type,item),saveas,SIZE(type,item),minVer,CURRENT_VER}
-#define MKARRAY(type,item,saveas,dim,minVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,CURRENT_VER}, {dim,1,0,0,0}
-#define MKARRAY2(type,item,saveas,dim,dim2,rowlen,minVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,CURRENT_VER}, {dim,dim2,rowlen,0,0}
+#define MKARRAY(type,item,saveas,dim,minVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,CURRENT_VER}, {(uint32)(dim),1,0,0,0}
+#define MKARRAY2(type,item,saveas,dim,dim2,rowlen,minVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,CURRENT_VER}, {(uint32)(dim),(uint32)(dim2),(uint16)(rowlen),0,0}
 
 // Use this if you have an entry that used to be smaller:
 #define MKLINE_OLD(type,item,saveas,minVer,maxVer) {OFFS(type,item),saveas,SIZE(type,item),minVer,maxVer}
-#define MKARRAY_OLD(type,item,saveas,dim,minVer,maxVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,maxVer}, {dim,1,0,0,0}
-#define MKARRAY2_OLD(type,item,saveas,dim,dim2,rowlen,minVer,maxVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,maxVer}, {dim,dim2,rowlen,0,0}
+#define MKARRAY_OLD(type,item,saveas,dim,minVer,maxVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,maxVer}, {(uint32)(dim),1,0,0,0}
+#define MKARRAY2_OLD(type,item,saveas,dim,dim2,rowlen,minVer,maxVer) {OFFS(type,item),128|saveas,SIZE(type,item),minVer,maxVer}, {(uint32)(dim),(uint32)(dim2),(uint16)(rowlen),0,0}
 
 // An obsolete item/array, to be ignored upon load. We retain the type/item params to make it easier to debug.
 // Obsolete items have size == 0.
 #define MK_OBSOLETE(type,item,saveas,minVer,maxVer) {0,saveas,0,minVer,maxVer}
-#define MK_OBSOLETE_ARRAY(type,item,saveas,dim,minVer,maxVer) {0,128|saveas,0,minVer,maxVer}, {dim,1,0,0,0}
-#define MK_OBSOLETE_ARRAY2(type,item,saveas,dim,dim2,rowlen,minVer,maxVer) {0,128|saveas,0,minVer,maxVer}, {dim,dim2,rowlen,0,0}
+#define MK_OBSOLETE_ARRAY(type,item,saveas,dim,minVer,maxVer) {0,128|saveas,0,minVer,maxVer}, {(uint32)(dim),1,0,0,0}
+#define MK_OBSOLETE_ARRAY2(type,item,saveas,dim,dim2,rowlen,minVer,maxVer) {0,128|saveas,0,minVer,maxVer}, {(uint32)(dim),(uint32)(dim2),(uint16)(rowlen),0,0}
 
 // End marker
 #define MKEND() {0xFFFF,0xFF,0xFF,0,0}


Commit: b27736fc3f84d061c15795b1d72c989857596c2d
    https://github.com/scummvm/scummvm/commit/b27736fc3f84d061c15795b1d72c989857596c2d
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
SKY: Silence C++11 narrowing warnings.

Changed paths:
    engines/sky/compact.cpp



diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp
index cf9bd55..ee16593 100644
--- a/engines/sky/compact.cpp
+++ b/engines/sky/compact.cpp
@@ -34,7 +34,7 @@ namespace Sky {
 
 #define	SKY_CPT_SIZE	419427
 
-#define OFFS(type,item) (((ptrdiff_t)(&((type *)42)->item))-42)
+#define OFFS(type,item) ((uint32)(((ptrdiff_t)(&((type *)42)->item))-42))
 #define MK32(type,item) OFFS(type, item),0,0,0
 #define MK16(type,item) OFFS(type, item),0
 #define MK32_A5(type, item) MK32(type, item[0]), MK32(type, item[1]), \


Commit: fa967e92b72d1e76cc0775e626c552f5bd9d4d0b
    https://github.com/scummvm/scummvm/commit/fa967e92b72d1e76cc0775e626c552f5bd9d4d0b
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
AGI: Silence C++11 narrowing warning.

Changed paths:
    engines/agi/op_cmd.cpp



diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 5334407..9d899b1 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1399,7 +1399,7 @@ void cmdDistance(AgiGame *state, uint8 *p) {
 		// a zombie or the zombie getting turned away by the scarab) we make it appear the
 		// zombie is far away from Rosella if the zombie is not already up and chasing her.
 		enum zombieStates {ZOMBIE_SET_TO_RISE_UP, ZOMBIE_RISING_UP, ZOMBIE_CHASING_EGO};
-		uint8 zombieStateVarNumList[] = {155, 156, (_v[vCurRoom] == 16) ? 162 : 158};
+		uint8 zombieStateVarNumList[] = {155, 156, (uint8)((_v[vCurRoom] == 16) ? 162 : 158)};
 		uint8 zombieNum         = p2 - 221;                         // Zombie's number (In range 0-2)
 		uint8 zombieStateVarNum = zombieStateVarNumList[zombieNum]; // Number of the variable containing zombie's state
 		uint8 zombieState       = _v[zombieStateVarNum];            // Zombie's state


Commit: 7b18d4a4683b6d4ce9767c7c329cfa03d9dea6d7
    https://github.com/scummvm/scummvm/commit/7b18d4a4683b6d4ce9767c7c329cfa03d9dea6d7
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
PEGASUS: Silence C++11 narrowing warnings.

Changed paths:
    engines/pegasus/neighborhood/mars/reactor.cpp



diff --git a/engines/pegasus/neighborhood/mars/reactor.cpp b/engines/pegasus/neighborhood/mars/reactor.cpp
index 334fb98..3a7ef9d 100644
--- a/engines/pegasus/neighborhood/mars/reactor.cpp
+++ b/engines/pegasus/neighborhood/mars/reactor.cpp
@@ -244,9 +244,9 @@ void ReactorHistory::draw(const Common::Rect &) {
 	static const CoordType kColorTops[5] = {
 		0,
 		kColorHeights[0],
-		kColorHeights[0] + kColorHeights[1],
-		kColorHeights[0] + kColorHeights[1] + kColorHeights[2],
-		kColorHeights[0] + kColorHeights[1] + kColorHeights[2] + kColorHeights[3],
+		(CoordType)(kColorHeights[0] + kColorHeights[1]),
+		(CoordType)(kColorHeights[0] + kColorHeights[1] + kColorHeights[2]),
+		(CoordType)(kColorHeights[0] + kColorHeights[1] + kColorHeights[2] + kColorHeights[3]),
 	};
 
 	if (_colors.isSurfaceValid() && _digits.isSurfaceValid()) {


Commit: 3d9d7ab4f88ebeee914b423c21b70d410858f99f
    https://github.com/scummvm/scummvm/commit/3d9d7ab4f88ebeee914b423c21b70d410858f99f
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
SAGA: Silence C++11 narrowing warnings.

Changed paths:
    engines/saga/resource.cpp



diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index 1b0dfa2..8025a94 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -200,15 +200,15 @@ bool Resource::createContexts() {
 
 	//// Detect and add voice files /////////////////////////////////////////////
 	SoundFileInfo voiceFiles[] = {
-		{	GID_ITE,	"voices.rsc",					false	,	(_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0},
-		{	GID_ITE,	"voices.cmp",					true	,	(_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0},
-		{	GID_ITE,	"voicesd.rsc",					false	,	(_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0},
-		{	GID_ITE,	"voicesd.cmp",					true	,	(_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0},
+		{	GID_ITE,	"voices.rsc",					false	,	(uint16)((_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0)},
+		{	GID_ITE,	"voices.cmp",					true	,	(uint16)((_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0)},
+		{	GID_ITE,	"voicesd.rsc",					false	,	(uint16)((_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0)},
+		{	GID_ITE,	"voicesd.cmp",					true	,	(uint16)((_soundFileName[0] == 0) ? GAME_SOUNDFILE : 0)},
 		// The resources in the Wyrmkeep combined Windows/Mac/Linux CD version are little endian, but
 		// the voice file is big endian. If we got such a version with mixed files, mark this voice file
 		// as big endian
-		{	GID_ITE,	"inherit the earth voices",		false	,	_vm->isBigEndian() ? 0 : GAME_SWAPENDIAN},
-		{	GID_ITE,	"inherit the earth voices.cmp",	true	,	_vm->isBigEndian() ? 0 : GAME_SWAPENDIAN},
+		{	GID_ITE,	"inherit the earth voices",		false	,	(uint16)(_vm->isBigEndian() ? 0 : GAME_SWAPENDIAN)},
+		{	GID_ITE,	"inherit the earth voices.cmp",	true	,	(uint16)(_vm->isBigEndian() ? 0 : GAME_SWAPENDIAN)},
 		{	GID_ITE,	"ite voices.bin",				false	,	GAME_MACBINARY},
 #ifdef ENABLE_IHNM
 		{	GID_IHNM,	"voicess.res",					false	,	0},


Commit: fe1a7794417456403a4bd38b8ae3e627a86b892e
    https://github.com/scummvm/scummvm/commit/fe1a7794417456403a4bd38b8ae3e627a86b892e
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
SWORD25: Silence C++11 narrowing warnings.

Changed paths:
    engines/sword25/gfx/graphicengine.cpp



diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 6f5da32..216d801 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -376,10 +376,10 @@ bool GraphicEngine::saveThumbnailScreenshot(const Common::String &filename) {
 
 void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint color) {
 	lua_Number components[4] = {
-		(color >> 16) & 0xff,   // Rot
-		(color >> 8) & 0xff,    // Grün
-		color & 0xff,          // Blau
-		color >> 24,           // Alpha
+		(lua_Number)((color >> 16) & 0xff),   // Rot
+		(lua_Number)((color >> 8) & 0xff),    // Grün
+		(lua_Number)(color & 0xff),          // Blau
+		(lua_Number)(color >> 24),           // Alpha
 	};
 
 	lua_newtable(L);


Commit: 0a495f7faa35530510549ad6510783e993fb2b6f
    https://github.com/scummvm/scummvm/commit/0a495f7faa35530510549ad6510783e993fb2b6f
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
OPENGL: Silence C++11 narrowing warning.

Changed paths:
    backends/graphics/opengl/gltexture.cpp



diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp
index ce69dc4..48da7f8 100644
--- a/backends/graphics/opengl/gltexture.cpp
+++ b/backends/graphics/opengl/gltexture.cpp
@@ -177,10 +177,10 @@ void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
 
 	// Calculate the screen rect where the texture will be drawn
 	const GLshort vertices[] = {
-		x,      y,
-		x + w,  y,
-		x,      y + h,
-		x + w,  y + h,
+		x,                y,
+		(GLshort)(x + w), y,
+		x,                (GLshort)(y + h),
+		(GLshort)(x + w), (GLshort)(y + h),
 	};
 	glVertexPointer(2, GL_SHORT, 0, vertices); CHECK_GL_ERROR();
 


Commit: 9f22d60adf62843fac04255d79f1986cdb7fa28a
    https://github.com/scummvm/scummvm/commit/9f22d60adf62843fac04255d79f1986cdb7fa28a
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
SDL: Silence C++ narrowing warnings.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp



diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index fb964d6..02e58ab 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -968,7 +968,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
 	// If the shake position changed, fill the dirty area with blackness
 	if (_currentShakePos != _newShakePos ||
 		(_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
-		SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
+		SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_newShakePos * _videoMode.scaleFactor)};
 
 		if (_videoMode.aspectRatioCorrection && !_overlayVisible)
 			blackrect.h = real2Aspect(blackrect.h - 1) + 1;


Commit: 0e3f8d68c45c5208ace3439ba6859a30bc90c3ac
    https://github.com/scummvm/scummvm/commit/0e3f8d68c45c5208ace3439ba6859a30bc90c3ac
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
VIDEO: Silence C++11 narrowing warnings.

Changed paths:
    video/bink_decoder.cpp



diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index 1ece22c..45dec08 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -557,8 +557,8 @@ void BinkDecoder::BinkVideoTrack::initBundles() {
 		_bundles[i].dataEnd = _bundles[i].data + blocks * 64;
 	}
 
-	uint32 cbw[2] = { (_surface.w + 7) >> 3, (_surface.w  + 15) >> 4 };
-	uint32 cw [2] = {  _surface.w          ,  _surface.w        >> 1 };
+	uint32 cbw[2] = { (uint32)((_surface.w + 7) >> 3), (uint32)((_surface.w  + 15) >> 4) };
+	uint32 cw [2] = { (uint32)( _surface.w          ), (uint32)( _surface.w        >> 1) };
 
 	// Calculate the lengths of an element count in bits
 	for (int i = 0; i < 2; i++) {


Commit: cc0b8594ce402d7aae25a284381805216c615c39
    https://github.com/scummvm/scummvm/commit/cc0b8594ce402d7aae25a284381805216c615c39
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:24:37-08:00

Commit Message:
AUDIO: Silence C++11 narrowing warnings.

Changed paths:
    audio/softsynth/opl/mame.cpp



diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp
index c54f620..2db7d42 100644
--- a/audio/softsynth/opl/mame.cpp
+++ b/audio/softsynth/opl/mame.cpp
@@ -223,7 +223,7 @@ static int *ENV_CURVE;
 
 
 /* multiple table */
-#define ML(a) (int)(a * 2)
+#define ML(a) (uint)(a * 2)
 static const uint MUL_TABLE[16]= {
 /* 1/2, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 */
 	ML(0.50), ML(1.00), ML(2.00),  ML(3.00), ML(4.00), ML(5.00), ML(6.00), ML(7.00),


Commit: d198ccac2619b43671d39beac126342ea6d9cc64
    https://github.com/scummvm/scummvm/commit/d198ccac2619b43671d39beac126342ea6d9cc64
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:53:41-08:00

Commit Message:
CONFIGURE: Add option to build as C++11.

Changed paths:
    configure



diff --git a/configure b/configure
index b703776..91364eb 100755
--- a/configure
+++ b/configure
@@ -123,6 +123,7 @@ _libunity=auto
 _debug_build=auto
 _release_build=auto
 _optimizations=auto
+_use_cxx11=no
 _verbose_build=no
 _text_console=no
 _mt32emu=yes
@@ -870,6 +871,7 @@ Game engines:
     The values of <engine name> for these options are as follows:
 $engines_help
 Optional Features:
+  --enable-c++11           build as C++11 if the compiler allows that
   --disable-debug          disable building with debugging symbols
   --enable-Werror          treat warnings as errors
   --enable-release         enable building in release mode (this activates
@@ -1109,6 +1111,12 @@ for ac_option in $@; do
 	--backend=*)
 		_backend=`echo $ac_option | cut -d '=' -f 2`
 		;;
+	--enable-c++11)
+		_use_cxx11=yes
+		;;
+	--disable-c++11)
+		_use_cxx11=no
+		;;
 	--enable-debug)
 		_debug_build=yes
 		;;
@@ -1695,21 +1703,36 @@ if test "$cxx_verc_fail" = yes ; then
 fi
 
 #
+# Check whether the compiler supports C++11
+#
+have_cxx11=no
+cat > $TMPC << EOF
+int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; }
+EOF
+cc_check -std=c++11 && have_cxx11=yes
+if test "$_use_cxx11" = "yes" ; then
+	_use_cxx11=$have_cxx11
+fi
+
+#
 # Setup compiler specific CXXFLAGS now that we know the compiler version.
 # Foremost, this means enabling various warnings.
 # In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC.
 #
 if test "$have_gcc" = yes ; then
 	if test "$_cxx_major" -ge "3" ; then
-		case $_host_os in
-		# newlib-based system include files suppress non-C89 function
-		# declarations under __STRICT_ANSI__
-		amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince )
-			;;
-		*)
-			CXXFLAGS="$CXXFLAGS -ansi"
-			;;
-		esac
+		# Try to use ANSI mode when C++11 is disabled.
+		if test "$_use_cxx11" = "no" ; then
+			case $_host_os in
+			# newlib-based system include files suppress non-C89 function
+			# declarations under __STRICT_ANSI__
+			amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince )
+				;;
+			*)
+				CXXFLAGS="$CXXFLAGS -ansi"
+				;;
+			esac
+		fi
 		CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
 		add_line_to_config_mk 'HAVE_GCC3 = 1'
 		add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
@@ -1725,6 +1748,15 @@ elif test "$have_icc" = yes ; then
 	add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
 fi;
 
+#
+# Update status about C++11 mode
+#
+echo_n "Building as C++11... "
+if test "$_use_cxx11" = "yes" ; then
+	CXXFLAGS="$CXXFLAGS -std=c++11"
+fi
+echo $_use_cxx11
+
 # By default, we add -pedantic to the CXXFLAGS to catch some potentially
 # non-portable constructs, like use of GNU extensions.
 # However, some platforms use GNU extensions in system header files, so


Commit: 178365f5e934ef7b5866a0cae244c5a4f0ab0344
    https://github.com/scummvm/scummvm/commit/178365f5e934ef7b5866a0cae244c5a4f0ab0344
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:53:41-08:00

Commit Message:
COMMON: Add a header for C++11 keywords for pre-C++11 compilers.

This currently adds defines for nullptr and override, so we can use them in
pre-C++11 compilers, while taking advantage of them with C++11 compilers.

Changed paths:
  A common/c++11-compat.h
    common/scummsys.h



diff --git a/common/c++11-compat.h b/common/c++11-compat.h
new file mode 100644
index 0000000..50d79bd
--- /dev/null
+++ b/common/c++11-compat.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * 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.
+ *
+ */
+
+#ifndef COMMON_CPP11_COMPAT_H
+#define COMMON_CPP11_COMPAT_H
+
+#if __cplusplus >= 201103L
+#error "c++11-compat.h included when C++11 is available"
+#endif
+
+//
+// Custom nullptr replacement. This is not type safe as the real C++11 nullptr
+// though.
+//
+#define nullptr 0
+
+//
+// Replacement for the override keyword. This allows compilation of code
+// which uses it, but does not feature any semantic.
+//
+#define override
+
+#endif
diff --git a/common/scummsys.h b/common/scummsys.h
index 2f4efe7..cd8a949 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -144,7 +144,10 @@
 	#endif
 #endif
 
-
+// Include our C++11 compatability header for pre-C++11 compilers.
+#if __cplusplus < 201103L
+#include "common/c++11-compat.h"
+#endif
 
 // Use config.h, generated by configure
 #if defined(HAVE_CONFIG_H)


Commit: 4d3ecbfcd2aabf0885df978e6e44ef8b8256c657
    https://github.com/scummvm/scummvm/commit/4d3ecbfcd2aabf0885df978e6e44ef8b8256c657
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-08T22:53:41-08:00

Commit Message:
KYRA: Use override in subclasses of Sound, which override voicePlay.

Changed paths:
    engines/kyra/sound_intern.h



diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h
index 4bf43d7..007ca3d 100644
--- a/engines/kyra/sound_intern.h
+++ b/engines/kyra/sound_intern.h
@@ -183,7 +183,7 @@ public:
 	virtual void haltTrack();
 	virtual void beginFadeOut();
 
-	virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool isSfx) { return -1; }
+	virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool isSfx) override { return -1; }
 	virtual void playSoundEffect(uint8 track, uint8 volume = 0xFF);
 
 	virtual void updateVolumeSettings();
@@ -219,7 +219,7 @@ public:
 	virtual void haltTrack();
 	virtual void beginFadeOut();
 
-	virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume = 255, uint8 priority = 255, bool isSfx = true);
+	virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume = 255, uint8 priority = 255, bool isSfx = true) override;
 	virtual void playSoundEffect(uint8 track, uint8 volume = 0xFF);
 
 	virtual void updateVolumeSettings();
@@ -334,7 +334,7 @@ public:
 	virtual void haltTrack();
 	virtual void beginFadeOut();
 
-	virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool isSfx) { return -1; }
+	virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool isSfx) override { return -1; }
 	virtual void playSoundEffect(uint8 track, uint8 volume = 0xFF);
 
 protected:


Commit: 59dde5451908de79a89ee29937f3878cf221cc93
    https://github.com/scummvm/scummvm/commit/59dde5451908de79a89ee29937f3878cf221cc93
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2013-01-26T05:25:14-08:00

Commit Message:
Merge pull request #301 from lordhoto/c++11-playground

RFC: Allow use of override and nullptr. Also allow C++11 compilation.

Changed paths:
  A common/c++11-compat.h
    audio/softsynth/opl/mame.cpp
    backends/graphics/opengl/gltexture.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    common/scummsys.h
    configure
    engines/agi/op_cmd.cpp
    engines/kyra/sound_intern.h
    engines/pegasus/neighborhood/mars/reactor.cpp
    engines/saga/resource.cpp
    engines/scumm/saveload.h
    engines/sky/compact.cpp
    engines/sword25/gfx/graphicengine.cpp
    video/bink_decoder.cpp









More information about the Scummvm-git-logs mailing list