Skip to content

Instantly share code, notes, and snippets.

@dgryski
Created September 13, 2014 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgryski/dee804f1e448898238d5 to your computer and use it in GitHub Desktop.
Save dgryski/dee804f1e448898238d5 to your computer and use it in GitHub Desktop.
#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