Skip to content

Commit

Permalink
tighten up some boundary cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Skala committed Apr 11, 2013
1 parent c3af61f commit 20bcd11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions fontforge/fontviewbase.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1475,13 +1475,13 @@ void FVRemoveUnused(FontViewBase *fv) {
int gid, i; int gid, i;
int flags = -1; int flags = -1;


for ( i=map->enccount-1; i>=0 && ((gid=map->map[i])==-1 || !SCWorthOutputting(sf->glyphs[gid])); for ( i=map->enccount-1;
i>=map->enc->char_cnt &&
((gid=map->map[i])==-1 || !SCWorthOutputting(sf->glyphs[gid]));
--i ) { --i ) {
if ( gid!=-1 ) if ( gid!=-1 )
SFRemoveGlyph(sf,sf->glyphs[gid],&flags); SFRemoveGlyph(sf,sf->glyphs[gid],&flags);
map->enccount = i; map->enccount = i;
if ( map->enccount==map->enc->char_cnt )
break;
} }
/* We reduced the encoding, so don't really need to reallocate the selection */ /* We reduced the encoding, so don't really need to reallocate the selection */
/* array. It's just bigger than it needs to be. */ /* array. It's just bigger than it needs to be. */
Expand Down
2 changes: 1 addition & 1 deletion fontforge/sfd.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8042,7 +8042,7 @@ exit( 1 );
} else if ( strmatch(tok,"BeginChars:")==0 ) { } else if ( strmatch(tok,"BeginChars:")==0 ) {
int charcnt; int charcnt;
getint(sfd,&charcnt); getint(sfd,&charcnt);
if (charcnt<enc->char_cnt && enc->char_cnt>0) { if (charcnt<enc->char_cnt) {
IError("SFD file specifies too few slots for its encoding.\n" ); IError("SFD file specifies too few slots for its encoding.\n" );
exit( 1 ); exit( 1 );
} }
Expand Down

0 comments on commit 20bcd11

Please sign in to comment.