From b89fefc7c41707854a10d52e2c9eac4cff1b9c7f Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Wed, 9 Nov 2005 17:33:47 +0000 Subject: [PATCH] use DEBUG_CONV to print some output not the global DEBUG git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14797 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/textencoding/utf8_conversions.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/kits/textencoding/utf8_conversions.cpp b/src/kits/textencoding/utf8_conversions.cpp index 61fb4bd836..b985629525 100644 --- a/src/kits/textencoding/utf8_conversions.cpp +++ b/src/kits/textencoding/utf8_conversions.cpp @@ -7,6 +7,14 @@ #include #include +//#define DEBUG_CONV 1 + +#ifdef DEBUG_CONV + #define DEBPRINT(ARGS) printf ARGS; +#else + #define DEBPRINT(ARGS) ; +#endif + using namespace BPrivate; typedef char ** input_buffer_t; @@ -22,12 +30,12 @@ convert_encoding(const char * from, const char * to, status_t status; if (*srcLen == 0) { // nothing to do! - PRINT(("nothing to do\n")); + DEBPRINT(("nothing to do\n")); return B_OK; } iconv_t conversion = iconv_open(to,from); if (conversion == (iconv_t)-1) { - PRINT(("iconv_open failed\n")); + DEBPRINT(("iconv_open failed\n")); return B_ERROR; } if ((state == NULL) || (*state == 0)) { @@ -89,11 +97,11 @@ convert_encoding(const char * from, const char * to, iconv_close(conversion); if (*srcLen != 0) { // able to convert at least one character - PRINT(("able to convert at least one character\n")); + DEBPRINT(("able to convert at least one character\n")); return B_OK; } else { // not able to convert at least one character - PRINT(("not able to convert at least one character\n")); + DEBPRINT(("not able to convert at least one character\n")); return B_ERROR; } } @@ -108,7 +116,7 @@ convert_to_utf8(uint32 srcEncoding, if (charset == 0) { return B_ERROR; } -#if DEBUG +#if DEBUG_CONV fprintf(stderr, "convert_to_utf8(%s) : \"", charset->GetName()); for (int i = 0 ; i < *srcLen ; i++) { fprintf(stderr, "%c", src[i]); @@ -128,7 +136,7 @@ convert_from_utf8(uint32 dstEncoding, if (charset == 0) { return B_ERROR; } -#if DEBUG +#if DEBUG_CONV fprintf(stderr, "convert_from_utf8(%s) : \"", charset->GetName()); for (int i = 0 ; i < *srcLen ; i++) { fprintf(stderr, "%c", src[i]);