[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspell-devel] The String class for 0.60 does not null terminate str
From: |
Gary Setter |
Subject: |
Re: [aspell-devel] The String class for 0.60 does not null terminate strings. |
Date: |
Mon, 27 Sep 2004 14:22:24 -0500 |
----- Original Message -----
From: "Kevin Atkinson" <address@hidden>
To: "Gary Setter" <address@hidden>
Cc: <address@hidden>
Sent: Monday, September 27, 2004 10:21 AM
Subject: Re: [aspell-devel] The String class for 0.60 does not
null terminate strings.
> On Mon, 27 Sep 2004, Gary Setter wrote:
>
> > > On Sun, 26 Sep 2004, Gary Setter wrote:
> > >
> > > > I'm doing a Win32 port. I just got it to compile and I'm
seeing
> > > > how things work. Right away I see that the String class
does not
> > > > null terminate.
> > >
> > > Can you be more specific. The String class does not always
null terminate
> > > but it does when needed.
> >
> > The version that I downloaded has a write date of 24-Jun-04
> > 11:07pm
> >
> > The c'tor from a const char * is
> >
> > String(const char * s) {assign_only(s);}
> >
> > assign only is
> > void assign_only(const char * b)
> > {
> > if (b && *b) assign_only_nonnull(b, strlen(b));
> > else zero();
> > }
> ...
> > You will call assign_only_nonnull with b= "a\0" and size = 1.
The
> > memmove will only copy one character ( the 'a' ) to
begin_[0],
> > begin_[1] is not initialized.
> > That is just one example.
> > Do you want to see my rendition?
>
> That is correct. The string is not guaranteed to be null
terminated. This
> is for performance reasons as is not always needed. This is
most apparent
> when appending one character at a time. The string is only
null
> terminated when c_Star() is called or ensure_null_end() is
called.
> Otherwise it leaves room for the null end but doesn't null
terminate the
> string. This is a design design on my part which I will not
change with
> out a very good reason.
>
> Fell free to submit a patch which adds some documentation on
the behavior
> of the String class.
>
Hi Kevin,
I showed all the methods that are used when constructing a String
object for a c string literal. One of those methods should have
null terminated the string that begin_ points to. None did. If
I'm wrong please show we where a String object constructed from a
const char * is null terminated.
I await you reply with keen interest.
Gary
- [aspell-devel] The String class for 0.60 does not null terminate strings., Gary Setter, 2004/09/26
- Re: [aspell-devel] The String class for 0.60 does not null terminate strings., Kevin Atkinson, 2004/09/26
- Re: [aspell-devel] The String class for 0.60 does not null terminate strings., Gary Setter, 2004/09/27
- Re: [aspell-devel] The String class for 0.60 does not null terminate strings., Kevin Atkinson, 2004/09/27
- Re: [aspell-devel] The String class for 0.60 does not null terminate strings.,
Gary Setter <=
- Re: [aspell-devel] The String class for 0.60 does not null terminate strings., Kevin Atkinson, 2004/09/27
- Re: [aspell-devel] The String class for 0.60 does not null terminatestrings., Gary Setter, 2004/09/27
- Re: [aspell-devel] The String class for 0.60 does not null terminatestrings., Kevin Atkinson, 2004/09/27
- Re: [aspell-devel] The String class for 0.60 does not nullterminatestrings., Lumina, 2004/09/27
- Re: [aspell-devel] The String class for 0.60 does not nullterminatestrings., Kevin Atkinson, 2004/09/27