From 17a77e2577d9e85b0791a2aa08207fdccdd91061 Mon Sep 17 00:00:00 2001 From: John Wu Date: Thu, 31 Oct 2019 02:43:59 -0400 Subject: [PATCH] Shortcut booleans --- native/jni/magiskboot/bootimg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/jni/magiskboot/bootimg.cpp b/native/jni/magiskboot/bootimg.cpp index 98e935194..78c0347c9 100644 --- a/native/jni/magiskboot/bootimg.cpp +++ b/native/jni/magiskboot/bootimg.cpp @@ -319,7 +319,7 @@ int unpack(const char *image, bool nodecomp, bool hdr) { boot.hdr->dump_hdr_file(); // Dump kernel - if (COMPRESSED(boot.k_fmt) && !nodecomp) { + if (!nodecomp && COMPRESSED(boot.k_fmt)) { int fd = creat(KERNEL_FILE, 0644); decompress(boot.k_fmt, fd, boot.kernel, boot.hdr->kernel_size()); 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 ramdisk - if (COMPRESSED(boot.r_fmt) && !nodecomp) { + if (!nodecomp && COMPRESSED(boot.r_fmt)) { int fd = creat(RAMDISK_FILE, 0644); decompress(boot.r_fmt, fd, boot.ramdisk, boot.hdr->ramdisk_size()); close(fd); @@ -436,7 +436,7 @@ void repack(const char* src_img, const char* out_img, bool nocomp) { size_t raw_size; void *raw_buf; 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); } else { boot.hdr->ramdisk_size() = xwrite(fd, raw_buf, raw_size);