Ignore:
Timestamp:
Jul 20, 2011, 11:48:57 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

QProcess: Make qt_prettyDebug() global instead of cloning it.

This also fixes the bug in the cloned copy that would always print the whole buffer regardless of the maximum size limitation passed in.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qprocess_os2.cpp

    r761 r902  
    5757#include <qthread.h>
    5858
    59 /*
    60     Returns a human readable representation of the first \a len
    61     characters in \a data.
    62 */
    6359QT_BEGIN_NAMESPACE
    64 static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
    65 {
    66     if (!data) return "(null)";
    67     QByteArray out;
    68     for (int i = 0; i < len; ++i) {
    69         char c = data[i];
    70         if (isprint(c)) {
    71             out += c;
    72         } else switch (c) {
    73         case '\n': out += "\\n"; break;
    74         case '\r': out += "\\r"; break;
    75         case '\t': out += "\\t"; break;
    76         default:
    77             QString tmp;
    78             tmp.sprintf("\\%o", c);
    79             out += tmp.toLatin1();
    80         }
    81     }
    82 
    83     if (len < maxSize)
    84         out += "...";
    85 
    86     return out;
    87 }
     60
     61// defined in qprocess.cpp
     62extern QByteArray qt_prettyDebug(const char *data, int len, int maxSize);
    8863
    8964// redirect qDebug output to a file in the root directory of the current drive
Note: See TracChangeset for help on using the changeset viewer.