summaryrefslogtreecommitdiff
path: root/src/gd_bmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gd_bmp.c')
-rw-r--r--src/gd_bmp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gd_bmp.c b/src/gd_bmp.c
index e186ac9..29a05ce 100644
--- a/src/gd_bmp.c
+++ b/src/gd_bmp.c
@@ -266,7 +266,11 @@ static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
bitmap_size += compressed_size;
- gdPutBuf(uncompressed_row, compressed_size, out);
+ if (gdPutBuf(uncompressed_row, compressed_size, out) != compressed_size){
+ gd_error("gd-bmp write error\n");
+ error = 1;
+ break;
+ }
gdPutC(BMP_RLE_COMMAND, out);
gdPutC(BMP_RLE_ENDOFLINE, out);
bitmap_size += 2;
@@ -322,10 +326,14 @@ static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
}
while ((buffer_size = gdGetBuf(copy_buffer, 1024, out)) != EOF) {
+ int res;
if (buffer_size == 0) {
break;
}
- gdPutBuf(copy_buffer , buffer_size, out_original);
+ if (gdPutBuf(copy_buffer , buffer_size, out_original) != buffer_size) {
+ gd_error("gd-bmp write error\n");
+ error = 1;
+ }
}
gdFree(copy_buffer);
@@ -335,7 +343,7 @@ static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
out_original = NULL;
}
- ret = 0;
+ ret = error;
cleanup:
if (tmpfile_for_compression) {
#ifdef _WIN32