1 /* @(#) $Id: ./src/os_zlib/os_zlib.c, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
16 /* os_compress: Compress a string with zlib. */
17 int os_compress(char *src, char *dst, int src_size, int dst_size)
19 unsigned long int zl_dst = dst_size;
21 /* We make sure to do not allow long sizes */
22 if(compress2((unsigned char *)dst,
25 (unsigned long int)src_size, 9) == Z_OK)
35 /* os_uncompress: Uncompress a string with zlib. */
36 int os_uncompress(char *src, char *dst, int src_size, int dst_size)
38 unsigned long int zl_dst = dst_size;
40 if(uncompress((unsigned char *)dst,
43 (unsigned long int)src_size) == Z_OK)