summaryrefslogtreecommitdiff
path: root/src/ccl.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2000-09-19 00:14:17 +0000
committerKenichi Handa <handa@m17n.org>2000-09-19 00:14:17 +0000
commita3d8fcf244a7012fd3c283460bc57a6b1fcd4918 (patch)
tree029790c4732aafe8ba69fe411da4e88e237603a6 /src/ccl.c
parent3a5f42bbb9f809b11aca1368bcd4be8bbd849f96 (diff)
downloademacs-a3d8fcf244a7012fd3c283460bc57a6b1fcd4918.tar.gz
(Fccl_execute_on_string): Make multibyte string correctly.
If output buffer is too small, signal an appropriated error.
Diffstat (limited to 'src/ccl.c')
-rw-r--r--src/ccl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ccl.c b/src/ccl.c
index d91d72b61f9..ca50081f47c 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -2035,21 +2035,27 @@ See the documentation of `define-ccl-program' for the detail of CCL program.")
ccl.last_block = NILP (contin);
ccl.multibyte = STRING_MULTIBYTE (str);
produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
- STRING_BYTES (XSTRING (str)), outbufsize, (int *)0);
+ STRING_BYTES (XSTRING (str)), outbufsize, (int *) 0);
for (i = 0; i < 8; i++)
XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]);
XSETINT (XVECTOR (status)->contents[8], ccl.ic);
UNGCPRO;
if (NILP (unibyte_p))
- val = make_string (outbuf, produced);
+ {
+ int nchars;
+
+ produced = str_as_multibyte (outbuf, outbufsize, produced, &nchars);
+ val = make_multibyte_string (outbuf, nchars, produced);
+ }
else
val = make_unibyte_string (outbuf, produced);
xfree (outbuf);
QUIT;
+ if (ccl.status == CCL_STAT_SUSPEND_BY_DST)
+ error ("Output buffer for the CCL programs overflow");
if (ccl.status != CCL_STAT_SUCCESS
- && ccl.status != CCL_STAT_SUSPEND_BY_SRC
- && ccl.status != CCL_STAT_SUSPEND_BY_DST)
+ && ccl.status != CCL_STAT_SUSPEND_BY_SRC)
error ("Error in CCL program at %dth code", ccl.ic);
return val;