From 22573502623f7526c4056f6ab8491ed8acf42bb0 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Sat, 16 Sep 2006 00:29:07 +0000 Subject: [PATCH] remove unused code that had the old way of stat()ing a filename to get the length --- src/libFLAC/stream_decoder.c | 44 --------------------------------- src/libOggFLAC/stream_decoder.c | 32 +----------------------- 2 files changed, 1 insertion(+), 75 deletions(-) diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 1cb233ca..d64280dd 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -63,8 +63,6 @@ #include "private/md5.h" #include "private/memory.h" -#undef OLD_STAT_WAY /*@@@@@@ old way of keeping the filename and using stat(); remove remnants once we know this works */ - #ifdef max #undef max #endif @@ -147,9 +145,6 @@ typedef struct FLAC__StreamDecoderPrivate { void (*local_lpc_restore_signal_16bit_order8)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); void *client_data; FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */ -#ifdef OLD_STAT_WAY - char *filename; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */ -#endif FLAC__BitBuffer *input; FLAC__int32 *output[FLAC__MAX_CHANNELS]; FLAC__int32 *residual[FLAC__MAX_CHANNELS]; /* WATCHOUT: these are the aligned pointers; the real pointers that should be free()'d are residual_unaligned[] below */ @@ -467,19 +462,6 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE( decoder->private_->file = file; -#ifdef OLD_STAT_WAY - if(0 != decoder->private_->filename) { - free(decoder->private_->filename); - decoder->private_->filename = 0; - } - if(filename) { - if(0 == (decoder->private_->filename = strdup(filename))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; - } - } -#endif - return FLAC__stream_decoder_init_stream( decoder, file_read_callback_, @@ -523,19 +505,6 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file( if(0 == file) return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE; -#ifdef OLD_STAT_WAY - if(0 != decoder->private_->filename) { - free(decoder->private_->filename); - decoder->private_->filename = 0; - } - if(filename) { - if(0 == (decoder->private_->filename = strdup(filename))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; - } - } -#endif - return FLAC__stream_decoder_init_FILE(decoder, file, write_callback, metadata_callback, error_callback, client_data); } @@ -587,13 +556,6 @@ FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) decoder->private_->file = 0; } -#ifdef OLD_STAT_WAY - if(0 != decoder->private_->filename) { - free(decoder->private_->filename); - decoder->private_->filename = 0; - } -#endif - if(decoder->private_->do_md5_checking) { if(memcmp(decoder->private_->stream_info.data.stream_info.md5sum, decoder->private_->computed_md5sum, 16)) md5_failed = true; @@ -1096,9 +1058,6 @@ void set_defaults_(FLAC__StreamDecoder *decoder) decoder->private_->metadata_callback = 0; decoder->private_->error_callback = 0; decoder->private_->client_data = 0; -#ifdef OLD_STAT_WAY - decoder->private_->filename = 0; -#endif memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter)); decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] = true; @@ -2892,9 +2851,6 @@ FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder if(decoder->private_->file == stdin) return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; -#ifdef OLD_STAT_WAY - else if(0 == decoder->private_->filename || fstat(fileno(decoder->private_->file), &filestats) != 0) -#endif else if(fstat(fileno(decoder->private_->file), &filestats) != 0) return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; else { diff --git a/src/libOggFLAC/stream_decoder.c b/src/libOggFLAC/stream_decoder.c index 53b3dd50..c39e952a 100644 --- a/src/libOggFLAC/stream_decoder.c +++ b/src/libOggFLAC/stream_decoder.c @@ -115,7 +115,6 @@ OggFLAC_API const char * const OggFLAC__StreamDecoderStateString[] = { "OggFLAC__STREAM_DECODER_READ_ERROR", "OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR", "OggFLAC__STREAM_DECODER_UNINITIALIZED" - //@@@@@@ }; @@ -267,19 +266,6 @@ OggFLAC_API FLAC__StreamDecoderInitStatus OggFLAC__stream_decoder_init_FILE( decoder->private_->file = file; -#ifdef OLD_STAT_WAY //@@@@@@ - if(0 != decoder->private_->filename) { - free(decoder->private_->filename); - decoder->private_->filename = 0; - } - if(filename) { - if(0 == (decoder->private_->filename = strdup(filename))) { - decoder->protected_->state = OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; - } - } -#endif - return OggFLAC__stream_decoder_init_stream( decoder, file_read_callback_, @@ -323,19 +309,6 @@ OggFLAC_API FLAC__StreamDecoderInitStatus OggFLAC__stream_decoder_init_file( if(0 == file) return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE; -#ifdef OLD_STAT_WAY //@@@@@@ - if(0 != decoder->private_->filename) { - free(decoder->private_->filename); - decoder->private_->filename = 0; - } - if(filename) { - if(0 == (decoder->private_->filename = strdup(filename))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; - } - } -#endif - return OggFLAC__stream_decoder_init_FILE(decoder, file, write_callback, metadata_callback, error_callback, client_data); } @@ -934,7 +907,7 @@ FLAC__bool seek_to_absolute_sample_(OggFLAC__StreamDecoder *decoder, FLAC__uint6 #endif /* @@@ TODO: might want to limit pos to some distance * before EOF, to make sure we land before the last frame, - * thereby getting a this_fram_sample and so having a better + * thereby getting a this_frame_sample and so having a better * estimate. @@@@@@DELETE:this would also mostly (or totally if we could * be sure to land before the last frame) avoid the * end-of-stream case we have to check later. @@ -1074,9 +1047,6 @@ FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder if(decoder->private_->file == stdin) return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; -#ifdef OLD_STAT_WAY //@@@@@@ - else if(0 == decoder->private_->filename || fstat(fileno(decoder->private_->file), &filestats) != 0) -#endif else if(fstat(fileno(decoder->private_->file), &filestats) != 0) return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; else {