@@ -73,8 +73,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp)
/*
* Check for bmp mark 'BM'
*/
- if (!((bmp->header.signature[0] == 'B') &&
- (bmp->header.signature[1] == 'M'))) {
+ if (!bmp_signature_valid(bmp)) {
free(dst);
return NULL;
}
@@ -191,8 +190,7 @@ static int bmp_info(ulong addr)
bmp_image_t *bmp=(bmp_image_t *)addr;
unsigned long len;
- if (!((bmp->header.signature[0]=='B') &&
- (bmp->header.signature[1]=='M')))
+ if (!bmp_signature_valid(bmp))
bmp = gunzip_bmp(addr, &len);
if (bmp == NULL) {
@@ -200,10 +198,10 @@ static int bmp_info(ulong addr)
return 1;
}
- printf("Image size : %d x %d\n", le32_to_cpu(bmp->header.width),
- le32_to_cpu(bmp->header.height));
- printf("Bits per pixel: %d\n", le16_to_cpu(bmp->header.bit_count));
- printf("Compression : %d\n", le32_to_cpu(bmp->header.compression));
+ printf("Image size : %d x %d\n", bmp_get_width(bmp),
+ bmp_get_height(bmp));
+ printf("Bits per pixel: %d\n", bmp_get_bit_count(bmp));
+ printf("Compression : %d\n", bmp_get_compression(bmp));
if ((unsigned long)bmp != addr)
free(bmp);
@@ -227,8 +225,7 @@ int bmp_display(ulong addr, int x, int y)
bmp_image_t *bmp = (bmp_image_t *)addr;
unsigned long len;
- if (!((bmp->header.signature[0]=='B') &&
- (bmp->header.signature[1]=='M')))
+ if (!bmp_signature_valid(bmp))
bmp = gunzip_bmp(addr, &len);
if (!bmp) {