summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2011-06-06 14:13:02 +0200
committerDiego Biurrun <diego@biurrun.de>2012-03-28 09:38:33 +0200
commita92be9b856bd11b081041c43c25d442028fe9a63 (patch)
tree32f852fdf904a30238c789e57510be710eaa7826 /libavformat
parent856c8e0a049dc7069b7504d3aaa48549c75852de (diff)
Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfcrypt.c3
-rw-r--r--libavformat/movenc.c3
-rw-r--r--libavformat/rtsp.c9
-rw-r--r--libavformat/sapenc.c3
-rw-r--r--libavformat/sdp.c6
-rw-r--r--libavformat/seek-test.c3
-rw-r--r--libavformat/tcp.c3
-rw-r--r--libavformat/udp.c3
-rw-r--r--libavformat/utils.c3
9 files changed, 12 insertions, 24 deletions
diff --git a/libavformat/asfcrypt.c b/libavformat/asfcrypt.c
index aea3d4f345..6c48a1967a 100644
--- a/libavformat/asfcrypt.c
+++ b/libavformat/asfcrypt.c
@@ -140,7 +140,7 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
struct AVRC4 rc4;
int num_qwords = len >> 3;
uint8_t *qwords = data;
- uint64_t rc4buff[8];
+ uint64_t rc4buff[8] = { 0 };
uint64_t packetkey;
uint32_t ms_keys[12];
uint64_t ms_state;
@@ -151,7 +151,6 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
return;
}
- memset(rc4buff, 0, sizeof(rc4buff));
av_rc4_init(&rc4, key, 12 * 8, 1);
av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
multiswap_init((uint8_t *)rc4buff, ms_keys);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1d808f128f..f776c7575c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -983,7 +983,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
- char compressor_name[32];
+ char compressor_name[32] = { 0 };
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -1014,7 +1014,6 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 0); /* Data size (= 0) */
avio_wb16(pb, 1); /* Frame count (= 1) */
- 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)
av_strlcpy(compressor_name,track->enc->codec->name,32);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 07cf80992e..fa761f54a8 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -157,8 +157,7 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
{
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(buf, NULL, &hints, &ai))
return -1;
@@ -497,9 +496,8 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
* The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
* in rtpdec_xiph.c. */
char buf[16384], *q;
- SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
+ SDPParseState sdp_parse_state = { { 0 } }, *s1 = &sdp_parse_state;
- memset(s1, 0, sizeof(SDPParseState));
p = content;
for (;;) {
p += strspn(p, SPACE_CHARS);
@@ -1955,7 +1953,7 @@ static int rtp_read_header(AVFormatContext *s)
int ret, port;
URLContext* in = NULL;
int payload_type;
- AVCodecContext codec;
+ AVCodecContext codec = { 0 };
struct sockaddr_storage addr;
AVIOContext pb;
socklen_t addrlen = sizeof(addr);
@@ -1996,7 +1994,6 @@ static int rtp_read_header(AVFormatContext *s)
ffurl_close(in);
in = NULL;
- memset(&codec, 0, sizeof(codec));
if (ff_rtp_get_codec_info(&codec, payload_type)) {
av_log(s, AV_LOG_ERROR, "Unable to receive RTP payload type %d "
"without an SDP file describing it\n",
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index dbd7bdb7b9..0913dd7a45 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -104,8 +104,7 @@ static int sap_write_header(AVFormatContext *s)
}
if (!announce_addr[0]) {
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index b2c4f7bcd8..9692aabbc0 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -88,7 +88,7 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
static int resolve_destination(char *dest_addr, int size, char *type,
int type_size)
{
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
int is_multicast;
av_strlcpy(type, "IP4", type_size);
@@ -98,7 +98,6 @@ static int resolve_destination(char *dest_addr, int size, char *type,
/* Resolve the destination, since it must be written
* as a numeric IP address in the SDP. */
- memset(&hints, 0, sizeof(hints));
if (getaddrinfo(dest_addr, NULL, &hints, &ai))
return 0;
getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
@@ -581,12 +580,11 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
- struct sdp_session_level s;
+ struct sdp_session_level s = { 0 };
int i, j, port, ttl, is_multicast;
char dst[32], dst_type[5];
memset(buf, 0, size);
- memset(&s, 0, sizeof(struct sdp_session_level));
s.user = "-";
s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */
s.src_type = "IP4";
diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 699c693c3f..57d3fa4da5 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -93,11 +93,10 @@ int main(int argc, char **argv)
}
for(i=0; ; i++){
- AVPacket pkt;
+ AVPacket pkt = { 0 };
AVStream *av_uninit(st);
char ts_buf[60];
- memset(&pkt, 0, sizeof(pkt));
if(ret>=0){
ret= av_read_frame(ic, &pkt);
if(ret>=0){
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fdb457e8c5..0ed11f321f 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -37,7 +37,7 @@ typedef struct TCPContext {
/* return non zero if error */
static int tcp_open(URLContext *h, const char *uri, int flags)
{
- struct addrinfo hints, *ai, *cur_ai;
+ struct addrinfo hints = { 0 }, *ai, *cur_ai;
int port, fd = -1;
TCPContext *s = h->priv_data;
int listen_socket = 0;
@@ -62,7 +62,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
timeout = strtol(buf, NULL, 10);
}
}
- memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, sizeof(portstr), "%d", port);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 37b76559e9..6571ab5d42 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -140,7 +140,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
static struct addrinfo* udp_resolve_host(const char *hostname, int port,
int type, int family, int flags)
{
- struct addrinfo hints, *res = 0;
+ struct addrinfo hints = { 0 }, *res = 0;
int error;
char sport[16];
const char *node = 0, *service = "0";
@@ -152,7 +152,6 @@ static struct addrinfo* udp_resolve_host(const char *hostname, int port,
if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
node = hostname;
}
- memset(&hints, 0, sizeof(hints));
hints.ai_socktype = type;
hints.ai_family = family;
hints.ai_flags = flags;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cb708addf4..f38045c5dd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3668,7 +3668,7 @@ int ff_url_join(char *str, int size, const char *proto,
int port, const char *fmt, ...)
{
#if CONFIG_NETWORK
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
#endif
str[0] = '\0';
@@ -3679,7 +3679,6 @@ int ff_url_join(char *str, int size, const char *proto,
#if CONFIG_NETWORK && defined(AF_INET6)
/* Determine if hostname is a numerical IPv6 address,
* properly escape it within [] in that case. */
- memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
if (!getaddrinfo(hostname, NULL, &hints, &ai)) {
if (ai->ai_family == AF_INET6) {