summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-06-01 17:15:25 +0000
committerPixel <pixel@nobis-crew.org>2009-06-01 17:15:25 +0000
commitb4202e0c50ccc651f77e46b9bee46e2a7eb3f119 (patch)
treeb1ef93dd283c088985552c0f6b23f4f979510c46
parent02a9b6c1c4b2c2ef6c32e491d3da9265a26485f3 (diff)
Better handling of lenghts in the ucl part.
-rw-r--r--include/Handle.h4
-rw-r--r--lib/Handle.cc12
2 files changed, 8 insertions, 8 deletions
diff --git a/include/Handle.h b/include/Handle.h
index 894ab8e..8b9f866 100644
--- a/include/Handle.h
+++ b/include/Handle.h
@@ -72,8 +72,8 @@ class Handle : public Base {
static int zlib_inflate(Handle * in, Handle * out) throw (GeneralException);
static int zlib_deflate(Handle * in, Handle * out) throw (GeneralException);
#ifdef HAVE_UCL
- static int ucl_compress(Handle * in, Handle * out) throw (GeneralException);
- static int ucl_decompress(Handle * in, Handle * out) throw (GeneralException);
+ static int ucl_compress(Handle * in, Handle * out, int len_in = -1) throw (GeneralException);
+ static int ucl_decompress(Handle * in, Handle * out, int len_in = -1) throw (GeneralException);
#endif
protected:
Handle(int h);
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 5c046d5..1701cd9 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -875,14 +875,14 @@ int Handle::zlib_deflate(Handle * in, Handle * out) throw (GeneralException) {
}
#ifdef HAVE_UCL
-int Handle::ucl_compress(Handle * in, Handle * out) throw (GeneralException) {
+int Handle::ucl_compress(Handle * in, Handle * out, int len_in) throw (GeneralException) {
if (ucl_init() != UCL_E_OK)
throw GeneralException("ucl_init failed");
unsigned char * b_in, * b_out;
- unsigned int len_in, len_out;
+ unsigned int len_out;
- len_in = in->GetSize();
+ if (len_in < 0) len_in = in->GetSize() - in->tell();
len_out = len_in + len_in / 8 + 256;
b_in = (unsigned char *) malloc(len_in);
@@ -901,14 +901,14 @@ int Handle::ucl_compress(Handle * in, Handle * out) throw (GeneralException) {
return len_out;
}
-int Handle::ucl_decompress(Handle * in, Handle * out) throw (GeneralException) {
+int Handle::ucl_decompress(Handle * in, Handle * out, int len_in) throw (GeneralException) {
if (ucl_init() != UCL_E_OK)
throw GeneralException("ucl_init failed");
unsigned char * b_in, * b_out;
- unsigned int len_in, len_out;
+ unsigned int len_out;
- len_in = in->GetSize();
+ if (len_in < 0) len_in = in->GetSize() - in->tell();
len_out = len_in + len_in / 8 + 256;
b_in = (unsigned char *) malloc(len_in);