summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathis Rosenhauer <rosenhauer@dkrz.de>2014-07-29 09:40:33 +0200
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-07-29 09:40:45 +0200
commitaa5a267eb5c57f404e138acdf40172015a9fd2a6 (patch)
tree97e36df0f44c4e7674f2645c7d1a6bdce532936a
parent36c5013fc6a9e2f504fe8a49c34ad31de8fbb40d (diff)
downloadlibaec-aa5a267eb5c57f404e138acdf40172015a9fd2a6.tar.gz
libaec-aa5a267eb5c57f404e138acdf40172015a9fd2a6.tar.bz2
libaec-aa5a267eb5c57f404e138acdf40172015a9fd2a6.zip
Return error code if output buffer is full in aec_buffer_encode().
-rw-r--r--src/encode.c4
-rw-r--r--src/sz_compat.c6
-rw-r--r--src/szlib.h2
3 files changed, 4 insertions, 8 deletions
diff --git a/src/encode.c b/src/encode.c
index 6cbc766..10788ed 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -932,8 +932,8 @@ int aec_buffer_encode(struct aec_stream *strm)
if (status != AEC_OK)
return status;
status = aec_encode(strm, AEC_FLUSH);
- if (strm->avail_in > 0)
- status = AEC_DATA_ERROR;
+ if (strm->avail_out == 0)
+ status = AEC_STREAM_ERROR;
aec_encode_end(strm);
return status;
diff --git a/src/sz_compat.c b/src/sz_compat.c
index 91ccad7..68a75b2 100644
--- a/src/sz_compat.c
+++ b/src/sz_compat.c
@@ -170,18 +170,14 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
}
status = aec_buffer_encode(&strm);
- if (status != AEC_OK)
- return status;
-
*destLen = strm.total_out;
if (pad_scanline && padbuf)
free(padbuf);
-
if (interleave && buf)
free(buf);
- return SZ_OK;
+ return status;
}
int SZ_BufftoBuffDecompress(void *dest, size_t *destLen,
diff --git a/src/szlib.h b/src/szlib.h
index a448754..4e246fe 100644
--- a/src/szlib.h
+++ b/src/szlib.h
@@ -15,7 +15,7 @@
#define SZ_NO_ENCODER_ERROR -1
#define SZ_PARAM_ERROR AEC_CONF_ERROR
#define SZ_MEM_ERROR AEC_MEM_ERROR
-#define SZ_OUTBUFF_FULL -2
+#define SZ_OUTBUFF_FULL AEC_STREAM_ERROR
#define SZ_MAX_PIXELS_PER_BLOCK 32
#define SZ_MAX_BLOCKS_PER_SCANLINE 128