Created
September 13, 2014 19:13
-
-
Save dgryski/dee804f1e448898238d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "lz4.h" | |
int main(int argc, char** argv) | |
{ | |
(void)argc; (void)argv; | |
char ibuf[64*1024], obuf[256*1024]; | |
uint32_t sz; | |
ssize_t n, retn; | |
n = read(0, &sz, 4); | |
if (n != 4) { | |
printf("failed to read size"); | |
exit(1); | |
} | |
n = read(0, ibuf, sizeof(ibuf)); | |
retn = LZ4_decompress_safe(ibuf, obuf,n, sizeof(obuf)); | |
printf("got %ld (want %d)\n", retn, sz); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment