X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fscansbr.c;h=1b6a0ed9ec9ffdfe34929eb4bb09216c3bb2abc8;hb=7edb0cbc236244d996d1e2ae1d58d0e9f7d98062;hp=be68bf89162fb5c7c53ee761adaa7d8f10bcc623;hpb=cafee7a804b8aa53166065e988ec0fc387862fc8;p=mmh diff --git a/uip/scansbr.c b/uip/scansbr.c index be68bf8..1b6a0ed 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -14,6 +14,7 @@ #include #include #include +#include #ifdef _FSTDIO # define _ptr _p /* Gag */ @@ -73,7 +74,8 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, int unseen, char *folder, long size, int noisy) { int i, compnum, encrypted, state; - char *cp, *tmpbuf, **nxtbuf; + unsigned char *cp, *tmpbuf; + char **nxtbuf; char *saved_c_text; struct comp *cptr; struct comp **savecomp; @@ -96,8 +98,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, width = MAXSCANL; } dat[3] = slwidth = width; - if ((scanl = (char *) malloc((size_t) (slwidth + 2) )) == NULL) - adios (NULL, "unable to malloc scan line (%d bytes)", slwidth+2); + scanl = (char *) mh_xmalloc((size_t) MB_CUR_MAX * (slwidth + 2) ); if (outnum) umask(~m_gmprot()); @@ -133,8 +134,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, used_buf += ncomps+1; *--used_buf = 0; rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ; for (i = ncomps; i--; ) - if ((*nxtbuf++ = malloc(rlwidth)) == NULL) - adios (NULL, "unable to allocate component buffer"); + *nxtbuf++ = mh_xmalloc(rlwidth); } /* @@ -204,7 +204,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, */ if ((cptr = wantcomp[CHASH(name)])) { do { - if (!strcasecmp(name, cptr->c_name)) { + if (!mh_strcasecmp(name, cptr->c_name)) { if (! cptr->c_text) { cptr->c_text = tmpbuf; for (cp = tmpbuf + strlen (tmpbuf) - 1;