Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Side by Side Diff: doc/examples_old/xz_pipe_decomp.c

Issue 12568011: Update XZ Utils to 5.0.4 (third_party) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * xz_pipe_decomp.c 2 * xz_pipe_decomp.c
3 * A simple example of pipe-only xz decompressor implementation. 3 * A simple example of pipe-only xz decompressor implementation.
4 * version: 2010-07-12 - by Daniel Mealha Cabrita 4 * version: 2012-06-14 - by Daniel Mealha Cabrita
5 * Not copyrighted -- provided to the public domain. 5 * Not copyrighted -- provided to the public domain.
6 * 6 *
7 * Compiling: 7 * Compiling:
8 * Link with liblzma. GCC example: 8 * Link with liblzma. GCC example:
9 * $ gcc -llzma xz_pipe_decomp.c -o xz_pipe_decomp 9 * $ gcc -llzma xz_pipe_decomp.c -o xz_pipe_decomp
10 * 10 *
11 * Usage example: 11 * Usage example:
12 * $ cat some_file.xz | ./xz_pipe_decomp > some_file 12 * $ cat some_file.xz | ./xz_pipe_decomp > some_file
13 */ 13 */
14 14
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 out_len = OUT_BUF_MAX - strm.avail_out; 94 out_len = OUT_BUF_MAX - strm.avail_out;
95 fwrite (out_buf, 1, out_len, out_file); 95 fwrite (out_buf, 1, out_len, out_file);
96 if (ferror (out_file)) { 96 if (ferror (out_file)) {
97 out_finished = true; 97 out_finished = true;
98 ret = RET_ERROR_OUTPUT; 98 ret = RET_ERROR_OUTPUT;
99 } 99 }
100 } 100 }
101 } while (strm.avail_out == 0); 101 } while (strm.avail_out == 0);
102 } 102 }
103 103
104 /* Bug fix (2012-06-14): If no errors were detected, check
105 that the last lzma_code() call returned LZMA_STREAM_END.
106 If not, the file is probably truncated. */
107 if ((ret == RET_OK) && (ret_xz != LZMA_STREAM_END)) {
108 fprintf (stderr, "Input truncated or corrupt\n");
109 ret = RET_ERROR_DECOMPRESSION;
110 }
111
104 lzma_end (&strm); 112 lzma_end (&strm);
105 return ret; 113 return ret;
106 } 114 }
107 115
108 int main () 116 int main ()
109 { 117 {
110 int ret; 118 int ret;
111 119
112 ret = xz_decompress (stdin, stdout); 120 ret = xz_decompress (stdin, stdout);
113 return ret; 121 return ret;
114 } 122 }
115 123
OLDNEW
« README.chromium ('K') | « doc/examples_old/xz_pipe_comp.c ('k') | doc/faq.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698