gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash/libbase log.h log.cpp


From: Rob Savoye
Subject: [Gnash-commit] gnash/libbase log.h log.cpp
Date: Sat, 12 Aug 2006 21:24:51 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    06/08/12 21:24:51

Modified files:
        libbase        : log.h log.cpp 

Log message:
        Add extra paramater for ascii dumps from hexify.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.cpp?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: log.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- log.h       8 Aug 2006 10:51:36 -0000       1.13
+++ log.h       12 Aug 2006 21:24:51 -0000      1.14
@@ -166,7 +166,7 @@
 };
 
 
-unsigned char *hexify(unsigned char *p, const unsigned char *s, int length);
+unsigned char *hexify(unsigned char *p, const unsigned char *s, int length, 
bool ascii);
 
 // Printf-style interfaces.
 #if defined(_WIN32) || defined(WIN32)

Index: log.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- log.cpp     8 Aug 2006 10:51:36 -0000       1.18
+++ log.cpp     12 Aug 2006 21:24:51 -0000      1.19
@@ -77,21 +77,33 @@
 bool LogFile::_parserdump = false;
 
 // Workspace for vsnprintf formatting.
-static const int BUFFER_SIZE = 1024;
+static const int BUFFER_SIZE = 2048;
 
 // Convert each byte into it's hex represntation
 static const char hexchars[]="0123456789abcdef";
 unsigned char *
-hexify(unsigned char *p, const unsigned char *s, int length) {
+hexify(unsigned char *p, const unsigned char *s, int length, bool ascii) {
     int i;
     unsigned char *p1 = p;
 
     // convert some characters so it'll look right in the log
     for (i=0 ; i<length; i++) {
         // use the hex value
+       if (isprint(s[i]) && ascii) {
+           if (i>1) {
+               if (!isprint(s[i-1])) {
+                   *p++ = ' ';
+               }
+           }
+           *p++ = s[i];
+           if (!isprint(s[i+1])) {
+               *p++ = ' ';
+           }
+       } else {
         *p++ = hexchars[s[i] >> 4];
         *p++ = hexchars[s[i] & 0xf];
     }
+    }
 
     *p = '\0';
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]