summaryrefslogtreecommitdiffstats
path: root/depends/xz-embedded/xzminidec.c
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-11-04 02:53:05 +0100
committerPetr Mrázek <peterix@gmail.com>2013-11-04 02:53:05 +0100
commitbb7e8985f6d189de0acac6a1c3033cb16378c1fb (patch)
tree7c2e88c7184a7f5acf5e7a03be5c5f0bf6904113 /depends/xz-embedded/xzminidec.c
parentd6e4fb29713d6ce55b092c0e22412f6121e7f516 (diff)
downloadMultiMC-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.tar
MultiMC-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.tar.gz
MultiMC-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.tar.lz
MultiMC-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.tar.xz
MultiMC-bb7e8985f6d189de0acac6a1c3033cb16378c1fb.zip
Reformat and (slightly) decruft all the things.
Diffstat (limited to 'depends/xz-embedded/xzminidec.c')
-rw-r--r--depends/xz-embedded/xzminidec.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/depends/xz-embedded/xzminidec.c b/depends/xz-embedded/xzminidec.c
index ba074131..bb62c3ac 100644
--- a/depends/xz-embedded/xzminidec.c
+++ b/depends/xz-embedded/xzminidec.c
@@ -29,10 +29,11 @@ int main(int argc, char **argv)
enum xz_ret ret;
const char *msg;
- if (argc >= 2 && strcmp(argv[1], "--help") == 0) {
+ if (argc >= 2 && strcmp(argv[1], "--help") == 0)
+ {
fputs("Uncompress a .xz file from stdin to stdout.\n"
- "Arguments other than `--help' are ignored.\n",
- stdout);
+ "Arguments other than `--help' are ignored.\n",
+ stdout);
return 0;
}
@@ -46,7 +47,8 @@ int main(int argc, char **argv)
* is allocated once the headers have been parsed.
*/
s = xz_dec_init(XZ_DYNALLOC, 1 << 26);
- if (s == NULL) {
+ if (s == NULL)
+ {
msg = "Memory allocation failed\n";
goto error;
}
@@ -58,16 +60,20 @@ int main(int argc, char **argv)
b.out_pos = 0;
b.out_size = BUFSIZ;
- while (true) {
- if (b.in_pos == b.in_size) {
+ while (true)
+ {
+ if (b.in_pos == b.in_size)
+ {
b.in_size = fread(in, 1, sizeof(in), stdin);
b.in_pos = 0;
}
ret = xz_dec_run(s, &b);
- if (b.out_pos == sizeof(out)) {
- if (fwrite(out, 1, b.out_pos, stdout) != b.out_pos) {
+ if (b.out_pos == sizeof(out))
+ {
+ if (fwrite(out, 1, b.out_pos, stdout) != b.out_pos)
+ {
msg = "Write error\n";
goto error;
}
@@ -79,22 +85,25 @@ int main(int argc, char **argv)
continue;
#ifdef XZ_DEC_ANY_CHECK
- if (ret == XZ_UNSUPPORTED_CHECK) {
+ if (ret == XZ_UNSUPPORTED_CHECK)
+ {
fputs(argv[0], stderr);
fputs(": ", stderr);
fputs("Unsupported check; not verifying "
- "file integrity\n", stderr);
+ "file integrity\n",
+ stderr);
continue;
}
#endif
- if (fwrite(out, 1, b.out_pos, stdout) != b.out_pos
- || fclose(stdout)) {
+ if (fwrite(out, 1, b.out_pos, stdout) != b.out_pos || fclose(stdout))
+ {
msg = "Write error\n";
goto error;
}
- switch (ret) {
+ switch (ret)
+ {
case XZ_STREAM_END:
xz_dec_end(s);
return 0;