From 5eb5480fe1954e6f72548bff7e23f1f446465df3 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 22 Apr 2012 14:32:26 +0000 Subject: Fix utf8 output mode issue git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5668 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/io.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c index 63325338..51c7163d 100644 --- a/pttbbs/mbbsd/io.c +++ b/pttbbs/mbbsd/io.c @@ -7,6 +7,14 @@ #define OBUFSIZE 3072 #define IBUFSIZE 128 +// When CONVERT is applied, we may need to write extra N bytes into buffer for +// one character input. Currently the number is 3 (UTF8). +#ifdef CONVERT +# define OBUFMINSPACE (3) +#else +# define OBUFMINSPACE (1) +#endif + #ifdef DEBUG #define register #define inline @@ -129,7 +137,7 @@ ochar(int c) szLastOutput ++; #endif // DBG_OUTRPT - if (vbuf_is_full(pvout)) + if (vbuf_space(pvout) < OBUFMINSPACE) oflush(); #ifdef CONVERT -- cgit v1.2.3