The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/xz-embedded/userspace/buftest.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Test application to test buffer-to-buffer decoding
    3  *
    4  * Author: Lasse Collin <lasse.collin@tukaani.org>
    5  *
    6  * This file has been put into the public domain.
    7  * You can do whatever you want with this file.
    8  */
    9 
   10 #include <stdbool.h>
   11 #include <stdio.h>
   12 #include <string.h>
   13 #include "xz.h"
   14 
   15 #define BUFFER_SIZE (1024 * 1024)
   16 
   17 static uint8_t in[BUFFER_SIZE];
   18 static uint8_t out[BUFFER_SIZE];
   19 
   20 int main(void)
   21 {
   22         struct xz_buf b;
   23         struct xz_dec *s;
   24         enum xz_ret ret;
   25 
   26         xz_crc32_init();
   27 
   28         s = xz_dec_init(XZ_SINGLE, 0);
   29         if (s == NULL) {
   30                 fputs("Initialization failed\n", stderr);
   31                 return 1;
   32         }
   33 
   34         b.in = in;
   35         b.in_pos = 0;
   36         b.in_size = fread(in, 1, sizeof(in), stdin);
   37 
   38         b.out = out;
   39         b.out_pos = 0;
   40         b.out_size = sizeof(out);
   41 
   42         ret = xz_dec_run(s, &b);
   43         xz_dec_end(s);
   44 
   45         fwrite(out, 1, b.out_pos, stdout);
   46         fprintf(stderr, "%d\n", ret);
   47 
   48         return 0;
   49 }

Cache object: deb728dc9d1d9df03612132e19b33285


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.