[Scummvm-cvs-logs] CVS: scummvm/common util.cpp,1.12,1.13 util.h,1.13,1.14

Max Horn fingolfin at users.sourceforge.net
Sun May 4 06:55:38 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv18291

Modified Files:
	util.cpp util.h 
Log Message:
hexdump defaults to 16 bytes/line now, and prints an offest

Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- util.cpp	2 May 2003 21:29:05 -0000	1.12
+++ util.cpp	4 May 2003 13:46:06 -0000	1.13
@@ -102,9 +102,14 @@
 	assert(1 <= bytes_per_line && bytes_per_line <= 32);
 	int i;
 	byte c;
+	int offset = 0;
 	while (len >= bytes_per_line) {
-		for (i = 0; i < bytes_per_line; i++)
+		printf("%06x: ", offset);
+		for (i = 0; i < bytes_per_line; i++) {
 			printf("%02x ", data[i]);
+			if (i % 4 == 3)
+				printf(" ");
+		}
 		printf(" |");
 		for (i = 0; i < bytes_per_line; i++) {
 			c = data[i];
@@ -115,13 +120,18 @@
 		printf("|\n");
 		data += bytes_per_line;
 		len -= bytes_per_line;
+		offset += bytes_per_line;
 	}
 
 	if (len <= 0) 
 		return;
 
-	for (i = 0; i < len; i++)
+	printf("%06x: ", offset);
+	for (i = 0; i < len; i++) {
 		printf("%02x ", data[i]);
+		if (i % 4 == 3)
+			printf(" ");
+	}
 	for (; i < bytes_per_line; i++)
 		printf("   ");
 	printf(" |");

Index: util.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- util.h	2 May 2003 21:29:05 -0000	1.13
+++ util.h	4 May 2003 13:46:06 -0000	1.14
@@ -45,7 +45,7 @@
 /*
  * Print hexdump of the data passed in
  */
-void hexdump(const byte * data, int len, int bytes_per_line = 8);
+void hexdump(const byte * data, int len, int bytes_per_line = 16);
 
 class RandomSource {
 private:





More information about the Scummvm-git-logs mailing list