diff options
author | Rasmus Andersson <rasmus@notion.se> | 2017-08-22 10:05:20 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2017-08-22 12:23:08 +0300 |
commit | 3b1fffade1473f20f2558733fbd218f4580fc7c3 (patch) | |
tree | ea4f80b43b08744d493bb86ab646444ec04ddc7f /misc/ttf2woff/comp-zlib.c | |
download | inter-3b1fffade1473f20f2558733fbd218f4580fc7c3.tar.xz |
Initial public commitv1.0
Diffstat (limited to 'misc/ttf2woff/comp-zlib.c')
-rw-r--r-- | misc/ttf2woff/comp-zlib.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/misc/ttf2woff/comp-zlib.c b/misc/ttf2woff/comp-zlib.c new file mode 100644 index 000000000..2dd4cefc1 --- /dev/null +++ b/misc/ttf2woff/comp-zlib.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2013 Jan Bobrowski <jb@wizard.ae.krakow.pl> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#include <stdlib.h> +#include <zlib.h> +#include "ttf2woff.h" + +char *copression_by = "zlib"; + +int zlib_compress(struct buf *out, struct buf *inp) +{ + u8 *b; + int v; + uLongf len; + + len = inp->len; + b = my_alloc(inp->len); + + v = compress2(b,&len, inp->ptr,inp->len, 9); + + if(v==Z_OK && REALLY_SMALLER(len, inp->len)) { + out->ptr = b; + out->len = len; + return 1; + } else { + my_free(b); + return 0; + } +} |