Re: Font Problems



Eric Mader <mader jtcsv com> writes:

> At 08:43 AM 8/29/2002, Owen Taylor wrote:
> 
> >Looks good to commit, except that:
> >
> > >         cur_offset = FILE_Pos();
> > > -      if ( FILE_Seek( new_offset ) ||
> > > -           ( error = Load_Script( &sr[n].Script, stream ) ) != TT_Err_Ok )
> > > -        goto Fail;
> > > +
> > > +      if ( FILE_Seek( new_offset ) )
> > > +       goto Fail;
> > > +
> > > +      error = Load_Script( &sr[sl->ScriptCount].Script, stream );
> > > +      if ( error != TT_Err_Ok &&  error != TTO_Err_Empty_Script )
> > > +       goto Fail;
> > > +
> > > +      sl->ScriptCount += 1;
> > > +
> > >         (void)FILE_Seek( cur_offset );
> > >       }
> >
> >Don't you only want to increment sl->ScriptCount if
> >error != TT_Err_Empty_Script?
> >
> >Thanks,
> >                                         Owen
> 
> Ooops! You're right. This logic is a bit nastier than I was
> expecting... The obvious fix is to put another if in front of the
> increment, but that seems like an awful lot of testing. I'll think
> about this a bit and see if I can come up with a better way. Maybe a
> switch on error?

Won't something like:

     error = Load_Script( &sr[sl->ScriptCount].Script, stream );
     if ( error == TT_Err_Ok )
        sl->ScriptCount += 1;
     else if ( error != TTO_Err_Empty_Script )
        goto Fail;

Work fine?
                                        Owen



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