diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/db.c | 12 | ||||
-rw-r--r-- | src/common/grfio.c | 23 |
2 files changed, 19 insertions, 16 deletions
diff --git a/src/common/db.c b/src/common/db.c index d76b7a44c..12d54176c 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -42,18 +42,20 @@ static void free_dbn(struct dbn* add_dbn) } #endif +// maybe change the void* to const char* ??? static int strdb_cmp(struct dbt* table,void* a,void* b) { if(table->maxlen) - return strncmp(a,b,table->maxlen); - return strcmp(a,b); + return strncmp((const char*)a,(const char*)b,table->maxlen); + return strcmp((const char*)a,(const char*)b); } +// maybe change the void* to unsigned char* ??? static unsigned int strdb_hash(struct dbt* table,void* a) { int i; unsigned int h; - unsigned char *p=a; + unsigned char *p = (unsigned char*)a; i=table->maxlen; if(i==0) i=0x7fffffff; @@ -131,14 +133,14 @@ void * db_search2(struct dbt *table, const char *key) { int i,sp; struct dbn *p,*pn,*stack[64]; - int slen = strlen(key); + int slen = strlen(key); for(i=0;i<HASH_SIZE;i++){ if((p=table->ht[i])==NULL) continue; sp=0; while(1){ - if (strnicmp(key, p->key, slen) == 0) + if (strnicmp(key, (const char*)p->key, slen) == 0) return p->data; if((pn=p->left)!=NULL){ if(p->right){ diff --git a/src/common/grfio.c b/src/common/grfio.c index 013c21c74..6454d5048 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -656,7 +656,7 @@ void* grfio_read(char *fname) * Resource filename decode *------------------------------------------ */ -static unsigned char * decode_filename(unsigned char *buf,int len) +static char * decode_filename(unsigned char *buf,int len) { int lop; for(lop=0;lop<len;lop+=8) { @@ -665,7 +665,7 @@ static unsigned char * decode_filename(unsigned char *buf,int len) BitConvert4(&buf[lop]); BitConvert(&buf[lop],BitSwapTable2); } - return buf; + return (char*)buf; } /*========================================== @@ -678,7 +678,7 @@ static int grfio_entryread(char *gfname,int gentry) int grf_size,list_size; unsigned char grf_header[0x2e]; int lop,entry,entrys,ofs,grf_version; - unsigned char *fname; + char *fname; unsigned char *grf_filelist; fp = fopen(gfname,"rb"); @@ -723,13 +723,13 @@ static int grfio_entryread(char *gfname,int gentry) type = grf_filelist[ofs2+12]; if( type!=0 ){ // Directory Index ... skip fname = decode_filename(grf_filelist+ofs+6,grf_filelist[ofs]-6); - if(strlen((const char *) fname)>sizeof(aentry.fn)-1){ + if(strlen(fname)>sizeof(aentry.fn)-1){ printf("file name too long : %s\n",fname); aFree(grf_filelist); exit(1); } srclen=0; - if((period_ptr=strrchr((const char *) fname,'.'))!=NULL){ + if((period_ptr=strrchr(fname,'.'))!=NULL){ for(lop=0;lop<4;lop++) { if(strcmpi(period_ptr,".gnd\0.gat\0.act\0.str"+lop*5)==0) break; @@ -750,7 +750,7 @@ static int grfio_entryread(char *gfname,int gentry) aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e; aentry.cycle = srccount; aentry.type = type; - strncpy(aentry.fn, (const char *) fname,sizeof(aentry.fn)-1); + strncpy(aentry.fn, fname,sizeof(aentry.fn)-1); #ifdef GRFIO_LOCAL aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck #else @@ -777,13 +777,13 @@ static int grfio_entryread(char *gfname,int gentry) return 4; } - rBuf = (unsigned char *) aCallocA( rSize , 1); // Get a Read Size + rBuf = (unsigned char *)aCallocA( rSize , 1); // Get a Read Size if (rBuf==NULL) { fclose(fp); printf("out of memory : grf compress entry table buffer\n"); return 3; } - grf_filelist = (unsigned char *) aCallocA( eSize , 1); // Get a Extend Size + grf_filelist = (unsigned char *)aCallocA( eSize , 1); // Get a Extend Size if (grf_filelist==NULL) { aFree(rBuf); fclose(fp); @@ -803,13 +803,14 @@ static int grfio_entryread(char *gfname,int gentry) int ofs2,srclen,srccount,type; FILELIST aentry; - fname = grf_filelist+ofs; - if (strlen((const char *) fname)>sizeof(aentry.fn)-1) { + fname = (char*)(grf_filelist+ofs); + if (strlen(fname)>sizeof(aentry.fn)-1) { printf("grf : file name too long : %s\n",fname); aFree(grf_filelist); exit(1); } - ofs2 = ofs+strlen(grf_filelist+ofs)+1; + //ofs2 = ofs+strlen((char*)(grf_filelist+ofs))+1; + ofs2 = ofs+strlen(fname)+1; type = grf_filelist[ofs2+12]; if(type==1 || type==3 || type==5) { srclen=getlong(grf_filelist+ofs2); |