summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,
194 } 194 }
195 195
196 if (p_decoder->error) { 196 if (p_decoder->error) {
197#ifdef USE_PLUG_BUF 197 if (p_decoder->error == FILE_TOO_LARGE ||
198 if (iv->plug_buf && (p_decoder->error == FILE_TOO_LARGE || 198 p_decoder->error == OUT_OF_MEMORY)
199 p_decoder->error == OUT_OF_MEMORY || 199 {
200 p_decoder->error == TINF_DATA_ERROR))
201 return PLUGIN_OUTOFMEM; 200 return PLUGIN_OUTOFMEM;
202#endif 201 }
203 202
204 if (p_decoder->error >= PNG_ERROR_MIN && 203 if (LodePNG_perror(p_decoder) != NULL)
205 p_decoder->error <= PNG_ERROR_MAX &&
206 LodePNG_perror(p_decoder) != NULL)
207 { 204 {
208 rb->splash(HZ, LodePNG_perror(p_decoder)); 205 rb->splash(HZ, LodePNG_perror(p_decoder));
209 } 206 }
207 else if (p_decoder->error == TINF_DATA_ERROR)
208 {
209 rb->splash(HZ, "Zlib decompressor error");
210 }
210 else 211 else
211 { 212 {
212 switch (p_decoder->error) { 213 rb->splashf(HZ, "other error : %ld", p_decoder->error);
213 case PLUGIN_ABORT:
214 break;
215 case OUT_OF_MEMORY:
216 rb->splash(HZ, "Out of Memory");break;
217 case FILE_TOO_LARGE:
218 rb->splash(HZ, "File too large");break;
219 case TINF_DATA_ERROR:
220 rb->splash(HZ, "Zlib decompressor error");break;
221 default:
222 rb->splashf(HZ, "other error : %ld", p_decoder->error);break;
223 }
224 } 214 }
225 215
226 if (p_decoder->error == PLUGIN_ABORT) 216 return PLUGIN_ERROR;
227 return PLUGIN_ABORT;
228 else
229 return PLUGIN_ERROR;
230 } 217 }
231 218
232 info->x_size = p_decoder->infoPng.width; 219 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)
18ROCKS += $(PNGBUILDDIR)/png.ovl 18ROCKS += $(PNGBUILDDIR)/png.ovl
19 19
20$(PNGBUILDDIR)/png.refmap: $(PNG_OBJ) 20$(PNGBUILDDIR)/png.refmap: $(PNG_OBJ)
21$(PNGBUILDDIR)/png.link: $(PNG_OBJ) $(PNGBUILDDIR)/png.refmap 21$(PNGBUILDDIR)/png.link: $(PLUGIN_LDS) $(PNGBUILDDIR)/png.refmap
22$(PNGBUILDDIR)/png.ovl: $(PNG_OBJ) 22$(PNGBUILDDIR)/png.ovl: $(PNG_OBJ)
23 23
24# Use -O3 for png plugin : it gives a bigger file but very good performances 24# 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,
2189 2189
2190const char* LodePNG_perror(LodePNG_Decoder *decoder) 2190const char* LodePNG_perror(LodePNG_Decoder *decoder)
2191{ 2191{
2192 return png_error_messages[decoder->error-PNG_ERROR_MIN]; 2192 if (decoder->error >= PNG_ERROR_MIN && decoder->error <= PNG_ERROR_MAX)
2193 return png_error_messages[decoder->error-PNG_ERROR_MIN];
2194 else
2195 return NULL;
2193} 2196}