summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2011-01-19 13:20:00 +0000
committerTeruaki Kawashima <teru@rockbox.org>2011-01-19 13:20:00 +0000
commit262e6db70e5a541fbb09a25bde61831d5ccc273e (patch)
tree53c466ad0b87ad5ce4bfae6ceeb5fa1655abb342 /apps
parent622be891b3fbf251c1a8f8c53a134a1092747bec (diff)
downloadrockbox-262e6db70e5a541fbb09a25bde61831d5ccc273e.tar.gz
rockbox-262e6db70e5a541fbb09a25bde61831d5ccc273e.tar.bz2
rockbox-262e6db70e5a541fbb09a25bde61831d5ccc273e.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/imageviewer/png/png.c35
-rw-r--r--apps/plugins/imageviewer/png/png.make2
-rw-r--r--apps/plugins/imageviewer/png/png_decoder.c5
3 files changed, 16 insertions, 26 deletions
diff --git a/apps/plugins/imageviewer/png/png.c b/apps/plugins/imageviewer/png/png.c
index 10404b7c30..1916f9c55f 100644
--- a/apps/plugins/imageviewer/png/png.c
+++ b/apps/plugins/imageviewer/png/png.c
@@ -194,39 +194,26 @@ static int load_image(char *filename, struct image_info *info,
}
if (p_decoder->error) {
-#ifdef USE_PLUG_BUF
- if (iv->plug_buf && (p_decoder->error == FILE_TOO_LARGE ||
- p_decoder->error == OUT_OF_MEMORY ||
- p_decoder->error == TINF_DATA_ERROR))
+ if (p_decoder->error == FILE_TOO_LARGE ||
+ p_decoder->error == OUT_OF_MEMORY)
+ {
return PLUGIN_OUTOFMEM;
-#endif
+ }
- if (p_decoder->error >= PNG_ERROR_MIN &&
- p_decoder->error <= PNG_ERROR_MAX &&
- LodePNG_perror(p_decoder) != NULL)
+ if (LodePNG_perror(p_decoder) != NULL)
{
rb->splash(HZ, LodePNG_perror(p_decoder));
}
+ else if (p_decoder->error == TINF_DATA_ERROR)
+ {
+ rb->splash(HZ, "Zlib decompressor error");
+ }
else
{
- switch (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;
- }
+ rb->splashf(HZ, "other error : %ld", p_decoder->error);
}
- if (p_decoder->error == PLUGIN_ABORT)
- return PLUGIN_ABORT;
- else
- return PLUGIN_ERROR;
+ return PLUGIN_ERROR;
}
info->x_size = p_decoder->infoPng.width;
diff --git a/apps/plugins/imageviewer/png/png.make b/apps/plugins/imageviewer/png/png.make
index dee89acb71..cac46ceb19 100644
--- a/apps/plugins/imageviewer/png/png.make
+++ b/apps/plugins/imageviewer/png/png.make
@@ -18,7 +18,7 @@ OTHER_SRC += $(PNG_SRC)
ROCKS += $(PNGBUILDDIR)/png.ovl
$(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)
# Use -O3 for png plugin : it gives a bigger file but very good performances
diff --git a/apps/plugins/imageviewer/png/png_decoder.c b/apps/plugins/imageviewer/png/png_decoder.c
index a0ce0519de..1349d75db6 100644
--- a/apps/plugins/imageviewer/png/png_decoder.c
+++ b/apps/plugins/imageviewer/png/png_decoder.c
@@ -2189,5 +2189,8 @@ void LodePNG_Decoder_init(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;
}