summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2012-04-22 22:32:26 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2012-04-22 22:32:26 +0800
commit5eb5480fe1954e6f72548bff7e23f1f446465df3 (patch)
treeff19c1bc21669503f38af0895d3b096a15f4dde7
parent07e89103436f2d233b7dcb541c095dc6aeb65e8e (diff)
downloadpttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.tar
pttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.tar.gz
pttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.tar.bz2
pttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.tar.lz
pttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.tar.xz
pttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.tar.zst
pttbbs-5eb5480fe1954e6f72548bff7e23f1f446465df3.zip
Fix utf8 output mode issue
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5668 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/io.c10
1 files changed, 9 insertions, 1 deletions
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