summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathis Rosenhauer <rosenhauer@dkrz.de>2014-07-30 17:12:39 +0200
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-07-30 17:12:39 +0200
commit415afb968b556802100338c64724956417b8208b (patch)
tree480d700a1bdb71d79d9234e4d06810bb931c253a
parent7d890ee5ab47a05ba20f9d70e7778e68ca069a5e (diff)
downloadlibaec-415afb968b556802100338c64724956417b8208b.tar.gz
libaec-415afb968b556802100338c64724956417b8208b.tar.bz2
libaec-415afb968b556802100338c64724956417b8208b.zip
Mimic return value for full output buffer.
-rw-r--r--src/sz_compat.c7
-rw-r--r--src/szlib.h3
2 files changed, 8 insertions, 2 deletions
diff --git a/src/sz_compat.c b/src/sz_compat.c
index 755fb47..b685c64 100644
--- a/src/sz_compat.c
+++ b/src/sz_compat.c
@@ -107,6 +107,7 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
{
struct aec_stream strm;
int status;
+ int aec_status;
void *padbuf;
void *buf;
size_t padding_size;
@@ -166,7 +167,11 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
strm.avail_in = sourceLen;
}
- status = aec_buffer_encode(&strm);
+ aec_status = aec_buffer_encode(&strm);
+ if (aec_status == AEC_STREAM_ERROR)
+ status = SZ_OUTBUFF_FULL;
+ else
+ status = aec_status;
*destLen = strm.total_out;
CLEANUP:
diff --git a/src/szlib.h b/src/szlib.h
index 4e246fe..88480b5 100644
--- a/src/szlib.h
+++ b/src/szlib.h
@@ -12,10 +12,11 @@
#define SZ_RAW_OPTION_MASK 128
#define SZ_OK AEC_OK
+#define SZ_OUTBUFF_FULL 2
+
#define SZ_NO_ENCODER_ERROR -1
#define SZ_PARAM_ERROR AEC_CONF_ERROR
#define SZ_MEM_ERROR AEC_MEM_ERROR
-#define SZ_OUTBUFF_FULL AEC_STREAM_ERROR
#define SZ_MAX_PIXELS_PER_BLOCK 32
#define SZ_MAX_BLOCKS_PER_SCANLINE 128