emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coding system conversion error


From: Stefan Monnier
Subject: Re: Coding system conversion error
Date: Tue, 08 Feb 2005 18:38:25 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> I think I found the reason for this, but I am not sure.  Can anybody with
> knowledge about multibyte and unibyte string representations comment on the
> patch below (in function allocate_string_data in alloc.c)?

> diff -c alloc.c.~1.363.~ alloc.c
> Index: alloc.c
> *** alloc.c.~1.363.~    2005-01-20 21:20:32.000000000 +0100
> --- alloc.c    2005-02-08 22:46:02.000000000 +0100
> ***************
> *** 1977,1983 ****
>     SDATA_NBYTES (data) = nbytes;
>   #endif
s-> size = nchars;
> !   s->size_byte = nbytes;
s-> data[nbytes] = '\0';
>   #ifdef GC_CHECK_STRING_OVERRUN
>     bcopy (string_overrun_cookie, (char *) data + needed,
> --- 1977,1983 ----
>     SDATA_NBYTES (data) = nbytes;
>   #endif
s-> size = nchars;
> !   s->size_byte = nchars != nbytes ? nbytes : -1;
s-> data[nbytes] = '\0';
>   #ifdef GC_CHECK_STRING_OVERRUN
>     bcopy (string_overrun_cookie, (char *) data + needed,


This doesn't look like the right fix.
Normally, the caller would instead use `STRING_SET_UNIBYTE' after the call
(or rather calls one of make_foo_string which does it for him) if needed.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]