[Scummvm-cvs-logs] CVS: scummvm stdafx.h,1.16,1.17 system.h,1.21,1.22 sound.cpp,1.95,1.96

Lionel Ulmer bbrox at users.sourceforge.net
Sun Jun 2 13:29:01 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv15442

Modified Files:
	stdafx.h system.h sound.cpp 
Log Message:
Small warning fix + double inclusion protection (can always be useful
:) ).



Index: stdafx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/stdafx.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- stdafx.h	5 May 2002 20:04:25 -0000	1.16
+++ stdafx.h	2 Jun 2002 20:28:09 -0000	1.17
@@ -2,6 +2,10 @@
  * $Id$
  *
  * $Log$
+ * Revision 1.17  2002/06/02 20:28:09  bbrox
+ * Small warning fix + double inclusion protection (can always be useful
+ * :) ).
+ *
  * Revision 1.16  2002/05/05 20:04:25  fingolfin
  * cleaning up the mess drigo left... <sigh>
  *
@@ -42,6 +46,9 @@
  *
  */
 
+#ifndef _STDAFX_H
+#define _STDAFX_H
+
 #if defined(NONSTANDARD_PORT)
 
 #include <portdefs.h>
@@ -150,3 +157,4 @@
 #endif
 #endif
 
+#endif

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/system.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- system.h	14 May 2002 19:38:28 -0000	1.21
+++ system.h	2 Jun 2002 20:28:09 -0000	1.22
@@ -20,6 +20,9 @@
  *
  */
 
+#ifndef _SYSTEM_H
+#define _SYSTEM_H
+
 /* Interface to what's below ScummVM */
 
 class OSystem {
@@ -178,3 +181,5 @@
 	GD_MAC,
 	GD_DC
 };
+
+#endif 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- sound.cpp	19 May 2002 20:38:53 -0000	1.95
+++ sound.cpp	2 Jun 2002 20:28:09 -0000	1.96
@@ -89,7 +89,7 @@
 				);
 #endif
 			if ((_gameId == GID_DIG) && ((data[0] == 12) || (data[0] == 14))){
-				uint32 size, rate, tag, chan, bits;
+				uint32 size = 0, rate = 0, tag, chan = 0, bits = 0;
 				uint8 * ptr = getResourceAddress(rtSound, data[1]);
 				if (ptr != NULL) {
 					ptr+=16;       /* Skip header */
@@ -125,8 +125,7 @@
 						else if (chan == 2) {
 							_mixer->play_raw(NULL, buffer, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_STEREO);
 						}
-					}
-					if (bits == 12) {
+					} else if (bits == 12) {
 						uint32 s_size = (size * 4) / 3;
 						byte * buffer = (byte*)malloc (s_size + 4);
 						uint32 l = 0, r = 0, tmp;
@@ -853,7 +852,7 @@
 	{	/* Parse decompressed data */
 		int rate = 22050;
 		byte *ptr = CompFinal;
-		int tag, size;
+		int tag, size = -1;
 		tag = READ_BE_UINT32(ptr); ptr+=4;
 		if (tag != MKID_BE('iMUS')) {
 			warning("Decompression of bundle sound failed");
@@ -884,6 +883,11 @@
 			}
 		}
 
+		if (size < 0) {
+			warning("Decompression of bundle sound failed (no size field)");
+			free(CompFinal);
+			return;
+		}
 		Final = (unsigned char *)malloc(size);
 		memcpy(&Final[0], &ptr[0], size);
 		_mixer->play_raw(NULL, Final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);





More information about the Scummvm-git-logs mailing list