uchar *ptr;
ushort *ptr2;
ushort val;
- unsigned char *dst;
+ unsigned char *dst = NULL;
int x, y;
int width, height, bpp, colors, line_size;
int header_size;
unsigned char r, g, b;
BITMAPINFOHEADER *bm_info;
ulong len;
- int do_free = 0;
/*
* Check for bmp mark 'BM'
* Decompress bmp image
*/
len = CFG_VIDEO_LOGO_MAX_SIZE;
- dst = malloc(CFG_LCD_LOGO_MAX_SIZE);
- do_free = 1;
- if (gunzip(dst, CFG_LCD_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+ dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+ if (dst == NULL) {
+ printf("Error: malloc in gunzip failed!\n");
return;
}
+ if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+ return;
+ }
+ if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+ printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+ }
/*
* Check for bmp mark 'BM'
break;
default:
printf("LCD: Unknown bpp (%d) im image!\n", bpp);
- free(dst);
+ if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
+ free(dst);
+ }
return;
}
printf(" (%d*%d, %dbpp)\n", width, height, bpp);
}
}
- if (do_free) {
+ if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
free(dst);
}
}
/*
* Detect epson
*/
+ lcd_reg[0] = 0x00;
+ lcd_reg[1] = 0x00;
+
if (lcd_reg[0] == 0x1c) {
/*
* Big epson detected
lcd_bmp(logo_bmp);
}
-
+#ifdef CONFIG_VIDEO_SM501
int do_esdbmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr;
"esdbmp - display BMP image\n",
"<imageAddr> - display image\n"
);
+#endif