summaryrefslogtreecommitdiff
path: root/apps/plugins/imageviewer/png/png.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/imageviewer/png/png.c')
-rw-r--r--apps/plugins/imageviewer/png/png.c35
1 files changed, 11 insertions, 24 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;