[FFmpeg-devel] [PATCH 7/8] Split away the "found" case in ff_h264_find_frame_end().

Diego 'Flameeyes' Pettenò flameeyes
Thu Oct 2 16:39:57 CEST 2008


With the original code, ICC issued this warning:

libavcodec/h264_parser.c(77): warning #589: transfer of control
bypasses initialization of:
            variable "v" (declared at line 58)
                  goto found;

since the found branch was part of another branch where a variable v
was declared; since the branch is a returning branch, independent of
all the remaining variables, split it at the end of the function.
---

 libavcodec/h264_parser.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 7a85d77..73b1569 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -59,10 +59,7 @@ int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
             if(v==7 || v==8 || v==9){
                 if(pc->frame_start_found){
                     i++;
-found:
-                    pc->state=7;
-                    pc->frame_start_found= 0;
-                    return i-(state&5);
+                    goto found;
                 }
             }else if(v==1 || v==2 || v==5){
                 if(pc->frame_start_found){
@@ -80,6 +77,11 @@ found:
     }
     pc->state= state;
     return END_NOT_FOUND;
+
+found:
+    pc->state=7;
+    pc->frame_start_found= 0;
+    return i-(state&5);
 }
 
 static int h264_parse(AVCodecParserContext *s,





More information about the ffmpeg-devel mailing list