[FFmpeg-devel] [PATCH] Make nutdec return meaningful error codes.
Michael Niedermayer
michaelni
Fri Dec 31 21:30:19 CET 2010
On Tue, Dec 28, 2010 at 02:32:44AM +0100, Stefano Sabatini wrote:
> ---
> libavformat/nutdec.c | 62 +++++++++++++++++++++++++-------------------------
> 1 files changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
> index d5d7c2b..ee953d5 100644
> --- a/libavformat/nutdec.c
> +++ b/libavformat/nutdec.c
> @@ -49,7 +49,7 @@ static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
> string[FFMIN(len, maxlen-1)]= 0;
>
> if(maxlen == len)
> - return -1;
> + return AVERROR(EINVAL);
> else
> return 0;
> }
> @@ -66,7 +66,7 @@ static uint64_t get_fourcc(ByteIOContext *bc){
>
> if (len==2) return get_le16(bc);
> else if(len==4) return get_le32(bc);
> - else return -1;
> + else return AVERROR(EINVAL);
> }
>
> #ifdef TRACE
These error codes are wrong
[...]
> @@ -142,7 +142,7 @@ static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){
> * Find the given startcode.
> * @param code the startcode
> * @param pos the start position of the search, or -1 if the current position
> - * @return the position of the startcode or -1 if not found
> + * @return the position of the startcode or AVERROR(EINVAL) if not found
> */
> static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){
> for(;;){
> @@ -150,7 +150,7 @@ static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){
> if(startcode == code)
> return url_ftell(bc) - 8;
> else if(startcode == 0)
> - return -1;
> + return AVERROR(EINVAL);
> pos=-1;
> }
> }
rejected
[...]
> @@ -179,7 +179,7 @@ static int skip_reserved(ByteIOContext *bc, int64_t pos){
> pos -= url_ftell(bc);
> if(pos<0){
> url_fseek(bc, pos, SEEK_CUR);
> - return -1;
> + return pos;
> }else{
> while(pos--)
> get_byte(bc);
this introduces a bug nothing else
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101231/fb58116f/attachment.pgp>
More information about the ffmpeg-devel
mailing list