From 01d2979bcef719734f6d8f061c539be9e830a110 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 20 Mar 2022 09:56:44 -0400 Subject: [COV] metadata module, fix uninit warnings #2 decrease size hit of initializing asf by using a union remove init from bytes LE conversion in metadata common -- bad idea for performance Change-Id: I4514adc125e5da2b99d9f913ba74afd5f1345822 --- lib/rbcodec/metadata/asf.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib/rbcodec/metadata/asf.c') diff --git a/lib/rbcodec/metadata/asf.c b/lib/rbcodec/metadata/asf.c index 06f7470a69..82c418cc73 100644 --- a/lib/rbcodec/metadata/asf.c +++ b/lib/rbcodec/metadata/asf.c @@ -129,19 +129,21 @@ static int asf_intdecode(int fd, int type, int length) { int bytes = 0; int ret; - uint16_t tmp16 = 0; - uint32_t tmp32 = 0; - uint64_t tmp64 = 0; + union { + uint16_t tmp16; + uint32_t tmp32; + uint64_t tmp64; + } uu = {0}; if (type == 3) { - bytes = read_uint32le(fd, &tmp32); - ret = (int)tmp32; + bytes = read_uint32le(fd, &uu.tmp32); + ret = (int)uu.tmp32; } else if (type == 4) { - bytes = read_uint64le(fd, &tmp64); - ret = (int)tmp64; + bytes = read_uint64le(fd, &uu.tmp64); + ret = (int)uu.tmp64; } else if (type == 5) { - bytes = read_uint16le(fd, &tmp16); - ret = (int)tmp16; + bytes = read_uint16le(fd, &uu.tmp16); + ret = (int)uu.tmp16; } if (bytes > 0) -- cgit v1.2.3