Re: clear_session, store_replacement, and support

"Gary Setter" <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <000801c5a0d5$f1a185e0$85144a0c@pavilion>
----- Original Message ----- 
From: "Kevin Atkinson" <[email protected]>
To: "Bill Moseley" <[email protected]>
Cc: <[email protected]>
Sent: Sunday, August 14, 2005 1:51 AM
Subject: Re: [aspell-devel] clear_session, store_replacement, and
support


> On Thu, 28 Jul 2005, Bill Moseley wrote:
>
> > The questions I referred to above are about store_replacement
failing
> > to return a true value.  aspell.h has only this:
> >
> >     int aspell_speller_store_replacement(struct AspellSpeller
* ths, const char * mis, int mis_size, const char * cor, int
cor_size);
> >
> > And from my *brief* look at the code it seems as if it should
return a
> > value indicating an error, although I didn't dig that deep:
> >
> > extern "C" int aspell_speller_store_replacement(Speller *
ths, const char * mis, int mis_size, const char * cor, int
cor_size)
> > {
> >   ths->temp_str_0.clear();
> >   ths->to_internal_->convert(mis, mis_size, ths->temp_str_0);
> >   unsigned int s0 = ths->temp_str_0.size();
> >   ths->temp_str_1.clear();
> >   ths->to_internal_->convert(cor, cor_size, ths->temp_str_1);
> >   unsigned int s1 = ths->temp_str_1.size();
> >   PosibErr<bool> ret =
ths->store_replacement(MutableString(ths->temp_str_0.mstr(), s0),
MutableString(ths->temp_str_1.mstr(), s1));
> >   ths->err_.reset(ret.release_err());
> >   if (ths->err_ != 0) return -1;
> >   return ret.data;
> > }
>
> OK.  After close examination this function is incorrect.  The
internal
> API function returns a PosibErr<void> which means that it
doesn't actually
> return a value except an error condition.   Thus I am casing a
void to a
> bool somewhere.  The resulting bool is actually uninitialized.
Thus the
> function return value is also uninitialized.
>
> I will fix this in Aspell 0.60.4.  This function will now
return true on
> success and false on an error condition to be consistent with
the other
> functions which don't return value.
>
Hi,
I submitted a patch for this. See 1247610
Gary
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.