aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2000-09-19 00:14:17 +0000
committerKenichi Handa2000-09-19 00:14:17 +0000
commita3d8fcf244a7012fd3c283460bc57a6b1fcd4918 (patch)
tree029790c4732aafe8ba69fe411da4e88e237603a6 /src
parent3a5f42bbb9f809b11aca1368bcd4be8bbd849f96 (diff)
downloademacs-a3d8fcf244a7012fd3c283460bc57a6b1fcd4918.tar.gz
emacs-a3d8fcf244a7012fd3c283460bc57a6b1fcd4918.zip
(Fccl_execute_on_string): Make multibyte string correctly.
If output buffer is too small, signal an appropriated error.
Diffstat (limited to 'src')
-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.")
2035 ccl.last_block = NILP (contin); 2035 ccl.last_block = NILP (contin);
2036 ccl.multibyte = STRING_MULTIBYTE (str); 2036 ccl.multibyte = STRING_MULTIBYTE (str);
2037 produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf, 2037 produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
2038 STRING_BYTES (XSTRING (str)), outbufsize, (int *)0); 2038 STRING_BYTES (XSTRING (str)), outbufsize, (int *) 0);
2039 for (i = 0; i < 8; i++) 2039 for (i = 0; i < 8; i++)
2040 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]); 2040 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]);
2041 XSETINT (XVECTOR (status)->contents[8], ccl.ic); 2041 XSETINT (XVECTOR (status)->contents[8], ccl.ic);
2042 UNGCPRO; 2042 UNGCPRO;
2043 2043
2044 if (NILP (unibyte_p)) 2044 if (NILP (unibyte_p))
2045 val = make_string (outbuf, produced); 2045 {
2046 int nchars;
2047
2048 produced = str_as_multibyte (outbuf, outbufsize, produced, &nchars);
2049 val = make_multibyte_string (outbuf, nchars, produced);
2050 }
2046 else 2051 else
2047 val = make_unibyte_string (outbuf, produced); 2052 val = make_unibyte_string (outbuf, produced);
2048 xfree (outbuf); 2053 xfree (outbuf);
2049 QUIT; 2054 QUIT;
2055 if (ccl.status == CCL_STAT_SUSPEND_BY_DST)
2056 error ("Output buffer for the CCL programs overflow");
2050 if (ccl.status != CCL_STAT_SUCCESS 2057 if (ccl.status != CCL_STAT_SUCCESS
2051 && ccl.status != CCL_STAT_SUSPEND_BY_SRC 2058 && ccl.status != CCL_STAT_SUSPEND_BY_SRC)
2052 && ccl.status != CCL_STAT_SUSPEND_BY_DST)
2053 error ("Error in CCL program at %dth code", ccl.ic); 2059 error ("Error in CCL program at %dth code", ccl.ic);
2054 2060
2055 return val; 2061 return val;