[xiph-commits] r8557 - trunk/oggdsf/src/lib/core/ogg/libOOOgg

ozone at motherfish-iii.xiph.org ozone at motherfish-iii.xiph.org
Thu Dec 30 03:04:42 PST 2004


Author: ozone
Date: 2004-12-30 03:04:41 -0800 (Thu, 30 Dec 2004)
New Revision: 8557

Modified:
   trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp
Log:
oggdsf:
 * Hex-dumping an Ogg packet only displays printable characters now (ASCII 32-126, inclusive)


Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp	2004-12-30 05:19:53 UTC (rev 8556)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp	2004-12-30 11:04:41 UTC (rev 8557)
@@ -137,7 +137,7 @@
 }
 string OggPacket::dumpNCharsToString(unsigned char* inStartPoint, unsigned long inNumChars) {
 	//NOTE::: Also needs reworking
-	const unsigned char BELL = 7;
+	//const unsigned char BELL = 7;  // unused
 	//Set the fill character back to space ' '
 	//cout << setfill(' ');
 
@@ -151,13 +151,13 @@
 	//Loop through the characters
 	for (unsigned long i = 0; i < inNumChars; i++) {
 
-		//If they are *not* going to mess up the layout (\r, \n or \t or bell(7))
-		if ( (inStartPoint[i] != '\n') && (inStartPoint[i] != '\r') && (inStartPoint[i] != '\t') && (inStartPoint[i] != BELL )) {
+		//If they are *not* going to mess up the layout (i.e. the thing is printable)
+		if ( (inStartPoint[i] >= 32) && (inStartPoint[i] <= 126) ) {
 			//Write them out
 			retStr += (char)inStartPoint[i];						
 		} else {
-			//Otherwise just write a null char
-			retStr += ((char) 0);
+			//Otherwise just write a placeholder char
+			retStr += ((char) '.');
 		}
 	}
 	retStr += "\n";



More information about the commits mailing list