diff options
author | George Williams <gww@silcom.com> | 2002-04-26 02:07:43 +0000 |
---|---|---|
committer | George Williams <gww@silcom.com> | 2002-04-26 02:07:43 +0000 |
commit | c9dcc8577e0a39967eb98b7c83dc0ebad656e458 (patch) | |
tree | a44781122a304d9bb96da5a05a2e1b6cc18e6c3d | |
parent | 76b840a35726c3105d6be8c4ae6cb47109d21a8c (diff) |
Various fixes from Grigory Entin.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | readnfnt.c | 2 | ||||
-rw-r--r-- | showfond.c | 10 |
3 files changed, 8 insertions, 6 deletions
@@ -23,7 +23,7 @@ dfont2res: $(DFONT2RESOBJS) $(CC) $(CFLAGS) -o dfont2res $(DFONT2RESOBJS) clean: - -rm -f *.o fondu ufond showfond + -rm -f *.o fondu ufond showfond dfont2res install: all cp fondu ufond showfond dfont2res $(bindir) @@ -436,6 +436,7 @@ void SearchNFNTResources(FILE *f,long rlistpos,int subcnt,long rdata_pos, /* The docs say that an sfnt will be found before an NFNT for a given id */ /* that appears to be a lie. An sfnt will be found for size==0, an NFNT else */ for ( mine = fonds; mine!=NULL; mine = mine->next ) { + int i; for ( i=0; i<mine->assoc_cnt; ++i ) if ( res_id==mine->assoc[i].id && mine->assoc[i].size!=0 ) { ass = &mine->assoc[i]; @@ -449,6 +450,7 @@ void SearchNFNTResources(FILE *f,long rlistpos,int subcnt,long rdata_pos, fseek(f,name_list+rname,SEEK_SET); ch1 = getc(f); fread(resname,1,ch1,f); + resname[ch1] = '\0'; sprintf( name, "%s-%d.bdf", resname, ass!=NULL?ass->size:font.fRectHeight ); } else if ( ass!=NULL ) { if ( mine->fondname==NULL ) @@ -370,7 +370,9 @@ void SearchNFNTResources(FILE *f,long rlistpos,int subcnt,long rdata_pos, fseek(f,name_list+rname,SEEK_SET); ch1 = getc(f); fread(resname,1,ch1,f); + resname[ch1] = '\0'; sprintf( name, "%s-%d.bdf", resname, ass!=NULL?ass->size:font.fRectHeight ); + fseek(f,here,SEEK_SET); } printf( "NFNT %d", res_id ); if ( resname[0]!='\0' ) @@ -512,18 +514,16 @@ return( true ); static int HasResourceFork(char *filename) { /* If we're on a mac, we can try to see if we've got a real resource fork */ - Str255 p_file; + FSRef ref; FSSpec spec; short res; int cnt, ret; FILE *temp; char *buf; - if ( strlen( filename )>255 ) + if ( FSPathMakeRef((unsigned char *) filename, &ref,NULL)!= noErr ) return( 0 ); - p_file[0] = strlen(filename); - strncpy((char *) p_file+1,filename,strlen(filename)); - if ( FSMakeFSSpec(0,0,p_file,&spec)!=noErr ) + if ( FSGetCatalogInfo(&ref,0,NULL,NULL,&spec,NULL)!=noErr ) return( 0 ); if ( FSpOpenRF(&spec,fsRdPerm,&res)!=noErr ) return( 0 ); |