Current Path : /usr/src/sys/contrib/xz-embedded/userspace/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/src/sys/contrib/xz-embedded/userspace/buftest.c |
/* * Test application to test buffer-to-buffer decoding * * Author: Lasse Collin <lasse.collin@tukaani.org> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #include <stdbool.h> #include <stdio.h> #include <string.h> #include "xz.h" #define BUFFER_SIZE (1024 * 1024) static uint8_t in[BUFFER_SIZE]; static uint8_t out[BUFFER_SIZE]; int main(void) { struct xz_buf b; struct xz_dec *s; enum xz_ret ret; xz_crc32_init(); s = xz_dec_init(XZ_SINGLE, 0); if (s == NULL) { fputs("Initialization failed", stderr); return 1; } b.in = in; b.in_pos = 0; b.in_size = fread(in, 1, sizeof(in), stdin); b.out = out; b.out_pos = 0; b.out_size = sizeof(out); ret = xz_dec_run(s, &b); xz_dec_end(s); fwrite(out, 1, b.out_pos, stdout); fprintf(stderr, "%d\n", ret); return 0; }