[Scummvm-cvs-logs] CVS: tools extract.c,1.34,1.35 simon2mp3.c,1.23,1.24

Max Horn fingolfin at users.sourceforge.net
Sun Nov 9 15:53:03 CET 2003


Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv25087

Modified Files:
	extract.c simon2mp3.c 
Log Message:
get rid of get_string

Index: extract.c
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- extract.c	9 Nov 2003 23:45:44 -0000	1.34
+++ extract.c	9 Nov 2003 23:52:39 -0000	1.35
@@ -77,18 +77,6 @@
 	exit(-1);
 }
 
-void get_string(uint32 size, char buf[])
-{
-	uint32 i = 0;
-	while (i < size) {
-		int c = fgetc(input);
-		if (c == EOF)
-			end_of_file();
-		buf[i++] = c;
-	}
-	buf[i] = '\0';
-}
-
 void append_byte(int size, char buf[])
 {
 	int i;
@@ -114,8 +102,8 @@
 	uint32 tags;
 
 	/* The VCTL header */
-	get_string(4, buf);
-	while (strncmp(buf, "VCTL", 4)) {
+	readString(4, buf, input);
+	while (memcmp(buf, "VCTL", 4)) {
 		pos++;
 		append_byte(4, buf);
 	}
@@ -132,11 +120,11 @@
 		tags--;
 	}
 
-	get_string(8, buf);
+	readString(8, buf, input);
 	if (!memcmp(buf, "Creative", 8)) {
-		get_string(18, buf);
+		readString(18, buf, input);
 	} else if (!memcmp(buf, "VTLK", 4)) {
-		get_string(26, buf);
+		readString(26, buf, input);
 	} else {
 		error("Unexpected data encountered");
 	}
@@ -225,7 +213,7 @@
 	}
 	
 	/* Get the 'SOU ....' header */
-	get_string(8, buf);
+	readString(8, buf, input);
 	if (strncmp(buf, f_hdr, 8)) {
 		printf("Bad SOU\n");
 		exit(-1);

Index: simon2mp3.c
===================================================================
RCS file: /cvsroot/scummvm/tools/simon2mp3.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- simon2mp3.c	9 Nov 2003 23:46:58 -0000	1.23
+++ simon2mp3.c	9 Nov 2003 23:52:39 -0000	1.24
@@ -66,22 +66,12 @@
 	exit(0);
 }
 
-void get_string(int size)
-{
-	int i = 0;
-	while (i < size) {
-		int c = fgetc(input);
-		buf[i++] = c;
-	}
-	buf[i] = '\0';
-}
-
 int get_offsets(void)
 {
 	int i;
 
 	for (i = 0;; i++) {
-		get_string(8);
+		readString(8, buf, input);
 		if (!memcmp(buf, "Creative", 8) || !memcmp(buf, "RIFF", 4)) {
 			return(i);
 		}
@@ -116,10 +106,10 @@
 
 	fseek(input, offsets[sound], SEEK_SET);
 
-	get_string(8);
+	readString(8, buf, input);
 	if (!memcmp(buf, "Creative", 8)) {
 		printf("VOC found (pos = %d) :\n", offsets[sound]);
-		get_string(18);
+		readString(18, buf, input);
 		get_voc();
 	} else if (!memcmp(buf, "RIFF", 4)) {
 		printf("WAV found (pos = %d) :\n", offsets[sound]);





More information about the Scummvm-git-logs mailing list