change debug log trace

This commit is contained in:
dockes 2006-04-28 07:23:46 +00:00
parent e3332fcfa5
commit 220674f660

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: transcode.cpp,v 1.7 2006-03-29 11:18:15 dockes Exp $ (C) 2004 J.F.Dockes"; static char rcsid[] = "@(#$Id: transcode.cpp,v 1.8 2006-04-28 07:23:46 dockes Exp $ (C) 2004 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -47,8 +47,7 @@ bool transcode(const string &in, string &out, const string &icode,
const int OBSIZ = 8192; const int OBSIZ = 8192;
char obuf[OBSIZ], *op; char obuf[OBSIZ], *op;
bool icopen = false; bool icopen = false;
if (ecnt) int mecnt = 0;
*ecnt = 0;
out.erase(); out.erase();
size_t isiz = in.length(); size_t isiz = in.length();
out.reserve(isiz); out.reserve(isiz);
@ -75,13 +74,12 @@ bool transcode(const string &in, string &out, const string &icode,
" : " + strerror(errno); " : " + strerror(errno);
#endif #endif
if (errno == EILSEQ) { if (errno == EILSEQ) {
LOGDEB(("transcode:iconv: bad input seq.: shift, retry\n")); LOGDEB1(("transcode:iconv: bad input seq.: shift, retry\n"));
LOGDEB1((" Input consumed %d output produced %d\n", LOGDEB1((" Input consumed %d output produced %d\n",
ip - in.c_str(), out.length() + OBSIZ - osiz)); ip - in.c_str(), out.length() + OBSIZ - osiz));
out.append(obuf, OBSIZ - osiz); out.append(obuf, OBSIZ - osiz);
out += "?"; out += "?";
if (ecnt) mecnt++;
(*ecnt)++;
ip++;isiz--; ip++;isiz--;
continue; continue;
} }
@ -103,6 +101,10 @@ bool transcode(const string &in, string &out, const string &icode,
if (icopen) if (icopen)
iconv_close(ic); iconv_close(ic);
//fprintf(stderr, "TRANSCODE OUT:\n%s\n", out.c_str()); //fprintf(stderr, "TRANSCODE OUT:\n%s\n", out.c_str());
if (mecnt)
LOGDEB(("transcode: %d errors\n", mecnt));
if (ecnt)
*ecnt = mecnt;
return ret; return ret;
} }