Re: more bug fixes
Jose Da Silva <[email protected]>
| Newsgroups | gmane.comp.fonts.fontforge.devel |
|---|---|
| Message-ID | <[email protected]> |
On October 14, 2013 03:35:55 AM Martin Hosken wrote:
> Fix a bug when loading Layer names. Half undo a previous commit which I
> am unsure as to why it was done.
>
> diff --git a/fontforge/sfd.c b/fontforge/sfd.c
> index 220d937..aaafbe7 100644
> --- a/fontforge/sfd.c
> +++ b/fontforge/sfd.c
> @@ -441,11 +441,11 @@ return( NULL );
> done = true;
> }
> }
> - if ( pt && pt+10>=end ) {
> + if ( pt+10>=end ) {
> if ( buffer==NULL ) {
> pt = buffer = galloc(400);
> end = buffer+400;
> - } else {
> + } else if (pt) {
> char *temp = grealloc(buffer,end-buffer+400);
> pt = temp+(pt-buffer);
> end = temp+(end-buffer+400);
>From my point of view, the way I see it...
It's somewhat difficult to fix higher-level routines and functions if you
can't really trust the lower level functions to be solid performers.
The previous utf8_idpb() function had the possibility of failing silently
if it encountered a bad code, which to me I think could have been improved
a bit further. The patches for utf8_ispb allows for the possibility of
returning failure to convert the last value by returning 0.
There are many routines within FontForge which could be treated similarly
in making them return fail/pass instead of assuming everything works 100%.
This routine 'above' really needs to be checked from top to bottom to
verify all if-then-else do what's expected.
The (pt && pt+10>=end) was just a 'quick' check for the possibility of if
pt becomes zero if utf8_idpb returns zero on error.
Ideally some of these routines, like the one 'above' and several others
should be made to recognize something failed, and relay that message of
fail/pass to the routine(s) that call them. Similarly, in the case of this
patched utf8_idpb(), some routines could also pass flags down if it seems
useful to code the output as utf8 or utf16, or in some cases substitute a
non-zero in place of zero (which could be confused as end-of-line).
It's great to know you see other edits/improvements/etc, or possible
pecularities that need questioning.
Thanks,
Joe
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk