X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FlibFLAC%2Fstream_encoder.c;h=83849d4a8df00535096db37147074976ee0e51cc;hb=6497ce19770ec48d565f3a043cc74c9c389c7829;hp=79ed89e805d044a5f2e4c2c764b47d9e3f2c672d;hpb=70be52b1dd694068fc4ee005a2a588a93e1915e0;p=platform%2Fupstream%2Fflac.git diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index 79ed89e..83849d4 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -40,8 +40,6 @@ #include /* for off_t */ #include "FLAC/assert.h" #include "FLAC/stream_decoder.h" -#include "share/alloc.h" -#include "share/compat.h" #include "protected/stream_encoder.h" #include "private/bitwriter.h" #include "private/bitmath.h" @@ -59,6 +57,9 @@ #endif #include "private/stream_encoder_framing.h" #include "private/window.h" +#include "share/alloc.h" +#include "share/compat.h" +#include "share/private.h" /* Exact Rice codeword length calculation is off by default. The simple @@ -738,12 +739,12 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( #if FLAC__HAS_OGG /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */ if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1) { - unsigned i; - for(i = 1; i < encoder->protected_->num_metadata_blocks; i++) { - if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - FLAC__StreamMetadata *vc = encoder->protected_->metadata[i]; - for( ; i > 0; i--) - encoder->protected_->metadata[i] = encoder->protected_->metadata[i-1]; + unsigned i1; + for(i1 = 1; i1 < encoder->protected_->num_metadata_blocks; i1++) { + if(0 != encoder->protected_->metadata[i1] && encoder->protected_->metadata[i1]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + FLAC__StreamMetadata *vc = encoder->protected_->metadata[i1]; + for( ; i1 > 0; i1--) + encoder->protected_->metadata[i1] = encoder->protected_->metadata[i1-1]; encoder->protected_->metadata[0] = vc; break; } @@ -752,10 +753,10 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( #endif /* keep track of any SEEKTABLE block */ if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) { - unsigned i; - for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { - if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) { - encoder->private_->seek_table = &encoder->protected_->metadata[i]->data.seek_table; + unsigned i2; + for(i2 = 0; i2 < encoder->protected_->num_metadata_blocks; i2++) { + if(0 != encoder->protected_->metadata[i2] && encoder->protected_->metadata[i2]->type == FLAC__METADATA_TYPE_SEEKTABLE) { + encoder->private_->seek_table = &encoder->protected_->metadata[i2]->data.seek_table; break; /* take only the first one */ } }