Port to QCDebug

This commit is contained in:
Montel Laurent 2015-03-20 08:48:17 +01:00
parent fca577bd6f
commit 2568463061
4 changed files with 63 additions and 13 deletions

View file

@ -5,7 +5,7 @@ include_directories(
########### next target ###############
set(okularGenerator_fax_PART_SRCS generator_fax.cpp faxdocument.cpp faxexpand.cpp faxinit.cpp )
set(okularGenerator_fax_PART_SRCS generator_fax.cpp faxdocument.cpp faxexpand.cpp faxinit.cpp fax_debug.cpp)
add_library(okularGenerator_fax MODULE ${okularGenerator_fax_PART_SRCS})

View file

@ -0,0 +1,23 @@
/* This file is part of the KDE project
Copyright (C) 2014 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "fax_debug.h"
Q_LOGGING_CATEGORY(FAX_LOG, "log_fax")

View file

@ -0,0 +1,27 @@
/* This file is part of the KDE project
Copyright (C) 2014 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef FAX_DEBUG_H
#define FAX_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(FAX_LOG)
#endif

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
#include <QtCore/QDebug>
#include "faxexpand.h"
#include <KDebug>
#include "fax_debug.h"
//Uncomment this for verbose debug output
//#define DEBUG_FAX
#define verbose false
@ -300,14 +300,14 @@ const char *StateNames[] = {
case S_Ext: \
*pa++ = lastx - a0; \
if (verbose) \
kDebug() << "Line " << LineNum << ": extension code\n";\
qCDebug(FAX_LOG) << "Line " << LineNum << ": extension code\n";\
SKIP_EOL; \
break; \
case S_EOL: \
*pa++ = lastx - a0; \
NeedBits(4); \
if (GetBits(4) && verbose) /* already seen 7 zeros */ \
kDebug() << "Line " << LineNum << ": Bad EOL\n"; \
qCDebug(FAX_LOG) << "Line " << LineNum << ": Bad EOL\n"; \
ClrBits(4); \
EOLcnt = 1; \
goto eolab; \
@ -337,7 +337,7 @@ static void
unexpected(const char *what, int LineNum)
{
if (verbose)
kError() << "Line " << LineNum << ": Unexpected state in "
qCCritical(FAX_LOG) << "Line " << LineNum << ": Unexpected state in "
<< what << endl;
}
@ -379,7 +379,7 @@ MHexpand(struct pagenode *pn, drawfunc df)
SETVAL(0);
if (a0 != lastx) {
if (verbose)
kWarning() << "Line " << LineNum << ": length is "
qCWarning(FAX_LOG) << "Line " << LineNum << ": length is "
<< a0 << " (expected "<< lastx << ")\n";
while (a0 > lastx)
a0 -= *--pa;
@ -448,7 +448,7 @@ g31expand(struct pagenode *pn, drawfunc df)
ClrBits(11);
}
if (EOLcnt > 1 && EOLcnt != 6 && verbose) {
kError() << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
qCCritical(FAX_LOG) << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
}
if (EOLcnt >= 6 || EndOfData(pn)) {
free(runs);
@ -463,7 +463,7 @@ g31expand(struct pagenode *pn, drawfunc df)
SETVAL(0);
if (a0 != lastx) {
if (verbose)
kWarning() << "Line " << LineNum << ": length is "
qCWarning(FAX_LOG) << "Line " << LineNum << ": length is "
<< a0 << " (expected "<< lastx << ")\n";
while (a0 > lastx)
a0 -= *--pa;
@ -539,13 +539,13 @@ g32expand(struct pagenode *pn, drawfunc df)
ClrBits(11);
}
if (EOLcnt > 1 && EOLcnt != 6 && verbose)
kError() << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
qCCritical(FAX_LOG) << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
if (EOLcnt >= 6 || EndOfData(pn)) {
free(run0);
return;
}
if (LineNum == 0 && refline == 0 && verbose)
kDebug() << "First line is 2-D encoded\n";
qCDebug(FAX_LOG) << "First line is 2-D encoded\n";
RunLength = 0;
if (LineNum & 1) {
pa = run1;
@ -570,7 +570,7 @@ g32expand(struct pagenode *pn, drawfunc df)
SETVAL(0);
if (a0 != lastx) {
if (verbose)
kWarning() << "Line " << LineNum << ": length is "
qCWarning(FAX_LOG) << "Line " << LineNum << ": length is "
<< a0 << " (expected "<< lastx << ")\n";
while (a0 > lastx)
a0 -= *--pa;
@ -592,7 +592,7 @@ g32expand(struct pagenode *pn, drawfunc df)
#undef eol2lab
#define SKIP_EOL do { \
if (verbose) \
kError() << "Line " << LineNum << ": G4 coding error\n"; \
qCCritical(FAX_LOG) << "Line " << LineNum << ": G4 coding error\n"; \
free(run0); \
return; \
} while (0)
@ -654,7 +654,7 @@ g4expand(struct pagenode *pn, drawfunc df)
EOFB:
NeedBits(13);
if (GetBits(13) != 0x1001 && verbose)
kError() << "Bad RTC\n";
qCCritical(FAX_LOG) << "Bad RTC\n";
break;
}
free(run0);