diff options
author | Robert Xu <[email protected]> | 2011-11-10 18:04:39 -0500 |
---|---|---|
committer | Robert Xu <[email protected]> | 2011-11-10 18:04:39 -0500 |
commit | 21fcfa3348213aa87f0e3aef62ca4720c6d31cb7 (patch) | |
tree | 2cfb64c59322628e613ed0895e3c3694d3abe6bd /opensuse/core/tdelibs/no-debug-by-default.diff | |
parent | 8667643bff14a60d8571c599efd3e48bed3e3b12 (diff) | |
download | tde-packaging-21fcfa3348213aa87f0e3aef62ca4720c6d31cb7.tar.gz tde-packaging-21fcfa3348213aa87f0e3aef62ca4720c6d31cb7.zip |
initial commit to suse branch: eclipse integration
Diffstat (limited to 'opensuse/core/tdelibs/no-debug-by-default.diff')
-rw-r--r-- | opensuse/core/tdelibs/no-debug-by-default.diff | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/opensuse/core/tdelibs/no-debug-by-default.diff b/opensuse/core/tdelibs/no-debug-by-default.diff new file mode 100644 index 000000000..5b1440970 --- /dev/null +++ b/opensuse/core/tdelibs/no-debug-by-default.diff @@ -0,0 +1,158 @@ +Index: kdecore/kdebug.cpp +=================================================================== +--- kdecore/kdebug.cpp.orig ++++ kdecore/kdebug.cpp +@@ -170,7 +170,7 @@ static KStaticDeleter<kDebugPrivate> pcd + static KStaticDeleter<KDebugDCOPIface> dcopsd; + static KDebugDCOPIface* kDebugDCOPIface = 0; + +-static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char *data) ++static void kDebugInitBackend(unsigned int nArea) + { + if ( !kDebug_data ) + { +@@ -205,40 +205,46 @@ static void kDebugBackend( unsigned shor + if ( KGlobal::_instance ) + kDebug_data->aAreaName = KGlobal::instance()->instanceName(); + } ++} + +- int nPriority = 0; +- QString aCaption; +- +- /* Determine output */ ++static short kDebugAreaOutput(unsigned short nLevel, unsigned int nArea) ++{ ++ kDebugInitBackend (nArea); + ++ /* Determine output */ + QString key; + switch( nLevel ) + { + case KDEBUG_INFO: + key = "InfoOutput"; +- aCaption = "Info"; +- nPriority = LOG_INFO; + break; + case KDEBUG_WARN: + key = "WarnOutput"; +- aCaption = "Warning"; +- nPriority = LOG_WARNING; + break; + case KDEBUG_FATAL: + key = "FatalOutput"; +- aCaption = "Fatal Error"; +- nPriority = LOG_CRIT; + break; + case KDEBUG_ERROR: + default: + /* Programmer error, use "Error" as default */ + key = "ErrorOutput"; +- aCaption = "Error"; +- nPriority = LOG_ERR; + break; + } + +- short nOutput = kDebug_data->config ? kDebug_data->config->readNumEntry(key, 2) : 2; ++ return kDebug_data->config ? kDebug_data->config->readNumEntry(key, 4) : 4; ++} ++ ++ ++bool kDebugAreaEnabled(unsigned short nLevel, unsigned int nArea) ++{ ++ return kDebugAreaOutput(nLevel, nArea) != 4; ++} ++ ++static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char *data) ++{ ++ kDebugInitBackend (nArea); ++ ++ short nOutput = kDebugAreaOutput(nLevel, nArea); + + // If the application doesn't have a QApplication object it can't use + // a messagebox. +@@ -247,6 +253,32 @@ static void kDebugBackend( unsigned shor + else if ( nOutput == 4 && nLevel != KDEBUG_FATAL ) + return; + ++ int nPriority = 0; ++ QString aCaption; ++ switch( nLevel ) ++ { ++ case KDEBUG_INFO: ++ aCaption = "Info"; ++ nPriority = LOG_INFO; ++ break; ++ case KDEBUG_WARN: ++ aCaption = "Warning"; ++ nPriority = LOG_WARNING; ++ break; ++ case KDEBUG_FATAL: ++ aCaption = "Fatal Error"; ++ nPriority = LOG_CRIT; ++ break; ++ case KDEBUG_ERROR: ++ default: ++ /* Programmer error, use "Error" as default */ ++ aCaption = "Error"; ++ nPriority = LOG_ERR; ++ break; ++ } ++ ++ ++ + const int BUFSIZE = 4096; + char buf[BUFSIZE]; + if ( !kDebug_data->aAreaName.isEmpty() ) { +@@ -314,13 +346,25 @@ static void kDebugBackend( unsigned shor + } + + kdbgstream &perror( kdbgstream &s) { return s << QString::fromLocal8Bit(strerror(errno)); } +-kdbgstream kdDebug(int area) { return kdbgstream(area, KDEBUG_INFO); } +-kdbgstream kdDebug(bool cond, int area) { if (cond) return kdbgstream(area, KDEBUG_INFO); else return kdbgstream(0, 0, false); } ++kdbgstream kdDebug(int area) { return kdbgstream(area, KDEBUG_INFO, kDebugAreaEnabled(KDEBUG_INFO, area)); } ++kdbgstream kdDebug(bool cond, int area) { if (cond) return kdbgstream(area, KDEBUG_INFO, kDebugAreaEnabled(KDEBUG_INFO, area)); else return kdbgstream(0, 0, false); } + + kdbgstream kdError(int area) { return kdbgstream("ERROR: ", area, KDEBUG_ERROR); } + kdbgstream kdError(bool cond, int area) { if (cond) return kdbgstream("ERROR: ", area, KDEBUG_ERROR); else return kdbgstream(0,0,false); } +-kdbgstream kdWarning(int area) { return kdbgstream("WARNING: ", area, KDEBUG_WARN); } +-kdbgstream kdWarning(bool cond, int area) { if (cond) return kdbgstream("WARNING: ", area, KDEBUG_WARN); else return kdbgstream(0,0,false); } ++ ++kdbgstream kdWarning(int area) ++{ ++ return kdbgstream("WARNING: ", area, KDEBUG_WARN, kDebugAreaEnabled(KDEBUG_WARN, area)); ++} ++ ++kdbgstream kdWarning(bool cond, int area) ++{ ++ if (cond) ++ return kdbgstream("WARNING: ", area, KDEBUG_WARN, kDebugAreaEnabled(KDEBUG_WARN, area)); ++ else ++ return kdbgstream(0,0,false); ++} ++ + kdbgstream kdFatal(int area) { return kdbgstream("FATAL: ", area, KDEBUG_FATAL); } + kdbgstream kdFatal(bool cond, int area) { if (cond) return kdbgstream("FATAL: ", area, KDEBUG_FATAL); else return kdbgstream(0,0,false); } + +@@ -331,9 +375,10 @@ kdbgstream::kdbgstream(kdbgstream &str) + } + + void kdbgstream::flush() { +- if (output.isEmpty() || !print) ++ if (output.isEmpty()) + return; +- kDebugBackend( level, area, output.local8Bit().data() ); ++ if (print) ++ kDebugBackend( level, area, output.local8Bit().data() ); + output = QString::null; + } + +@@ -349,7 +394,7 @@ kdbgstream &kdbgstream::form(const char + } + + kdbgstream::~kdbgstream() { +- if (!output.isEmpty()) { ++ if (print && !output.isEmpty()) { + fprintf(stderr, "ASSERT: debug output not ended with \\n\n"); + fprintf(stderr, "%s", kdBacktrace().latin1()); + *this << "\n"; |