diff options
| author | johannes <johannes.herman@gmail.com> | 2024-02-06 12:35:35 +0100 |
|---|---|---|
| committer | johannes <johannes.herman@gmail.com> | 2024-02-06 12:35:35 +0100 |
| commit | 808883b430e869413046b87a12095068677fe383 (patch) | |
| tree | dd53c0c2ce3c337a4e5946fe39a836681382c24c | |
| parent | dac46e69f6a7bfed290c7a1cf61b0fc932976d95 (diff) | |
reformat
| -rw-r--r-- | src/huffman.c | 4 | ||||
| -rw-r--r-- | src/main.c | 21 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/huffman.c b/src/huffman.c index b751f77..d37ae98 100644 --- a/src/huffman.c +++ b/src/huffman.c @@ -1,4 +1,4 @@ -/* huffman compresion based on teeworlds/ddnet huffman */ +/* huffman compresion based on teeworlds/ddnet huffman */ /*{ https://github.com/teeworlds/teeworlds/blob/master/src/engine/shared/huffman.cpp } */ #include "../inc/huffman.h" @@ -225,7 +225,7 @@ int decompresshuff(const char *inputbuff, int inputsize, char *outputbuff, int o if (node->symbol == HUFF_EOF_SYMBOL) return outputlen; - + if (outputlen == outputsize) return -1; @@ -1,5 +1,5 @@ -#include "../inc/huffman.h" #include "../inc/demo.h" +#include "../inc/huffman.h" #include "../inc/pack.h" #include <stdio.h> @@ -123,38 +123,37 @@ int main() int ret = readdemoheader(fp, &dh); - dm.data = (unsigned char*) malloc(reverseint(dh.mapsize)); + dm.data = (unsigned char *)malloc(reverseint(dh.mapsize)); printf("\nheader: %i\n", ret); - + if (dh.version >= 4) ret = readdemotimeline(fp, &dt); printf("\ntimeline: %i\n", ret); - + // TODO should be able to read 5 aswell, change readdemomap to fit if (dh.version >= 6) ret = readdemomap(fp, &dm, reverseint(dh.mapsize)); printf("readdemomap ret: %d\n\n", ret); - + demochunk dc; int i = 0; while (readdemochunk(fp, &dc, dh.version) > 0) { i++; - } + } printf("i: %d\n", i); char c; do { c = getc(fp); // printf("%x\n", c & 0xff); - if (c != EOF) - { + if (c != EOF) + { putc(c, op); } - } - while(c != EOF); + } while (c != EOF); return EXIT_SUCCESS; @@ -165,7 +164,7 @@ int main() char *line = NULL; size_t len = 0; ssize_t nread; - + while ((nread = getline(&line, &len, fp)) != -1) { if (testcompress(line) < 0) |
