From d9c0d17aa110ec0e5db5f0928fead5a1ff60a9e2 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 22 May 2008 10:37:55 +0000 Subject: [PATCH] Don't use MB_CUR_MAX if we aren't compiled with multibyte support. --- ChangeLog | 3 +++ uip/scansbr.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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()); -- 1.7.10.4