changeset 33137:f884fb919ac5

Remove various pngRead() debug messages. Instead, issue the return code in the debug message after calling pngRead() and increase return code values to allow exact error assignments.
author ib
date Tue, 05 Apr 2011 13:44:02 +0000
parents 07be88814256
children 3335d117f6e6
files gui/util/bitmap.c
diffstat 1 files changed, 12 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/bitmap.c	Tue Apr 05 13:21:20 2011 +0000
+++ b/gui/util/bitmap.c	Tue Apr 05 13:44:02 2011 +0000
@@ -41,26 +41,22 @@
 
     file = fopen(fname, "rb");
 
-    if (!file) {
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] open error: %s\n", fname);
-        return 1;
-    }
+    if (!file)
+        return 2;
 
     fseek(file, 0, SEEK_END);
     len = ftell(file);
 
     if (len > 50 * 1024 * 1024) {
         fclose(file);
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] file too big: %s\n", fname);
-        return 2;
+        return 3;
     }
 
     data = av_malloc(len + FF_INPUT_BUFFER_PADDING_SIZE);
 
     if (!data) {
         fclose(file);
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", len + FF_INPUT_BUFFER_PADDING_SIZE);
-        return 3;
+        return 4;
     }
 
     fseek(file, 0, SEEK_SET);
@@ -117,6 +113,8 @@
 
         if (bf->Image)
             memcpy_pic(bf->Image, frame->data[0], bpl, bf->Height, bpl, frame->linesize[0]);
+        else
+            decode_ok = 0;
     }
 
     avcodec_close(avctx);
@@ -124,11 +122,6 @@
     av_freep(&avctx);
     av_freep(&data);
 
-    if (decode_ok && bf->BPP && !bf->Image) {
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", bf->ImageSize);
-        return 4;
-    }
-
     return !(decode_ok && bf->BPP);
 }
 
@@ -194,13 +187,17 @@
 
 int bpRead(char *fname, txSample *bf)
 {
+    int r;
+
     fname = fExist(fname);
 
     if (!fname)
         return -2;
 
-    if (pngRead(fname, bf) != 0) {
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] read error: %s\n", fname);
+    r = pngRead(fname, bf);
+
+    if (r != 0) {
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] read error #%d: %s\n", r, fname);
         return -5;
     }