]> code.citadel.org Git - citadel.git/blobdiff - citadel/html.c
* Removed the built-in memory leak checker. It wasn't threadsafe and
[citadel.git] / citadel / html.c
index af5c6e66b2560c9194a6baf0bda1f95873d2929f..4b910252859367a9c4f43bf647261d1ad6e713dc 100644 (file)
@@ -32,7 +32,6 @@
 #include <string.h>
 #include <errno.h>
 #include <limits.h>
-#include <syslog.h>
 #include "citadel.h"
 #include "server.h"
 #include "serv_extensions.h"
@@ -70,17 +69,17 @@ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) {
        strcpy(outbuf, "");
 
        outptr_buffer_size = strlen(inptr) + SIZ;
-       outptr = mallok(outptr_buffer_size);
+       outptr = malloc(outptr_buffer_size);
        if (outptr == NULL) return NULL;
        strcpy(outptr, "");
        output_len = 0;
 
        do {
                /* Fill the input buffer */
-               if ( (done_reading == 0) && (strlen(inbuf) < 128) ) {
+               if ( (done_reading == 0) && (strlen(inbuf) < (SIZ-128)) ) {
 
-                       ch = *inputmsg++;
-                       if (ch > 0) {
+                       ch = *inptr++;
+                       if (ch != 0) {
                                inbuf[strlen(inbuf)+1] = 0;
                                inbuf[strlen(inbuf)] = ch;
                        } 
@@ -98,8 +97,10 @@ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) {
                        if (inbuf[i]==10) inbuf[i]=32;
                        if (inbuf[i]==13) inbuf[i]=32;
                        if (inbuf[i]==9) inbuf[i]=32;
-                       if ((inbuf[i]<32) || (inbuf[i]>126))
-                               strcpy(&inbuf[i], &inbuf[i+1]);
+                       if ((inbuf[i]<32) || (inbuf[i]>126)) {
+                               inbuf[i] = '?';
+                               /* strcpy(&inbuf[i], &inbuf[i+1]); */
+                       }
                    }
                    for (i=0; i<strlen(inbuf); ++i) {
                        while ((inbuf[i]==32)&&(inbuf[i+1]==32))
@@ -236,9 +237,9 @@ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) {
                }
 
                /* Make sure the output buffer is big enough */
-               if ((output_len + strlen(outbuf) + 128)
+               if ((output_len + strlen(outbuf) + SIZ)
                   > outptr_buffer_size) {
-                       outptr_buffer_size += 128;
+                       outptr_buffer_size += SIZ;
                        outptr = realloc(outptr, outptr_buffer_size);
                }