mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 08:47:38 +00:00
Shortcut booleans
This commit is contained in:
parent
0f219e5ae6
commit
17a77e2577
@ -319,7 +319,7 @@ int unpack(const char *image, bool nodecomp, bool hdr) {
|
|||||||
boot.hdr->dump_hdr_file();
|
boot.hdr->dump_hdr_file();
|
||||||
|
|
||||||
// Dump kernel
|
// Dump kernel
|
||||||
if (COMPRESSED(boot.k_fmt) && !nodecomp) {
|
if (!nodecomp && COMPRESSED(boot.k_fmt)) {
|
||||||
int fd = creat(KERNEL_FILE, 0644);
|
int fd = creat(KERNEL_FILE, 0644);
|
||||||
decompress(boot.k_fmt, fd, boot.kernel, boot.hdr->kernel_size());
|
decompress(boot.k_fmt, fd, boot.kernel, boot.hdr->kernel_size());
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -331,7 +331,7 @@ int unpack(const char *image, bool nodecomp, bool hdr) {
|
|||||||
dump(boot.kernel_dtb, boot.kernel_dt_size, KER_DTB_FILE);
|
dump(boot.kernel_dtb, boot.kernel_dt_size, KER_DTB_FILE);
|
||||||
|
|
||||||
// Dump ramdisk
|
// Dump ramdisk
|
||||||
if (COMPRESSED(boot.r_fmt) && !nodecomp) {
|
if (!nodecomp && COMPRESSED(boot.r_fmt)) {
|
||||||
int fd = creat(RAMDISK_FILE, 0644);
|
int fd = creat(RAMDISK_FILE, 0644);
|
||||||
decompress(boot.r_fmt, fd, boot.ramdisk, boot.hdr->ramdisk_size());
|
decompress(boot.r_fmt, fd, boot.ramdisk, boot.hdr->ramdisk_size());
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -436,7 +436,7 @@ void repack(const char* src_img, const char* out_img, bool nocomp) {
|
|||||||
size_t raw_size;
|
size_t raw_size;
|
||||||
void *raw_buf;
|
void *raw_buf;
|
||||||
mmap_ro(RAMDISK_FILE, raw_buf, raw_size);
|
mmap_ro(RAMDISK_FILE, raw_buf, raw_size);
|
||||||
if (!COMPRESSED_ANY(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.r_fmt) && !nocomp) {
|
if (!nocomp && !COMPRESSED_ANY(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.r_fmt)) {
|
||||||
boot.hdr->ramdisk_size() = compress(boot.r_fmt, fd, raw_buf, raw_size);
|
boot.hdr->ramdisk_size() = compress(boot.r_fmt, fd, raw_buf, raw_size);
|
||||||
} else {
|
} else {
|
||||||
boot.hdr->ramdisk_size() = xwrite(fd, raw_buf, raw_size);
|
boot.hdr->ramdisk_size() = xwrite(fd, raw_buf, raw_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user