//#define QPROCESS_DEBUG
-#if defined QPROCESS_DEBUG
-
-#include <ctype.h>
-
-QT_BEGIN_NAMESPACE
-/*
- Returns a human readable representation of the first \a len
- characters in \a data.
-*/
-static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
-{
- if (!data) return "(null)";
- QByteArray out;
- for (int i = 0; i < len && i < maxSize; ++i) {
- char c = data[i];
- if (isprint(c)) {
- out += c;
- } else switch (c) {
- case '\n': out += "\\n"; break;
- case '\r': out += "\\r"; break;
- case '\t': out += "\\t"; break;
- default:
- QSTACKARRAY(char, buf, 5);
- qsnprintf(buf, sizeof(buf), "\\%3o", c);
- buf[4] = '\0';
- out += QByteArray(buf);
- }
- }
-
- if (len < maxSize)
- out += "...";
-
- return out;
-}
-
-QT_END_NAMESPACE
-
-#endif
-
#ifndef QT_NO_PROCESS
extern char **environ;
#include "qsocketnotifier.h"
#include "qthread.h"
#include "qstandardpaths.h"
+#include "qcorecommon_p.h"
#include <errno.h>
#include <stdlib.h>
QT_BEGIN_NAMESPACE
-#if defined QPROCESS_DEBUG
-#include <ctype.h>
-/*
- Returns a human readable representation of the first \a len
- characters in \a data.
-*/
-
-static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
-{
- if (!data) return "(null)";
- QByteArray out;
- for (int i = 0; i < len; ++i) {
- char c = data[i];
- if (isprint(c)) {
- out += c;
- } else switch (c) {
- case '\n': out += "\\n"; break;
- case '\r': out += "\\r"; break;
- case '\t': out += "\\t"; break;
- default:
- QString tmp;
- tmp.sprintf("\\%o", c);
- out += tmp.toLatin1();
- }
- }
-
- if (len < maxSize)
- out += "...";
-
- return out;
-}
-#endif
-
// POSIX requires PIPE_BUF to be 512 or larger
// so we will use 512
static const int errorBufferMax = 512;
# include "qtextcodec.h"
#endif
-#if defined QTEXTSTREAM_DEBUG
-#include <ctype.h>
-
-QT_BEGIN_NAMESPACE
-
-// Returns a human readable representation of the first \a len
-// characters in \a data.
-static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
-{
- if (!data) return "(null)";
- QByteArray out;
- for (int i = 0; i < len; ++i) {
- char c = data[i];
- if (isprint(int(uchar(c)))) {
- out += c;
- } else switch (c) {
- case '\n': out += "\\n"; break;
- case '\r': out += "\\r"; break;
- case '\t': out += "\\t"; break;
- default:
- QString tmp;
- tmp.sprintf("\\x%x", (unsigned int)(unsigned char)c);
- out += tmp.toLatin1();
- }
- }
-
- if (len < maxSize)
- out += "...";
-
- return out;
-}
-QT_END_NAMESPACE
-
-#endif
-
// A precondition macro
#define Q_VOID
#define CHECK_VALID_STREAM(x) do { \
#include <time.h>
#include <limits.h>
+#include <ctype.h>
QT_BEGIN_NAMESPACE
return QString::fromLocal8Bit(tzname[1]);
}
+// Returns a human readable representation of the first \a len
+// characters in \a data.
+static inline QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
+{
+ if (!data) return "(null)";
+ QByteArray out;
+ for (int i = 0; i < len; ++i) {
+ char c = data[i];
+ if (isprint(int(uchar(c)))) {
+ out += c;
+ } else switch (c) {
+ case '\n': out += "\\n"; break;
+ case '\r': out += "\\r"; break;
+ case '\t': out += "\\t"; break;
+ default:
+ QSTACKARRAY(char, buf, 5);
+ qsnprintf(buf, sizeof(buf), "\\%3o", c);
+ buf[4] = '\0';
+ out += QByteArray(buf);
+ }
+ }
+
+ if (len < maxSize)
+ out += "...";
+
+ return out;
+}
+
QT_END_NAMESPACE
#endif // QCORECOMMON_P_H
#include "qelapsedtimer.h"
#include "qscopedvaluerollback.h"
#include "qsslsocket.h"
+#include "qdebug.h"
#include "qthread_p.h"
#include "qcore_unix_p.h"
#include "qnetworkcommon_p.h"
-
-#ifdef QABSTRACTSOCKET_DEBUG
-#include "qdebug.h"
-#endif
+#include "qcorecommon_p.h"
#include <time.h>
QT_BEGIN_NAMESPACE
-#if defined QABSTRACTSOCKET_DEBUG
-QT_BEGIN_INCLUDE_NAMESPACE
-#include "qstring.h"
-#include <ctype.h>
-QT_END_INCLUDE_NAMESPACE
-
-/*
- Returns a human readable representation of the first \a len
- characters in \a data.
-*/
-static QByteArray qt_prettyDebug(const char *data, int len, int maxLength)
-{
- if (!data) return "(null)";
- QByteArray out;
- for (int i = 0; i < len; ++i) {
- char c = data[i];
- if (isprint(int(uchar(c)))) {
- out += c;
- } else switch (c) {
- case '\n': out += "\\n"; break;
- case '\r': out += "\\r"; break;
- case '\t': out += "\\t"; break;
- default:
- QString tmp;
- tmp.sprintf("\\%o", c);
- out += tmp.toLatin1();
- }
- }
-
- if (len < maxLength)
- out += "...";
-
- return out;
-}
-#endif
-
static bool isProxyError(QAbstractSocket::SocketError error)
{
switch (error) {
# include <sys/filio.h> // FIONREAD
#endif
-#if defined QNATIVESOCKETENGINE_DEBUG
-#include "qstring.h"
-#include <ctype.h>
-#endif
-
QT_BEGIN_NAMESPACE
-#if defined QNATIVESOCKETENGINE_DEBUG
-
-/*
- Returns a human readable representation of the first \a len
- characters in \a data.
-*/
-static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)
-{
- if (!data) return "(null)";
- QByteArray out;
- for (int i = 0; i < len; ++i) {
- char c = data[i];
- if (isprint(c)) {
- out += c;
- } else switch (c) {
- case '\n': out += "\\n"; break;
- case '\r': out += "\\r"; break;
- case '\t': out += "\\t"; break;
- default:
- QString tmp;
- tmp.sprintf("\\%o", c);
- out += tmp.toLatin1();
- }
- }
-
- if (len < maxSize)
- out += "...";
-
- return out;
-}
-#endif
-
/*
Extracts the port and address from a sockaddr, and stores them in
\a port and \a addr if they are non-null.