[vlc-commits] snapshot: fix format string portability

Rémi Denis-Courmont git at videolan.org
Sun Mar 8 22:26:37 CET 2015


vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  1 11:52:46 2015 +0200| [ac1127173c3e137a663d8eb0d9f6bf0c341f3c7f] | committer: Jean-Baptiste Kempf

snapshot: fix format string portability

We cannot assume that timeval.tv_usec (i.e. suseconds_t) is long.

Reported-by: Ian Chamberlain <ian.h.chamberlain at gmail.com>
(cherry picked from commit ab8b6a88654fbe8c0b0664678c07a8191de16bac)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=ac1127173c3e137a663d8eb0d9f6bf0c341f3c7f
---

 src/video_output/snapshot.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index c8096ef..7b89803 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -190,9 +190,9 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
                          &curtime) == 0)
                 strcpy(buffer, "error");
 
-            if (asprintf(&filename, "%s" DIR_SEP "%s%s%03lu.%s",
-                         cfg->path, prefix, buffer, tv.tv_usec / 1000,
-                         cfg->format) < 0)
+            if (asprintf(&filename, "%s" DIR_SEP "%s%s%03u.%s",
+                         cfg->path, prefix, buffer,
+                         (unsigned)tv.tv_usec / 1000, cfg->format) < 0)
                 filename = NULL;
         }
         free(prefix);



More information about the vlc-commits mailing list