[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
This commit is contained in:
William Wilgus 2022-03-20 09:56:44 -04:00
parent 2a88ec50cd
commit 01d2979bce
2 changed files with 12 additions and 10 deletions

View file

@ -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)

View file

@ -98,7 +98,7 @@ int read_uint32be(int fd, uint32_t* buf)
int read_uint64be(int fd, uint64_t* buf)
{
size_t n;
uint8_t data[8] = {0};
uint8_t data[8];
int i;
n = read(fd, data, 8);