mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-03 06:17:44 -04:00
fix pngread error handling
This commit is contained in:
parent
4563c13167
commit
697806c41d
2 changed files with 7 additions and 13 deletions
6
input.h
6
input.h
|
@ -36,9 +36,6 @@
|
|||
#define PEVB_SSLOT_NEXT 24
|
||||
#define PEVB_MENU 23
|
||||
#define PEVB_FF 22
|
||||
#define PEVB_PICO_PNEXT 21
|
||||
#define PEVB_PICO_PPREV 20
|
||||
#define PEVB_PICO_SWINP 19
|
||||
|
||||
#define PEV_VOL_DOWN (1 << PEVB_VOL_DOWN)
|
||||
#define PEV_VOL_UP (1 << PEVB_VOL_UP)
|
||||
|
@ -49,9 +46,6 @@
|
|||
#define PEV_SSLOT_NEXT (1 << PEVB_SSLOT_NEXT)
|
||||
#define PEV_MENU (1 << PEVB_MENU)
|
||||
#define PEV_FF (1 << PEVB_FF)
|
||||
#define PEV_PICO_PNEXT (1 << PEVB_PICO_PNEXT)
|
||||
#define PEV_PICO_PPREV (1 << PEVB_PICO_PPREV)
|
||||
#define PEV_PICO_SWINP (1 << PEVB_PICO_SWINP)
|
||||
|
||||
#define PEV_MASK 0x7ff80000
|
||||
|
||||
|
|
14
readpng.c
14
readpng.c
|
@ -76,7 +76,7 @@ int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req
|
|||
if (png_get_bit_depth(png_ptr, info_ptr) != 8)
|
||||
{
|
||||
lprintf(__FILE__ ": scaled image uses %ibpc, needed 8bpc\n", png_get_bit_depth(png_ptr, info_ptr));
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
width = png_get_image_width(png_ptr, info_ptr);
|
||||
x_scale = width*65536 / req_w;
|
||||
|
@ -112,7 +112,7 @@ int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req
|
|||
if (png_get_bit_depth(png_ptr, info_ptr) != 8)
|
||||
{
|
||||
lprintf(__FILE__ ": bg image uses %ibpc, needed 8bpc\n", png_get_bit_depth(png_ptr, info_ptr));
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
width = png_get_image_width(png_ptr, info_ptr);
|
||||
if (width > req_w) {
|
||||
|
@ -149,12 +149,12 @@ int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req
|
|||
{
|
||||
lprintf(__FILE__ ": unexpected font image size %dx%d, needed %dx%d\n",
|
||||
(int)png_get_image_width(png_ptr, info_ptr), (int)png_get_image_height(png_ptr, info_ptr), req_w, req_h);
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
if (png_get_bit_depth(png_ptr, info_ptr) != 8)
|
||||
{
|
||||
lprintf(__FILE__ ": font image uses %ibpp, needed 8bpp\n", png_get_bit_depth(png_ptr, info_ptr));
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
|
@ -182,12 +182,12 @@ int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req
|
|||
{
|
||||
lprintf(__FILE__ ": unexpected selector image size %ix%i, needed %dx%d\n",
|
||||
(int)png_get_image_width(png_ptr, info_ptr), (int)png_get_image_height(png_ptr, info_ptr), req_w, req_h);
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
if (png_get_bit_depth(png_ptr, info_ptr) != 8)
|
||||
{
|
||||
lprintf(__FILE__ ": selector image uses %ibpp, needed 8bpp\n", png_get_bit_depth(png_ptr, info_ptr));
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
for (y1 = 0; y1 < req_h; y1++)
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req
|
|||
if (png_get_bit_depth(png_ptr, info_ptr) != 8)
|
||||
{
|
||||
lprintf(__FILE__ ": image uses %ibpc, needed 8bpc\n", png_get_bit_depth(png_ptr, info_ptr));
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
width = png_get_image_width(png_ptr, info_ptr);
|
||||
if (width > req_w)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue