summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-03-24 15:43:02 +1100
committerAndrew Tridgell <tridge@samba.org>2011-03-25 04:37:06 +0100
commitd85dbfb3dbb7a17c38f1f981362cc68400fa4410 (patch)
tree98d7e33a3e7af9fdaa30083becd305ab0d5720f6
parent232fb016a15c0536aabc3bc23607721398693037 (diff)
downloadsamba-d85dbfb3dbb7a17c38f1f981362cc68400fa4410.tar.gz
samba-d85dbfb3dbb7a17c38f1f981362cc68400fa4410.tar.bz2
samba-d85dbfb3dbb7a17c38f1f981362cc68400fa4410.zip
s3-string: removed the conv_silent global
use convert_string_error() instead Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/lib/charcnv.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 77d36dbdfd..343c077709 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -45,7 +45,6 @@ char lp_failed_convert_char(void)
*/
-static bool conv_silent; /* Should we do a debug if the conversion fails ? */
static bool initialized;
void lazy_initialize_conv(void)
@@ -119,8 +118,7 @@ static size_t convert_string_internal(charset_t from, charset_t to,
if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) {
- if (!conv_silent)
- DEBUG(0,("convert_string_internal: Conversion not supported.\n"));
+ DEBUG(0,("convert_string_internal: Conversion not supported.\n"));
return (size_t)-1;
}
@@ -133,31 +131,26 @@ static size_t convert_string_internal(charset_t from, charset_t to,
switch(errno) {
case EINVAL:
reason="Incomplete multibyte sequence";
- if (!conv_silent)
- DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
+ DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
return (size_t)-1;
case E2BIG:
reason="No more room";
- if (!conv_silent) {
- if (from == CH_UNIX) {
- DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u - '%s'\n",
- charset_name(ic, from), charset_name(ic, to),
- (unsigned int)srclen, (unsigned int)destlen, (const char *)src));
- } else {
- DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u\n",
- charset_name(ic, from), charset_name(ic, to),
- (unsigned int)srclen, (unsigned int)destlen));
- }
+ if (from == CH_UNIX) {
+ DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u - '%s'\n",
+ charset_name(ic, from), charset_name(ic, to),
+ (unsigned int)srclen, (unsigned int)destlen, (const char *)src));
+ } else {
+ DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u\n",
+ charset_name(ic, from), charset_name(ic, to),
+ (unsigned int)srclen, (unsigned int)destlen));
}
break;
case EILSEQ:
reason="Illegal multibyte sequence";
- if (!conv_silent)
- DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
+ DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
return (size_t)-1;
default:
- if (!conv_silent)
- DEBUG(0,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
+ DEBUG(0,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
return (size_t)-1;
}
/* smb_panic(reason); */
@@ -435,8 +428,7 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
descriptor = get_conv_handle(ic, from, to);
if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) {
- if (!conv_silent)
- DEBUG(0,("convert_string_talloc: Conversion not supported.\n"));
+ DEBUG(0,("convert_string_talloc: Conversion not supported.\n"));
errno = EOPNOTSUPP;
return false;
}
@@ -446,8 +438,7 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
/* +2 is for ucs2 null termination. */
if ((destlen*2)+2 < destlen) {
/* wrapped ! abort. */
- if (!conv_silent)
- DEBUG(0, ("convert_string_talloc: destlen wrapped !\n"));
+ DEBUG(0, ("convert_string_talloc: destlen wrapped !\n"));
TALLOC_FREE(outbuf);
errno = EOPNOTSUPP;
return false;
@@ -475,19 +466,16 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
switch(errno) {
case EINVAL:
reason="Incomplete multibyte sequence";
- if (!conv_silent)
- DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf));
+ DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf));
break;
case E2BIG:
goto convert;
case EILSEQ:
reason="Illegal multibyte sequence";
- if (!conv_silent)
- DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf));
+ DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf));
break;
}
- if (!conv_silent)
- DEBUG(0,("Conversion error: %s(%s)\n",reason,inbuf));
+ DEBUG(0,("Conversion error: %s(%s)\n",reason,inbuf));
/* smb_panic(reason); */
TALLOC_FREE(ob);
return false;