-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (35 loc) · 1.25 KB
/
main.cpp
File metadata and controls
43 lines (35 loc) · 1.25 KB
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
33
34
35
36
37
38
39
40
41
42
43
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <zlib.h>
int main(void) {
char buffer_in [256] = {"Conan is a MIT-licensed, Open Source package manager for C and C++ development, "
"allowing development teams to easily and efficiently manage their packages and "
"dependencies across platforms and build systems."};
char buffer_out [256] = {0};
z_stream defstream = {
.next_in = (Bytef *)buffer_in,
.avail_in = (uInt)std::strlen(buffer_in),
.total_in = 0,
.next_out = (Bytef *)buffer_out,
.avail_out = (uInt)sizeof(buffer_out),
.zalloc = Z_NULL,
.zfree = Z_NULL,
.opaque = Z_NULL,
};
deflateInit(&defstream, Z_BEST_COMPRESSION);
deflate(&defstream, Z_FINISH);
deflateEnd(&defstream);
std::printf("Uncompressed size is: %lu\n", strlen(buffer_in));
std::printf("Compressed size is: %lu\n", defstream.total_out);
std::printf("ZLIB VERSION: %s\n", zlibVersion());
#ifdef __clang__
constexpr char which[] = "clang";
#elif __GNUC__
constexpr char which[] = "gcc";
#else
constexpr char which[] = "unknown";
#endif
std::printf("Compiler used: %s\n", which);
return EXIT_SUCCESS;
}