From: Peter Maydell Date: Thu, 22 May 2008 10:37:55 +0000 (+0000) Subject: Don't use MB_CUR_MAX if we aren't compiled with multibyte support. X-Git-Tag: PRE_POSIX_CONVERSION~58 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=d9c0d17aa110ec0e5db5f0928fead5a1ff60a9e2;p=mmh Don't use MB_CUR_MAX if we aren't compiled with multibyte support. --- diff --git a/ChangeLog b/ChangeLog index 33485f8..ed47591 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-05-22 Peter Maydell + * uip/scansbr.c: don't use MB_CUR_MAX if we aren't compiled + with multibyte support. + * uip/whatnowsbr.c: factor out common code for writing ls shell command, and make it do more sensible buffer length checks. Also avoid relying on the return value of sprintf(), diff --git a/uip/scansbr.c b/uip/scansbr.c index 1b6a0ed..6a9278b 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -68,6 +68,11 @@ char *scanl = 0; /* text of most recent scanline */ int sc_width (void); /* from termsbr.c */ static int mh_fputs(char *, FILE *); +#ifdef MULTIBYTE_SUPPORT +#define SCAN_CHARWIDTH MB_CUR_MAX +#else +#define SCAN_CHARWIDTH 1 +#endif int scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, @@ -98,7 +103,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, width = MAXSCANL; } dat[3] = slwidth = width; - scanl = (char *) mh_xmalloc((size_t) MB_CUR_MAX * (slwidth + 2) ); + scanl = (char *) mh_xmalloc((size_t) SCAN_CHARWIDTH * (slwidth + 2) ); if (outnum) umask(~m_gmprot());