forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
32 lines (25 loc) · 914 Bytes
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zlib.h>
int main(void) {
char buffer_in [32] = {"Conan Package Manager"};
char buffer_out [32] = {0};
z_stream defstream;
defstream.zalloc = Z_NULL;
defstream.zfree = Z_NULL;
defstream.opaque = Z_NULL;
defstream.avail_in = (uInt) strlen(buffer_in);
defstream.next_in = (Bytef *) buffer_in;
defstream.avail_out = (uInt) sizeof(buffer_out);
defstream.next_out = (Bytef *) buffer_out;
deflateInit(&defstream, Z_BEST_COMPRESSION);
deflate(&defstream, Z_FINISH);
deflateEnd(&defstream);
printf("Compressed size is: %lu\n", strlen(buffer_in));
printf("Compressed string is: %s\n", buffer_in);
printf("Compressed size is: %lu\n", strlen(buffer_out));
printf("Compressed string is: %s\n", buffer_out);
printf("ZLIB VERSION: %s\n", zlibVersion());
return EXIT_SUCCESS;
}