Fix warnings from added -W flags

Fix a few warnings:

 idc.c: In function ‘IDC_get’:
 idc.c:248:12: warning: ‘idclen’ may be used uninitialised in this function [-Wuninitialized]

 image.c: In function ‘image_load’:
 image.c:37:15: warning: unused variable ‘bytes_read’ [-Wunused-variable]

Plus, a bunch of strict-aliasing warnings:

 image.c:101:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 [ similar warnings trimmed ]

when compiling image.c. Since struct external_PEI_DOS_hdr uses char[]
types for all members, we need to use accessors here.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-06-11 16:33:18 +08:00
parent 34edfd6348
commit ffc1f41ace
3 changed files with 40 additions and 10 deletions

4
idc.c
View file

@ -243,6 +243,10 @@ struct idc *IDC_get(PKCS7 *p7, BIO *bio)
idclen = (idcbuf[2] << 8) +
idcbuf[3];
idcbuf += 4;
} else {
fprintf(stderr, "Invalid ASN.1 data in "
"IndirectDataContext?\n");
return NULL;
}
BIO_write(bio, idcbuf, idclen);