]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Simplify "weird" charset code
authorVolker Lendecke <vl@samba.org>
Mon, 4 Jan 2021 11:28:20 +0000 (12:28 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 12 Jan 2021 00:10:30 +0000 (00:10 +0000)
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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/charset/weird.c

index 79b07b022a1f1c6be74476e163afaa4c6b7424bb..9752e01e323275653c82dcd5b87e725b2cadfc89 100644 (file)
@@ -18,7 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#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;