From: Volker Lendecke Date: Mon, 4 Jan 2021 11:28:20 +0000 (+0100) Subject: lib: Simplify "weird" charset code X-Git-Tag: samba-4.14.0rc1~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c02ebdbf84cc8141754313c0b5bb0ee1c56afb2;p=thirdparty%2Fsamba.git lib: Simplify "weird" charset code Don't depend on DEBUG. This is a pure developer module, the developer should be able to figure out what's going on after this has abort()ed. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/lib/util/charset/weird.c b/lib/util/charset/weird.c index 79b07b022a1..9752e01e323 100644 --- a/lib/util/charset/weird.c +++ b/lib/util/charset/weird.c @@ -18,7 +18,7 @@ along with this program. If not, see . */ -#include "includes.h" +#include "replace.h" #include "charset_proto.h" #ifdef DEVELOPER @@ -54,19 +54,17 @@ size_t weird_pull(void *cd, const char **inbuf, size_t *inbytesleft, weird_table[i].to, weird_table[i].len) == 0) { if (*inbytesleft < weird_table[i].len) { - DEBUG(0,("ERROR: truncated weird string\n")); - /* smb_panic("weird_pull"); */ - - } else { - (*outbuf)[0] = weird_table[i].from; - (*outbuf)[1] = 0; - (*inbytesleft) -= weird_table[i].len; - (*outbytesleft) -= 2; - (*inbuf) += weird_table[i].len; - (*outbuf) += 2; - done = 1; - break; + abort(); } + + (*outbuf)[0] = weird_table[i].from; + (*outbuf)[1] = 0; + (*inbytesleft) -= weird_table[i].len; + (*outbytesleft) -= 2; + (*inbuf) += weird_table[i].len; + (*outbuf) += 2; + done = 1; + break; } } if (done) continue; @@ -98,18 +96,17 @@ size_t weird_push(void *cd, const char **inbuf, size_t *inbytesleft, if ((*inbuf)[0] == weird_table[i].from && (*inbuf)[1] == 0) { if (*outbytesleft < weird_table[i].len) { - DEBUG(0,("No room for weird character\n")); - /* smb_panic("weird_push"); */ - } else { - memcpy(*outbuf, weird_table[i].to, - weird_table[i].len); - (*inbytesleft) -= 2; - (*outbytesleft) -= weird_table[i].len; - (*inbuf) += 2; - (*outbuf) += weird_table[i].len; - done = 1; - break; + abort(); } + memcpy(*outbuf, + weird_table[i].to, + weird_table[i].len); + (*inbytesleft) -= 2; + (*outbytesleft) -= weird_table[i].len; + (*inbuf) += 2; + (*outbuf) += weird_table[i].len; + done = 1; + break; } } if (done) continue;