diff options
-rw-r--r-- | include/Handle.h | 2 | ||||
-rw-r--r-- | lib/Handle.cc | 4 | ||||
-rw-r--r-- | lib/LuaHandle.cc | 6 |
3 files changed, 12 insertions, 0 deletions
diff --git a/include/Handle.h b/include/Handle.h index 64b4243..894ab8e 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -71,8 +71,10 @@ class Handle : public Base { static int GetNbHandles(); 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); +#endif protected: Handle(int h); int GetHandle() const; diff --git a/lib/Handle.cc b/lib/Handle.cc index 3e437a3..5c046d5 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -21,7 +21,9 @@ #include <string.h> #include <errno.h> #include <fcntl.h> +#ifdef HAVE_UCL #include <ucl/ucl.h> +#endif #ifdef HAVE_CONFIG_H #include "config.h" @@ -872,6 +874,7 @@ int Handle::zlib_deflate(Handle * in, Handle * out) throw (GeneralException) { return total_out; } +#ifdef HAVE_UCL int Handle::ucl_compress(Handle * in, Handle * out) throw (GeneralException) { if (ucl_init() != UCL_E_OK) throw GeneralException("ucl_init failed"); @@ -923,3 +926,4 @@ int Handle::ucl_decompress(Handle * in, Handle * out) throw (GeneralException) { return len_out; } +#endif diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index e2b621e..29af5d7 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -72,8 +72,10 @@ class sLuaHandle : public Base { static int get_nb_buffer(lua_State * L); static int zlib_inflate(lua_State * L); static int zlib_deflate(lua_State * L); +#ifdef HAVE_UCL static int ucl_compress(lua_State * L); static int ucl_decompress(lua_State * L); +#endif private: static int read(lua_State * L, int); static int write(lua_State * L, int); @@ -583,6 +585,7 @@ int sLuaHandle::zlib_deflate(lua_State * __L) { return 1; } +#ifdef HAVE_UCL int sLuaHandle::ucl_compress(lua_State * __L) { Lua * L = Lua::find(__L); int n = L->gettop(); @@ -622,6 +625,7 @@ int sLuaHandle::ucl_decompress(lua_State * __L) { return 1; } +#endif int sLuaHandle::seek(lua_State * __L) { Lua * L = Lua::find(__L); @@ -861,6 +865,8 @@ void LuaHandle::pushconstruct(Lua * L) { L->declarefunc("zlib_inflate", sLuaHandle::zlib_inflate); L->declarefunc("zlib_deflate", sLuaHandle::zlib_deflate); +#ifdef HAVE_UCL L->declarefunc("ucl_compress", sLuaHandle::ucl_compress); L->declarefunc("ucl_decompress", sLuaHandle::ucl_decompress); +#endif } |