[FFmpeg-devel] [PATCH] avformat/subtitles: Use size_t for len

Michael Niedermayer michaelni at gmx.at
Mon May 11 12:43:31 CEST 2015


On Mon, May 11, 2015 at 07:30:53AM +0200, Clément Bœsch wrote:
> On Sun, May 10, 2015 at 03:38:40PM +0200, Michael Niedermayer wrote:
> > string length could theoretically be larger than int
> > 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/subtitles.c |    4 ++--
> >  libavformat/subtitles.h |    2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
> > index 67624fc..5bdbc8d 100644
> > --- a/libavformat/subtitles.c
> > +++ b/libavformat/subtitles.c
> > @@ -109,7 +109,7 @@ int ff_text_peek_r8(FFTextReader *r)
> >  }
> >  
> >  AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
> > -                                    const uint8_t *event, int len, int merge)
> > +                                    const uint8_t *event, size_t len, int merge)
> >  {
> >      AVPacket *subs, *sub;
> >  
> > @@ -303,7 +303,7 @@ int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c)
> >  const char *ff_smil_get_attr_ptr(const char *s, const char *attr)
> >  {
> >      int in_quotes = 0;
> > -    const int len = strlen(attr);
> > +    const size_t len = strlen(attr);
> >  
> >      while (*s) {
> >          while (*s) {
> > diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
> > index eb719ea..885285c 100644
> > --- a/libavformat/subtitles.h
> > +++ b/libavformat/subtitles.h
> > @@ -116,7 +116,7 @@ typedef struct {
> >   *              previous one instead of adding a new entry, 0 otherwise
> >   */
> >  AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
> > -                                    const uint8_t *event, int len, int merge);
> > +                                    const uint8_t *event, size_t len, int merge);
> >  
> >  /**
> >   * Set missing durations and sort subtitles by PTS, and then byte position.
> 
> LGTM

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150511/c5e60014/attachment.asc>


More information about the ffmpeg-devel mailing list