Beginning of the byte sequence bound to this converter. */
/**ja
¤³¤Î¥³¥ó¥Ð¡¼¥¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ÎÀèƬ°ÌÃÖ */
- unsigned char *buf;
+ union {
+ const unsigned char *in;
+ unsigned char *out;
+ } buf;
/**en
Size of buf. */
mconv_stream_converter () */
MConverter *
-mconv_buffer_converter (MSymbol name, unsigned char *buf, int n)
+mconv_buffer_converter (MSymbol name, const unsigned char *buf, int n)
{
MCodingSystem *coding;
MConverter *converter;
internal->unread = mtext ();
internal->work_mt = mtext ();
mtext__enlarge (internal->work_mt, MAX_UTF8_CHAR_BYTES);
- internal->buf = buf;
+ internal->buf.in = buf;
internal->used = 0;
internal->bufsize = n;
internal->binding = BINDING_BUFFER;
mconv_rebind_stream () */
MConverter *
-mconv_rebind_buffer (MConverter *converter, unsigned char *buf, int n)
+mconv_rebind_buffer (MConverter *converter, const unsigned char *buf, int n)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
- internal->buf = buf;
+ internal->buf.in = buf;
internal->used = 0;
internal->bufsize = n;
internal->binding = BINDING_BUFFER;
if (internal->binding == BINDING_BUFFER)
{
- (*internal->coding->decoder) (internal->buf + internal->used,
+ (*internal->coding->decoder) (internal->buf.in + internal->used,
internal->bufsize - internal->used,
mt, converter);
internal->used += converter->nbytes;
mconv_decode (), mconv_decode_stream () */
MText *
-mconv_decode_buffer (MSymbol name, unsigned char *buf, int n)
+mconv_decode_buffer (MSymbol name, const unsigned char *buf, int n)
{
MConverter *converter = mconv_buffer_converter (name, buf, n);
MText *mt;
if (internal->binding == BINDING_BUFFER)
{
(*internal->coding->encoder) (mt, from, to,
- internal->buf + internal->used,
+ internal->buf.out + internal->used,
internal->bufsize - internal->used,
converter);
internal->used += converter->nbytes;