1
0
Fork 0
forked from len0rd/rockbox

image viewer: png: do not show custom error message when there is not enough memory. get rid of use of iv->plug_buf.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29091 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2011-01-19 13:20:00 +00:00
parent 622be891b3
commit 262e6db70e
3 changed files with 16 additions and 26 deletions

View file

@ -194,39 +194,26 @@ static int load_image(char *filename, struct image_info *info,
} }
if (p_decoder->error) { if (p_decoder->error) {
#ifdef USE_PLUG_BUF if (p_decoder->error == FILE_TOO_LARGE ||
if (iv->plug_buf && (p_decoder->error == FILE_TOO_LARGE || p_decoder->error == OUT_OF_MEMORY)
p_decoder->error == OUT_OF_MEMORY || {
p_decoder->error == TINF_DATA_ERROR))
return PLUGIN_OUTOFMEM; return PLUGIN_OUTOFMEM;
#endif }
if (p_decoder->error >= PNG_ERROR_MIN && if (LodePNG_perror(p_decoder) != NULL)
p_decoder->error <= PNG_ERROR_MAX &&
LodePNG_perror(p_decoder) != NULL)
{ {
rb->splash(HZ, LodePNG_perror(p_decoder)); rb->splash(HZ, LodePNG_perror(p_decoder));
} }
else if (p_decoder->error == TINF_DATA_ERROR)
{
rb->splash(HZ, "Zlib decompressor error");
}
else else
{ {
switch (p_decoder->error) { rb->splashf(HZ, "other error : %ld", p_decoder->error);
case PLUGIN_ABORT:
break;
case OUT_OF_MEMORY:
rb->splash(HZ, "Out of Memory");break;
case FILE_TOO_LARGE:
rb->splash(HZ, "File too large");break;
case TINF_DATA_ERROR:
rb->splash(HZ, "Zlib decompressor error");break;
default:
rb->splashf(HZ, "other error : %ld", p_decoder->error);break;
}
} }
if (p_decoder->error == PLUGIN_ABORT) return PLUGIN_ERROR;
return PLUGIN_ABORT;
else
return PLUGIN_ERROR;
} }
info->x_size = p_decoder->infoPng.width; info->x_size = p_decoder->infoPng.width;

View file

@ -18,7 +18,7 @@ OTHER_SRC += $(PNG_SRC)
ROCKS += $(PNGBUILDDIR)/png.ovl ROCKS += $(PNGBUILDDIR)/png.ovl
$(PNGBUILDDIR)/png.refmap: $(PNG_OBJ) $(PNGBUILDDIR)/png.refmap: $(PNG_OBJ)
$(PNGBUILDDIR)/png.link: $(PNG_OBJ) $(PNGBUILDDIR)/png.refmap $(PNGBUILDDIR)/png.link: $(PLUGIN_LDS) $(PNGBUILDDIR)/png.refmap
$(PNGBUILDDIR)/png.ovl: $(PNG_OBJ) $(PNGBUILDDIR)/png.ovl: $(PNG_OBJ)
# Use -O3 for png plugin : it gives a bigger file but very good performances # Use -O3 for png plugin : it gives a bigger file but very good performances

View file

@ -2189,5 +2189,8 @@ void LodePNG_Decoder_init(LodePNG_Decoder* decoder,
const char* LodePNG_perror(LodePNG_Decoder *decoder) const char* LodePNG_perror(LodePNG_Decoder *decoder)
{ {
return png_error_messages[decoder->error-PNG_ERROR_MIN]; if (decoder->error >= PNG_ERROR_MIN && decoder->error <= PNG_ERROR_MAX)
return png_error_messages[decoder->error-PNG_ERROR_MIN];
else
return NULL;
} }