summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-31 13:18:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-31 13:34:32 +0200
commitc617bed34f39a122ab1f89581ddce9cc63885383 (patch)
treeed2c0bd467f5f5c912ac46a2b95457a5647ced75 /tools
parent98298eb1034bddb4557fa689553dae793c2b0092 (diff)
parentede3d6400d7c06863e6eb4bcff5f676480ae6b5e (diff)
downloadffmpeg-streaming-c617bed34f39a122ab1f89581ddce9cc63885383.zip
ffmpeg-streaming-c617bed34f39a122ab1f89581ddce9cc63885383.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: MSS1 and MSS2: set final pixel format after common stuff has been initialised MSS2 decoder configure: handle --disable-asm before check_deps x86: Split inline and external assembly #ifdefs configure: x86: Separate inline from standalone assembler capabilities pktdumper: Use a custom define instead of PATH_MAX for buffers pktdumper: Use av_strlcpy instead of strncpy pktdumper: Use sizeof(variable) instead of the direct buffer length Conflicts: Changelog configure libavcodec/allcodecs.c libavcodec/avcodec.h libavcodec/codec_desc.c libavcodec/dct-test.c libavcodec/imgconvert.c libavcodec/mss12.c libavcodec/version.h libavfilter/x86/gradfun.c libswscale/x86/yuv2rgb.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools')
-rw-r--r--tools/pktdumper.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index 3fb94f6..2a80b25 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -31,6 +31,9 @@
#include <io.h>
#endif
+#define FILENAME_BUF_SIZE 4096
+
+#include "libavutil/avstring.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
@@ -48,8 +51,8 @@ static int usage(int ret)
int main(int argc, char **argv)
{
- char fntemplate[PATH_MAX];
- char pktfilename[PATH_MAX];
+ char fntemplate[FILENAME_BUF_SIZE];
+ char pktfilename[FILENAME_BUF_SIZE];
AVFormatContext *fctx = NULL;
AVPacket pkt;
int64_t pktnum = 0;
@@ -70,16 +73,16 @@ int main(int argc, char **argv)
return usage(1);
if (argc > 2)
maxpkts = atoi(argv[2]);
- strncpy(fntemplate, argv[1], PATH_MAX - 1);
+ av_strlcpy(fntemplate, argv[1], sizeof(fntemplate));
if (strrchr(argv[1], '/'))
- strncpy(fntemplate, strrchr(argv[1], '/') + 1, PATH_MAX - 1);
+ av_strlcpy(fntemplate, strrchr(argv[1], '/') + 1, sizeof(fntemplate));
if (strrchr(fntemplate, '.'))
*strrchr(fntemplate, '.') = '\0';
if (strchr(fntemplate, '%')) {
fprintf(stderr, "can't use filenames containing '%%'\n");
return usage(1);
}
- if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= PATH_MAX - 1) {
+ if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= sizeof(fntemplate) - 1) {
fprintf(stderr, "filename too long\n");
return usage(1);
}
@@ -105,7 +108,7 @@ int main(int argc, char **argv)
while ((err = av_read_frame(fctx, &pkt)) >= 0) {
int fd;
- snprintf(pktfilename, PATH_MAX - 1, fntemplate, pktnum,
+ snprintf(pktfilename, sizeof(pktfilename), fntemplate, pktnum,
pkt.stream_index, pkt.pts, pkt.size,
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size,
OpenPOWER on IntegriCloud