Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
1a5e4fd8
Commit
1a5e4fd8
authored
May 03, 2011
by
Alex Converse
Committed by
Alex Converse
May 04, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace strncpy() with av_strlcpy().
parent
aab6374b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
29 deletions
+32
-29
ffmpeg.c
ffmpeg.c
+1
-2
ac3enc.c
libavcodec/ac3enc.c
+22
-21
ass.c
libavcodec/ass.c
+2
-2
movenc.c
libavformat/movenc.c
+1
-1
mp3enc.c
libavformat/mp3enc.c
+2
-1
log.c
libavutil/log.c
+2
-1
postprocess.c
libpostproc/postprocess.c
+2
-1
No files found.
ffmpeg.c
View file @
1a5e4fd8
...
...
@@ -3695,8 +3695,7 @@ static int opt_streamid(const char *opt, const char *arg)
char
*
p
;
char
idx_str
[
16
];
strncpy
(
idx_str
,
arg
,
sizeof
(
idx_str
));
idx_str
[
sizeof
(
idx_str
)
-
1
]
=
'\0'
;
av_strlcpy
(
idx_str
,
arg
,
sizeof
(
idx_str
));
p
=
strchr
(
idx_str
,
':'
);
if
(
!
p
)
{
fprintf
(
stderr
,
...
...
libavcodec/ac3enc.c
View file @
1a5e4fd8
...
...
@@ -33,6 +33,7 @@
#include "libavutil/audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/crc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
...
...
@@ -1578,10 +1579,10 @@ static void dprint_options(AVCodecContext *avctx)
char
strbuf
[
32
];
switch
(
s
->
bitstream_id
)
{
case
6
:
strn
cpy
(
strbuf
,
"AC-3 (alt syntax)"
,
32
);
break
;
case
8
:
strn
cpy
(
strbuf
,
"AC-3 (standard)"
,
32
);
break
;
case
9
:
strn
cpy
(
strbuf
,
"AC-3 (dnet half-rate)"
,
32
);
break
;
case
10
:
strn
cpy
(
strbuf
,
"AC-3 (dnet quater-rate"
,
32
);
break
;
case
6
:
av_strl
cpy
(
strbuf
,
"AC-3 (alt syntax)"
,
32
);
break
;
case
8
:
av_strl
cpy
(
strbuf
,
"AC-3 (standard)"
,
32
);
break
;
case
9
:
av_strl
cpy
(
strbuf
,
"AC-3 (dnet half-rate)"
,
32
);
break
;
case
10
:
av_strl
cpy
(
strbuf
,
"AC-3 (dnet quater-rate"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR"
);
}
av_dlog
(
avctx
,
"bitstream_id: %s (%d)
\n
"
,
strbuf
,
s
->
bitstream_id
);
...
...
@@ -1608,9 +1609,9 @@ static void dprint_options(AVCodecContext *avctx)
if
(
opt
->
audio_production_info
)
{
av_dlog
(
avctx
,
"mixing_level: %ddB
\n
"
,
opt
->
mixing_level
);
switch
(
opt
->
room_type
)
{
case
0
:
strn
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
strn
cpy
(
strbuf
,
"large"
,
32
);
break
;
case
2
:
strn
cpy
(
strbuf
,
"small"
,
32
);
break
;
case
0
:
av_strl
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
av_strl
cpy
(
strbuf
,
"large"
,
32
);
break
;
case
2
:
av_strl
cpy
(
strbuf
,
"small"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR (%d)"
,
opt
->
room_type
);
}
av_dlog
(
avctx
,
"room_type: %s
\n
"
,
strbuf
);
...
...
@@ -1622,9 +1623,9 @@ static void dprint_options(AVCodecContext *avctx)
av_dlog
(
avctx
,
"dialnorm: %ddB
\n
"
,
opt
->
dialogue_level
);
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
)
{
switch
(
opt
->
dolby_surround_mode
)
{
case
0
:
strn
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
strn
cpy
(
strbuf
,
"on"
,
32
);
break
;
case
2
:
strn
cpy
(
strbuf
,
"off"
,
32
);
break
;
case
0
:
av_strl
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
av_strl
cpy
(
strbuf
,
"on"
,
32
);
break
;
case
2
:
av_strl
cpy
(
strbuf
,
"off"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR (%d)"
,
opt
->
dolby_surround_mode
);
}
av_dlog
(
avctx
,
"dsur_mode: %s
\n
"
,
strbuf
);
...
...
@@ -1636,9 +1637,9 @@ static void dprint_options(AVCodecContext *avctx)
if
(
s
->
bitstream_id
==
6
)
{
if
(
opt
->
extended_bsi_1
)
{
switch
(
opt
->
preferred_stereo_downmix
)
{
case
0
:
strn
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
strn
cpy
(
strbuf
,
"ltrt"
,
32
);
break
;
case
2
:
strn
cpy
(
strbuf
,
"loro"
,
32
);
break
;
case
0
:
av_strl
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
av_strl
cpy
(
strbuf
,
"ltrt"
,
32
);
break
;
case
2
:
av_strl
cpy
(
strbuf
,
"loro"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR (%d)"
,
opt
->
preferred_stereo_downmix
);
}
av_dlog
(
avctx
,
"dmix_mode: %s
\n
"
,
strbuf
);
...
...
@@ -1655,23 +1656,23 @@ static void dprint_options(AVCodecContext *avctx)
}
if
(
opt
->
extended_bsi_2
)
{
switch
(
opt
->
dolby_surround_ex_mode
)
{
case
0
:
strn
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
strn
cpy
(
strbuf
,
"on"
,
32
);
break
;
case
2
:
strn
cpy
(
strbuf
,
"off"
,
32
);
break
;
case
0
:
av_strl
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
av_strl
cpy
(
strbuf
,
"on"
,
32
);
break
;
case
2
:
av_strl
cpy
(
strbuf
,
"off"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR (%d)"
,
opt
->
dolby_surround_ex_mode
);
}
av_dlog
(
avctx
,
"dsurex_mode: %s
\n
"
,
strbuf
);
switch
(
opt
->
dolby_headphone_mode
)
{
case
0
:
strn
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
strn
cpy
(
strbuf
,
"on"
,
32
);
break
;
case
2
:
strn
cpy
(
strbuf
,
"off"
,
32
);
break
;
case
0
:
av_strl
cpy
(
strbuf
,
"notindicated"
,
32
);
break
;
case
1
:
av_strl
cpy
(
strbuf
,
"on"
,
32
);
break
;
case
2
:
av_strl
cpy
(
strbuf
,
"off"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR (%d)"
,
opt
->
dolby_headphone_mode
);
}
av_dlog
(
avctx
,
"dheadphone_mode: %s
\n
"
,
strbuf
);
switch
(
opt
->
ad_converter_type
)
{
case
0
:
strn
cpy
(
strbuf
,
"standard"
,
32
);
break
;
case
1
:
strn
cpy
(
strbuf
,
"hdcd"
,
32
);
break
;
case
0
:
av_strl
cpy
(
strbuf
,
"standard"
,
32
);
break
;
case
1
:
av_strl
cpy
(
strbuf
,
"hdcd"
,
32
);
break
;
default:
snprintf
(
strbuf
,
32
,
"ERROR (%d)"
,
opt
->
ad_converter_type
);
}
av_dlog
(
avctx
,
"ad_conv_type: %s
\n
"
,
strbuf
);
...
...
libavcodec/ass.c
View file @
1a5e4fd8
...
...
@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "ass.h"
#include "libavutil/avstring.h"
/**
* Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
...
...
@@ -117,8 +118,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
rects
[
sub
->
num_rects
]
->
type
=
SUBTITLE_ASS
;
rects
[
sub
->
num_rects
]
->
ass
=
av_malloc
(
len
+
dlen
+
1
);
strcpy
(
rects
[
sub
->
num_rects
]
->
ass
,
header
);
strncpy
(
rects
[
sub
->
num_rects
]
->
ass
+
len
,
dialog
,
dlen
);
rects
[
sub
->
num_rects
]
->
ass
[
len
+
dlen
]
=
0
;
av_strlcpy
(
rects
[
sub
->
num_rects
]
->
ass
+
len
,
dialog
,
dlen
+
1
);
sub
->
num_rects
++
;
return
dlen
;
}
libavformat/movenc.c
View file @
1a5e4fd8
...
...
@@ -827,7 +827,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
memset
(
compressor_name
,
0
,
32
);
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
if
(
track
->
mode
==
MODE_MOV
&&
track
->
enc
->
codec
&&
track
->
enc
->
codec
->
name
)
strncpy
(
compressor_name
,
track
->
enc
->
codec
->
name
,
31
);
av_strlcpy
(
compressor_name
,
track
->
enc
->
codec
->
name
,
32
);
avio_w8
(
pb
,
strlen
(
compressor_name
));
avio_write
(
pb
,
compressor_name
,
31
);
...
...
libavformat/mp3enc.c
View file @
1a5e4fd8
...
...
@@ -24,6 +24,7 @@
#include "id3v1.h"
#include "id3v2.h"
#include "rawenc.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
...
...
@@ -32,7 +33,7 @@ static int id3v1_set_string(AVFormatContext *s, const char *key,
{
AVMetadataTag
*
tag
;
if
((
tag
=
av_metadata_get
(
s
->
metadata
,
key
,
NULL
,
0
)))
strn
cpy
(
buf
,
tag
->
value
,
buf_size
);
av_strl
cpy
(
buf
,
tag
->
value
,
buf_size
);
return
!!
tag
;
}
...
...
libavutil/log.c
View file @
1a5e4fd8
...
...
@@ -26,6 +26,7 @@
#include <unistd.h>
#include <stdlib.h>
#include "avstring.h"
#include "avutil.h"
#include "log.h"
...
...
@@ -120,7 +121,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
count
=
0
;
}
colored_fputs
(
av_clip
(
level
>>
3
,
0
,
6
),
line
);
strn
cpy
(
prev
,
line
,
sizeof
line
);
av_strl
cpy
(
prev
,
line
,
sizeof
line
);
}
static
void
(
*
av_log_callback
)(
void
*
,
int
,
const
char
*
,
va_list
)
=
av_log_default_callback
;
...
...
libpostproc/postprocess.c
View file @
1a5e4fd8
...
...
@@ -86,6 +86,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
//#define DEBUG_BRIGHTNESS
#include "postprocess.h"
#include "postprocess_internal.h"
#include "libavutil/avstring.h"
unsigned
postproc_version
(
void
)
{
...
...
@@ -762,7 +763,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
ppMode
->
maxClippedThreshold
=
0
.
01
;
ppMode
->
error
=
0
;
strn
cpy
(
temp
,
name
,
GET_MODE_BUFFER_SIZE
);
av_strl
cpy
(
temp
,
name
,
GET_MODE_BUFFER_SIZE
);
av_log
(
NULL
,
AV_LOG_DEBUG
,
"pp: %s
\n
"
,
name
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment