Some g++ fixes again. "new" is a reserved keyword, a few casts, and I've
moved OggVorbisDecoderState into oggvorbis.h, there was a linker error
when it was typedeffed to void in some cases. Don't know why it was done
that way, still works for me now. I've removed an #ifdef WZ_NOOGG, but
./configure --disable-ogg was broken before anyway.

Additionally, g++ complains about keymap.c:734: warning: comparison
between ‘enum KEY_CODE’ and ‘enum SDLKey’, this looks kind of fishy,
though I can't investigate further right now...

-- 
There is never time to do it right, but always time to do it over.
=== lib/ivis_common/imdload.c
==================================================================
--- lib/ivis_common/imdload.c	(revision 1710)
+++ lib/ivis_common/imdload.c	(local)
@@ -371,11 +371,11 @@
 {
 	char *pFileData = *ppFileData;
 	int cnt, i, j, lastPoint = 0, match = -1;
-	Vector3f new = {0.0f, 0.0f, 0.0f};
+	Vector3f newV = {0.0f, 0.0f, 0.0f};
 
 	for (i = 0; i < s->npoints; i++)
 	{
-		if (sscanf(pFileData, "%f %f %f%n", &new.x, &new.y, &new.z, &cnt) != 3)
+		if (sscanf(pFileData, "%f %f %f%n", &newV.x, &newV.y, &newV.z, &cnt) != 3)
 		{
 			iV_Error(0xff, "(_load_points) file corrupt -K");
 			return FALSE;
@@ -388,7 +388,7 @@
 		// scan through list upto the number of points added (lastPoint) ... not up to the number of points scanned in (i)  (which will include duplicates)
 		for (j = 0; j < lastPoint; j++)
 		{
-			if (Vector3f_compare(&new, &s->points[j]))
+			if (Vector3f_compare(&newV, &s->points[j]))
 			{
 				match = j;
 				break;
@@ -399,9 +399,9 @@
 		if (match == -1)
 		{
 			// new point
-			s->points[lastPoint].x = new.x;
-			s->points[lastPoint].y = new.y;
-			s->points[lastPoint].z = new.z;
+			s->points[lastPoint].x = newV.x;
+			s->points[lastPoint].y = newV.y;
+			s->points[lastPoint].z = newV.z;
 			vertexTable[i] = lastPoint;
 			lastPoint++;
 		}
@@ -659,7 +659,7 @@
 {
 	char *pFileData = *ppFileData;
 	int cnt, i;
-	Vector3f *p = NULL, new = {0.0f, 0.0f, 0.0f};
+	Vector3f *p = NULL, newV = {0.0f, 0.0f, 0.0f};
 
 	s->connectors = (Vector3f*)malloc(sizeof(Vector3f) * s->nconnectors);
 	if (s->connectors == NULL)
@@ -670,13 +670,13 @@
 
 	for (i = 0, p = s->connectors; i < s->nconnectors; i++, p++)
 	{
-		if (sscanf(pFileData, "%f %f %f%n", &new.x, &new.y, &new.z, &cnt) != 3)
+		if (sscanf(pFileData, "%f %f %f%n", &newV.x, &newV.y, &newV.z, &cnt) != 3)
 		{
 			iV_Error(0xff, "(_load_connectors) file corrupt -M");
 			return FALSE;
 		}
 		pFileData += cnt;
-		*p = new;
+		*p = newV;
 	}
 
 	*ppFileData = pFileData;
=== lib/sound/oggvorbis.c
==================================================================
--- lib/sound/oggvorbis.c	(revision 1710)
+++ lib/sound/oggvorbis.c	(local)
@@ -17,12 +17,10 @@
 	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
 
-#include "lib/framework/frame.h"
 #include <physfs.h>
 
-#ifndef WZ_NOOGG
-#include <vorbis/vorbisfile.h>
-#endif
+#include "lib/framework/frame.h"
+#include "oggvorbis.h"
 
 #ifdef __BIG_ENDIAN__
 #define OGG_ENDIAN 1
@@ -30,24 +28,6 @@
 #define OGG_ENDIAN 0
 #endif
 
-typedef struct
-{
-    // Internal identifier towards PhysicsFS
-    PHYSFS_file* fileHandle;
-
-    // Wether to allow seeking or not
-    BOOL         allowSeeking;
-
-    // Internal identifier towards libVorbisFile
-    OggVorbis_File oggVorbis_stream;
-
-    // Internal meta data
-    vorbis_info* VorbisInfo;
-} OggVorbisDecoderState;
-
-#define _LIBSOUND_OGGVORBIS_C_
-#include "oggvorbis.h"
-
 static size_t wz_oggVorbis_read(void *ptr, size_t size, size_t nmemb, void *datasource)
 {
     PHYSFS_file* fileHandle = ((OggVorbisDecoderState*)datasource)->fileHandle;
@@ -194,7 +174,7 @@
 		return NULL;
 	}
 
-	buffer = malloc(bufferSize + sizeof(soundDataBuffer));
+	buffer = (soundDataBuffer*) malloc(bufferSize + sizeof(soundDataBuffer));
 	if (buffer == NULL)
 	{
 		debug(LOG_ERROR, "sound_DecodeOggVorbis: couldn't allocate memory (%u bytes requested)\n", bufferSize + sizeof(soundDataBuffer));
=== lib/sound/oggvorbis.h
==================================================================
--- lib/sound/oggvorbis.h	(revision 1710)
+++ lib/sound/oggvorbis.h	(local)
@@ -20,8 +20,10 @@
 #ifndef _LIBSOUND_OGGVORBIS_H_
 #define _LIBSOUND_OGGVORBIS_H_
 
+#include <physfs.h>
+#include <vorbis/vorbisfile.h>
+
 #include "lib/framework/frame.h"
-#include <physfs.h>
 #include "track.h"
 
 typedef struct
@@ -40,10 +42,21 @@
 	unsigned int frequency;
 } soundDataBuffer;
 
-#ifndef _LIBSOUND_OGGVORBIS_C_
-typedef void OggVorbisDecoderState;
-#endif
+typedef struct
+{
+    // Internal identifier towards PhysicsFS
+    PHYSFS_file* fileHandle;
 
+    // Wether to allow seeking or not
+    BOOL         allowSeeking;
+
+    // Internal identifier towards libVorbisFile
+    OggVorbis_File oggVorbis_stream;
+
+    // Internal meta data
+    vorbis_info* VorbisInfo;
+} OggVorbisDecoderState;
+
 OggVorbisDecoderState* sound_CreateOggVorbisDecoder(PHYSFS_file* PHYSFS_fileHandle, BOOL allowSeeking);
 void sound_DestroyOggVorbisDecoder(OggVorbisDecoderState* decoder);
 
=== src/scriptfuncs.c
==================================================================
--- src/scriptfuncs.c	(revision 1710)
+++ src/scriptfuncs.c	(local)
@@ -11134,7 +11134,7 @@
 	}
 
 	scrFunctionResult.v.oval = getTileStructure(structureX, structureY);
-	if (!stackPushResult(ST_STRUCTURE, &scrFunctionResult))
+	if (!stackPushResult((INTERP_TYPE)ST_STRUCTURE, &scrFunctionResult))
 	{
 		debug(LOG_ERROR, "scrGetTileStructure(): failed to push result");
 		return FALSE;
=== src/scripttabs.c
==================================================================
--- src/scripttabs.c	(revision 1710)
+++ src/scripttabs.c	(local)
@@ -1367,7 +1367,7 @@
 		3, { VAL_INT, VAL_INT, VAL_INT },
 		0, 0, NULL, 0, 0, NULL, NULL },
 
-	{ "getTileStructure",		scrGetTileStructure,		ST_STRUCTURE,
+	{ "getTileStructure",		scrGetTileStructure,		(INTERP_TYPE)ST_STRUCTURE,
 		2, { VAL_INT, VAL_INT },
 		0, 0, NULL, 0, 0, NULL, NULL },
 
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to