emacs-devel
[Top][All Lists]
Advanced

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

Re: struct.el -- a package to encode/decode binary data


From: Stefan Monnier
Subject: Re: struct.el -- a package to encode/decode binary data
Date: Thu, 21 Mar 2002 20:05:09 -0500

> > From: "Stefan Monnier" <monnier+gnu/address@hidden>
> > Date: Thu, 21 Mar 2002 11:58:34 -0500
> > 
> > > > If the string holds non-ASCII text, yes.  But not in your case, where 
> > > > the 
> > > > ``string'' holds binary data, I think.
> > 
> > This is only true if binary values between 128 and 256 are represented
> > as a single-byte, but that's not the case in multibyte strings.
> 
> Most of them, those between 160 and 255 _are_ represented as a single
> byte, even in a multibyte string/buffer.  That's the eight-bit-graphic
> character set.

Interesting.  It still means that binary values between 128 and 160
(i.e. from eight-bit-control) are posing problems when calling `aset'.

But now that I think about it, if 160-255 can be an eight-bit-graphic
character, how does the code does with "backward-char" ?
Looking at DEC_POS in charset.h I see that we do

        while (p > p_min && !CHAR_HEAD_P (*p)) p--;

so if the buffer is filled with eight-bit-graphic we might skip backward
over the whole buffer before discovering that the char we want
to skip was just an eight-bit-graphic.

Do I understand the code correctly ?
If so, shouldn't we set p_min to a value like

        max (p_min, p - MAX_MULTIBYTE_LENGTH)

to make sure we don't hit this pathological case ?


        Stefan




reply via email to

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