summaryrefslogtreecommitdiff
path: root/src/graphics.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-05-28 17:05:05 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-28 17:05:05 (GMT)
commit2795970639d0dc6bf243b119a6d7b266f2baa67d (patch)
treebe907c660b97d7797feabde9a850f4b806001a50 /src/graphics.c
parent4c4b457cab57cc5ec0059310801c89db90377e4f (diff)
downloadpowder-2795970639d0dc6bf243b119a6d7b266f2baa67d.zip
powder-2795970639d0dc6bf243b119a6d7b266f2baa67d.tar.gz
Some debug info for image decoding
Diffstat (limited to 'src/graphics.c')
-rw-r--r--src/graphics.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/graphics.c b/src/graphics.c
index b59a5bc..69d689e 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -79,7 +79,7 @@ void *ptif_pack(pixel *src, int w, int h, int *result_size){
}
pixel *ptif_unpack(void *datain, int size, int *w, int *h){
- int width, height, i, cx, cy;
+ int width, height, i, cx, cy, resCode;
unsigned char *red_chan;
unsigned char *green_chan;
unsigned char *blue_chan;
@@ -103,8 +103,9 @@ pixel *ptif_unpack(void *datain, int size, int *w, int *h){
blue_chan = calloc(1, width*height);
result = calloc(width*height, PIXELSIZE);
- if (BZ2_bzBuffToBuffDecompress((char *)undata, (unsigned *)&i, (char *)(data+8), size-8, 0, 0)){
- printf("Decompression failure\n");
+ resCode = BZ2_bzBuffToBuffDecompress((char *)undata, (unsigned *)&i, (char *)(data+8), size-8, 0, 0);
+ if (resCode){
+ printf("Decompression failure, %d\n", resCode);
free(red_chan);
free(green_chan);
free(blue_chan);
@@ -112,7 +113,7 @@ pixel *ptif_unpack(void *datain, int size, int *w, int *h){
return NULL;
}
if(i != (width*height)*3){
- printf("Result buffer size mismatch\n");
+ printf("Result buffer size mismatch, %d != %d\n", i, (width*height)*3);
free(red_chan);
free(green_chan);
free(blue_chan);