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

Michael Niedermayer git at videolan.org
Wed Jun 17 22:09:37 CEST 2015


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Sun May 10 15:38:40 2015 +0200| [404db2b99eca0e71cc8026839c6e1fc43f2c86e3] | committer: Michael Niedermayer

avformat/subtitles: Use size_t for len

string length could theoretically be larger than int

Reviewed-by: Clément Bœsch <u at pkh.me>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit a633928d47057426a9c328da594407d1c7da8a5c)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=404db2b99eca0e71cc8026839c6e1fc43f2c86e3
---

 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 fce2bf1..b7795d8 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -24,7 +24,7 @@
 #include "libavutil/avstring.h"
 
 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;
 
@@ -218,7 +218,7 @@ int ff_smil_extract_next_chunk(AVIOContext *pb, 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 b5a96ec..5ed23d0 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -47,7 +47,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.



More information about the ffmpeg-cvslog mailing list