summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Williams <gww@silcom.com>2002-04-26 02:07:43 +0000
committerGeorge Williams <gww@silcom.com>2002-04-26 02:07:43 +0000
commitc9dcc8577e0a39967eb98b7c83dc0ebad656e458 (patch)
treea44781122a304d9bb96da5a05a2e1b6cc18e6c3d
parent76b840a35726c3105d6be8c4ae6cb47109d21a8c (diff)
Various fixes from Grigory Entin.
-rw-r--r--Makefile2
-rw-r--r--readnfnt.c2
-rw-r--r--showfond.c10
3 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b71c315..75da1f8 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
diff --git a/readnfnt.c b/readnfnt.c
index 2b44d19..d9dde25 100644
--- a/readnfnt.c
+++ b/readnfnt.c
@@ -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 )
diff --git a/showfond.c b/showfond.c
index 7be809a..1da45ba 100644
--- a/showfond.c
+++ b/showfond.c
@@ -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 );