Update DUMB to revision 33cd2c469ae9872dd0710297760bfb1dfe53a56d

- Made Oktalyzer reader more tolerant of truncated files



SVN r4080 (trunk)
This commit is contained in:
Randy Heit 2013-02-08 00:11:27 +00:00
parent 6d000a414a
commit d1ada02edb

View file

@ -230,6 +230,8 @@ static IFF_CHUNKED *dumbfile_read_okt(DUMBFILE *f)
chunk->type = bytes_read; chunk->type = bytes_read;
chunk->size = dumbfile_mgetl( f ); chunk->size = dumbfile_mgetl( f );
if ( dumbfile_error( f ) ) break;
chunk->data = (unsigned char *) malloc( chunk->size ); chunk->data = (unsigned char *) malloc( chunk->size );
if ( !chunk->data ) if ( !chunk->data )
{ {
@ -241,14 +243,25 @@ static IFF_CHUNKED *dumbfile_read_okt(DUMBFILE *f)
bytes_read = dumbfile_getnc( ( char * ) chunk->data, chunk->size, f ); bytes_read = dumbfile_getnc( ( char * ) chunk->data, chunk->size, f );
if ( bytes_read < (long)chunk->size ) if ( bytes_read < (long)chunk->size )
{ {
free( mod->chunks ); if ( bytes_read <= 0 ) {
free( mod ); free( chunk->data );
return NULL; break;
} else {
chunk->size = bytes_read;
mod->chunk_count++;
break;
}
} }
mod->chunk_count++; mod->chunk_count++;
} }
if ( !mod->chunk_count ) {
if ( mod->chunks ) free(mod->chunks);
free(mod);
mod = NULL;
}
return mod; return mod;
} }
@ -484,6 +497,9 @@ static DUMB_IT_SIGDATA *it_okt_load_sigdata(DUMBFILE *f, int restrict)
j++; j++;
} }
} }
for (; i < sigdata->n_samples; i++) {
sigdata->sample[i].flags = 0;
}
chunk = get_chunk_by_type(mod, DUMB_ID('C','M','O','D'), 0); chunk = get_chunk_by_type(mod, DUMB_ID('C','M','O','D'), 0);