Skip to content

Commit 4fa52e2

Browse files
committed
updated to v2
1 parent 7fbbdb9 commit 4fa52e2

26 files changed

+1692
-2887
lines changed

native/jni/init/unxz.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include <xz.h>
4+
5+
// rootdir.cpp mount.cpp
6+
static bool unxz(int fd, const uint8_t *buf, size_t size) {
7+
uint8_t out[8192];
8+
xz_crc32_init();
9+
struct xz_dec *dec = xz_dec_init(XZ_DYNALLOC, 1 << 26);
10+
struct xz_buf b = {
11+
.in = buf,
12+
.in_pos = 0,
13+
.in_size = size,
14+
.out = out,
15+
.out_pos = 0,
16+
.out_size = sizeof(out)
17+
};
18+
enum xz_ret ret;
19+
do {
20+
ret = xz_dec_run(dec, &b);
21+
if (ret != XZ_OK && ret != XZ_STREAM_END)
22+
return false;
23+
write(fd, out, b.out_pos);
24+
b.out_pos = 0;
25+
} while (b.in_pos != size);
26+
return true;
27+
}

native/jni/inject/entry.cpp

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)