From: Josh Coalson Date: Sun, 15 Oct 2006 17:08:52 +0000 (+0000) Subject: change "bytes" parameter of all encoder write callbacks from "unsigned" to "size_t" X-Git-Tag: 1.2.0~348 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=352feb540f5254c3dca68885e089387ac00ddc6b;p=platform%2Fupstream%2Fflac.git change "bytes" parameter of all encoder write callbacks from "unsigned" to "size_t" --- diff --git a/include/FLAC++/encoder.h b/include/FLAC++/encoder.h index a5060b4..c2f3dee 100644 --- a/include/FLAC++/encoder.h +++ b/include/FLAC++/encoder.h @@ -180,7 +180,7 @@ namespace FLAC { virtual ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes); /// See FLAC__StreamEncoderWriteCallback - virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0; + virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) = 0; /// See FLAC__StreamEncoderSeekCallback virtual ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset); @@ -201,7 +201,7 @@ namespace FLAC { ::FLAC__StreamEncoder *encoder_; static ::FLAC__StreamEncoderReadStatus read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); - static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); static ::FLAC__StreamEncoderSeekStatus seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); static ::FLAC__StreamEncoderTellStatus tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); static void metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data); @@ -247,7 +247,7 @@ namespace FLAC { virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate); /// This is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer - virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame); + virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame); private: static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); diff --git a/include/FLAC/all.h b/include/FLAC/all.h index 65a7548..4b493fd 100644 --- a/include/FLAC/all.h +++ b/include/FLAC/all.h @@ -313,9 +313,9 @@ * FLAC__metadata_object_cuesheet_calculate_cddb_id() and * FLAC__metadata_get_cuesheet(). * - * The \a bytes parameter to FLAC__StreamDecoderReadCallback and - * FLAC__StreamEncoderReadCallback is now \c size_t instead of - * \c unsigned. + * The \a bytes parameter to FLAC__StreamDecoderReadCallback, + * FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback + * is now \c size_t instead of \c unsigned. */ /** \defgroup flac FLAC C API diff --git a/include/FLAC/stream_encoder.h b/include/FLAC/stream_encoder.h index 3851fc3..7cddc06 100644 --- a/include/FLAC/stream_encoder.h +++ b/include/FLAC/stream_encoder.h @@ -522,7 +522,7 @@ typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const F * \retval FLAC__StreamEncoderWriteStatus * The callee's return status. */ -typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); +typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); /** Signature for the seek callback. * diff --git a/src/libFLAC++/stream_encoder.cpp b/src/libFLAC++/stream_encoder.cpp index 0dc4398..cd17a76 100644 --- a/src/libFLAC++/stream_encoder.cpp +++ b/src/libFLAC++/stream_encoder.cpp @@ -401,7 +401,7 @@ namespace FLAC { return instance->read_callback(buffer, bytes); } - ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) + ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) { (void)encoder; FLAC__ASSERT(0 != client_data); @@ -490,7 +490,7 @@ namespace FLAC { // with FLAC__stream_decoder_init_FILE() or // FLAC__stream_decoder_init_file() and those supply the read // callback internally. - ::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) + ::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) { (void)buffer, (void)bytes, (void)samples, (void)current_frame; FLAC__ASSERT(false); diff --git a/src/libFLAC/include/private/ogg_encoder_aspect.h b/src/libFLAC/include/private/ogg_encoder_aspect.h index 06d5ed9..0cda547 100644 --- a/src/libFLAC/include/private/ogg_encoder_aspect.h +++ b/src/libFLAC/include/private/ogg_encoder_aspect.h @@ -56,7 +56,7 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect); FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect); void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect); -typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); +typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); -FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data); +FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data); #endif diff --git a/src/libFLAC/ogg_encoder_aspect.c b/src/libFLAC/ogg_encoder_aspect.c index c6eb285..9c2a00c 100644 --- a/src/libFLAC/ogg_encoder_aspect.c +++ b/src/libFLAC/ogg_encoder_aspect.c @@ -108,7 +108,7 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect) * separate write callback for the fLaC magic, and then separate write * callbacks for each metadata block and audio frame. */ -FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data) +FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data) { /* WATCHOUT: * This depends on the behavior of FLAC__StreamEncoder that 'samples' diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index f5d9595..51d9c39 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -108,7 +108,7 @@ static void set_defaults_(FLAC__StreamEncoder *encoder); static void free_(FLAC__StreamEncoder *encoder); static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_size); static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples); -static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples); +static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples); static void update_metadata_(const FLAC__StreamEncoder *encoder); #if FLAC__HAS_OGG static void update_ogg_metadata_(FLAC__StreamEncoder *encoder); @@ -314,7 +314,7 @@ static void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__Str static FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); static FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); static FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); -static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); +static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); static FILE *get_binary_stdout_(); @@ -2430,7 +2430,7 @@ FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_size) FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples) { const FLAC__byte *buffer; - unsigned bytes; + size_t bytes; FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(encoder->private_->frame)); @@ -2468,7 +2468,7 @@ FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples) return true; } -FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples) +FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples) { FLAC__StreamEncoderWriteStatus status; FLAC__uint64 output_position = 0; @@ -4449,7 +4449,7 @@ static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *st #define local__fwrite fwrite #endif -FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) { (void)client_data, (void)current_frame; diff --git a/src/test_libFLAC++/encoders.cpp b/src/test_libFLAC++/encoders.cpp index bbc0560..71803bc 100644 --- a/src/test_libFLAC++/encoders.cpp +++ b/src/test_libFLAC++/encoders.cpp @@ -95,7 +95,7 @@ public: // from FLAC::Encoder::Stream ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes); - ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame); + ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame); ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset); ::FLAC__StreamEncoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset); void metadata_callback(const ::FLAC__StreamMetadata *metadata); @@ -108,7 +108,7 @@ public: return ::FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; } -::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) +::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) { (void)buffer, (void)bytes, (void)samples, (void)current_frame; diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c index c86beee..686cc17 100644 --- a/src/test_libFLAC/encoders.c +++ b/src/test_libFLAC/encoders.c @@ -95,7 +95,7 @@ static FLAC__StreamEncoderReadStatus stream_encoder_read_callback_(const FLAC__S return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; } -static FLAC__StreamEncoderWriteStatus stream_encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +static FLAC__StreamEncoderWriteStatus stream_encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) { (void)encoder, (void)buffer, (void)bytes, (void)samples, (void)current_frame, (void)client_data; return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; diff --git a/src/test_libs_common/file_utils_flac.c b/src/test_libs_common/file_utils_flac.c index a45f21c..d6dbc4b 100644 --- a/src/test_libs_common/file_utils_flac.c +++ b/src/test_libs_common/file_utils_flac.c @@ -50,7 +50,7 @@ typedef struct { FILE *file; } encoder_client_struct; -static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) { encoder_client_struct *ecd = (encoder_client_struct*)client_data;