aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/argo_asf.c
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2021-10-12 20:45:45 +1000
committerZane van Iperen <zane@zanevaniperen.com>2021-10-15 23:39:47 +1000
commit20fa838da5a1cce23cb571781fc7fae4b18146ae (patch)
treed87ff997928200bf6baa42a297ba5beb7657a059 /libavformat/argo_asf.c
parent2c734a84964c6f6896194b0a3175124897468eac (diff)
downloadffmpeg-20fa838da5a1cce23cb571781fc7fae4b18146ae.tar.gz
avformat/argo_asf: cleanup and NULL-terminate name field in header
Preparation for metadata changes in the following patches. Saves having to create an extra buffer. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Diffstat (limited to 'libavformat/argo_asf.c')
-rw-r--r--libavformat/argo_asf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 7e759c7c0c..acf30839b9 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -52,8 +52,8 @@ void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf)
hdr->version_minor = AV_RL16(buf + 6);
hdr->num_chunks = AV_RL32(buf + 8);
hdr->chunk_offset = AV_RL32(buf + 12);
- for (int i = 0; i < FF_ARRAY_ELEMS(hdr->name); i++)
- hdr->name[i] = AV_RL8(buf + 16 + i);
+ memcpy(hdr->name, buf + 16, ASF_NAME_SIZE);
+ hdr->name[ASF_NAME_SIZE] = '\0';
}
int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr)
@@ -331,7 +331,7 @@ static void argo_asf_write_file_header(const ArgoASFFileHeader *fhdr, AVIOContex
avio_wl16( pb, fhdr->version_minor);
avio_wl32( pb, fhdr->num_chunks);
avio_wl32( pb, fhdr->chunk_offset);
- avio_write(pb, fhdr->name, sizeof(fhdr->name));
+ avio_write(pb, fhdr->name, ASF_NAME_SIZE);
}
static void argo_asf_write_chunk_header(const ArgoASFChunkHeader *ckhdr, AVIOContext *pb)
@@ -368,7 +368,7 @@ static int argo_asf_write_header(AVFormatContext *s)
} else {
len = end - name;
}
- memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name)));
+ memcpy(fhdr.name, name, FFMIN(len, ASF_NAME_SIZE));
chdr.num_blocks = 0;
chdr.num_samples = ASF_SAMPLE_COUNT;