[2/2] id3v2: simplify error handling.

Message ID 1300172063-14628-2-git-send-email-anton@khirnov.net
State Committed
Headers show

Commit Message

Anton Khirnov March 15, 2011, 6:54 a.m.
---
 libavformat/id3v2.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Comments

Kostya Shishkov March 15, 2011, 11:38 a.m. | #1
On Tue, Mar 15, 2011 at 07:54:22AM +0100, Anton Khirnov wrote:
> ---
>  libavformat/id3v2.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
> index 46648d5..7caadc3 100644
> --- a/libavformat/id3v2.c
> +++ b/libavformat/id3v2.c
> @@ -240,14 +240,12 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
>      if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
>          avio_seek(s->pb, 10, SEEK_CUR);
>  
> +  error:
> +    if (reason)
> +        av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
>      avio_seek(s->pb, end, SEEK_SET);
>      av_free(buffer);
>      return;
> -
> -  error:
> -    av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
> -    avio_seek(s->pb, len, SEEK_CUR);
> -    av_free(buffer);
>  }
>  
>  void ff_id3v2_read(AVFormatContext *s, const char *magic)
> -- 
> 1.7.4.1

ok
Ronald Bultje March 21, 2011, 7 p.m. | #2
Hi,

On Tue, Mar 15, 2011 at 7:38 AM, Kostya <kostya.shishkov@gmail.com> wrote:
> On Tue, Mar 15, 2011 at 07:54:22AM +0100, Anton Khirnov wrote:
>> ---
>>  libavformat/id3v2.c |    8 +++-----
>>  1 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
>> index 46648d5..7caadc3 100644
>> --- a/libavformat/id3v2.c
>> +++ b/libavformat/id3v2.c
>> @@ -240,14 +240,12 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
>>      if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
>>          avio_seek(s->pb, 10, SEEK_CUR);
>>
>> +  error:
>> +    if (reason)
>> +        av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
>>      avio_seek(s->pb, end, SEEK_SET);
>>      av_free(buffer);
>>      return;
>> -
>> -  error:
>> -    av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
>> -    avio_seek(s->pb, len, SEEK_CUR);
>> -    av_free(buffer);
>>  }
>>
>>  void ff_id3v2_read(AVFormatContext *s, const char *magic)
>> --
>> 1.7.4.1
>
> ok

Queued.

Ronald

Patch

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 46648d5..7caadc3 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -240,14 +240,12 @@  static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
     if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
         avio_seek(s->pb, 10, SEEK_CUR);
 
+  error:
+    if (reason)
+        av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
     avio_seek(s->pb, end, SEEK_SET);
     av_free(buffer);
     return;
-
-  error:
-    av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
-    avio_seek(s->pb, len, SEEK_CUR);
-    av_free(buffer);
 }
 
 void ff_id3v2_read(AVFormatContext *s, const char *magic)