aspell-devel
[Top][All Lists]
Advanced

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

Re: [aspell-devel] clear_session, store_replacement, and support


From: Gary Setter
Subject: Re: [aspell-devel] clear_session, store_replacement, and support
Date: Sun, 14 Aug 2005 08:41:27 -0500

----- Original Message ----- 
From: "Kevin Atkinson" <address@hidden>
To: "Bill Moseley" <address@hidden>
Cc: <address@hidden>
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





reply via email to

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