diff options
author | James Almer <jamrial@gmail.com> | 2015-12-03 01:39:47 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2015-12-03 01:39:47 -0300 |
commit | 9ac5beaa86b55a6121c30ffb3b75a9d923343c35 (patch) | |
tree | 7032eaf43ea622b1e4e38dbdcdf2cc5e1062cdb5 | |
parent | b46dcd5209a77254345ae098b83a872634c5591b (diff) | |
download | ffmpeg-9ac5beaa86b55a6121c30ffb3b75a9d923343c35.tar.gz |
avformat/mpjpegdec: fix mixed declarations and code
-rw-r--r-- | libavformat/mpjpegdec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c index b644ee400f..49fe6f650e 100644 --- a/libavformat/mpjpegdec.c +++ b/libavformat/mpjpegdec.c @@ -39,10 +39,12 @@ typedef struct MPJPEGDemuxContext { static void trim_right(char *p) { + char *end; + if (!p || !*p) return; - char *end = p + strlen(p); + end = p + strlen(p); while (end > p && av_isspace(*(end-1))) *(--end) = '\0'; } @@ -330,8 +332,10 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt) while ((ret = av_append_packet(s->pb, pkt, read_chunk - remaining)) >= 0) { /* scan the new data */ + char *start; + len = ret + remaining; - char *start = pkt->data + pkt->size - len; + start = pkt->data + pkt->size - len; do { if (!memcmp(start, mpjpeg->searchstr, mpjpeg->searchstr_len)) { // got the boundary! rewind the stream |