mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-15 18:10:23 +00:00
Rename classes and small adjustments
This commit is contained in:
@@ -22,7 +22,7 @@ uint32_t dyn_img_hdr::j32 = 0;
|
||||
uint64_t dyn_img_hdr::j64 = 0;
|
||||
|
||||
static int64_t one_step(unique_ptr<Compression> &&ptr, int fd, const void *in, size_t size) {
|
||||
ptr->set_out(make_unique<FDOutStream>(fd));
|
||||
ptr->setOut(make_unique<FDOutStream>(fd));
|
||||
if (!ptr->write(in, size))
|
||||
return -1;
|
||||
return ptr->finalize();
|
||||
|
@@ -62,7 +62,7 @@ void decompress(char *infile, const char *outfile) {
|
||||
|
||||
out_fd = strcmp(outfile, "-") == 0 ?
|
||||
STDOUT_FILENO : xopen(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
cmp->set_out(make_unique<FDOutStream>(out_fd));
|
||||
cmp->setOut(make_unique<FDOutStream>(out_fd));
|
||||
if (ext) *ext = '.';
|
||||
}
|
||||
if (!cmp->write(buf, len))
|
||||
@@ -108,7 +108,7 @@ void compress(const char *method, const char *infile, const char *outfile) {
|
||||
STDOUT_FILENO : xopen(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
}
|
||||
|
||||
cmp->set_out(make_unique<FDOutStream>(out_fd));
|
||||
cmp->setOut(make_unique<FDOutStream>(out_fd));
|
||||
|
||||
read_file(in_file, [&](void *buf, size_t len) -> void {
|
||||
if (!cmp->write(buf, len))
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include <lz4.h>
|
||||
#include <lz4frame.h>
|
||||
#include <lz4hc.h>
|
||||
#include <OutStream.h>
|
||||
#include <stream.h>
|
||||
|
||||
#include "format.h"
|
||||
|
||||
|
@@ -246,13 +246,13 @@ void magisk_cpio::compress() {
|
||||
fprintf(stderr, "Compressing cpio -> [%s]\n", RAMDISK_XZ);
|
||||
auto init = entries.extract("init");
|
||||
XZEncoder encoder;
|
||||
encoder.set_out(make_unique<BufOutStream>());
|
||||
encoder.setOut(make_unique<BufOutStream>());
|
||||
output(encoder);
|
||||
encoder.finalize();
|
||||
entries.clear();
|
||||
entries.insert(std::move(init));
|
||||
auto xz = new cpio_entry(RAMDISK_XZ, S_IFREG);
|
||||
static_cast<BufOutStream *>(encoder.get_out())->release(xz->data, xz->filesize);
|
||||
static_cast<BufOutStream *>(encoder.getOut())->release(xz->data, xz->filesize);
|
||||
insert(xz);
|
||||
}
|
||||
|
||||
@@ -262,13 +262,13 @@ void magisk_cpio::decompress() {
|
||||
return;
|
||||
fprintf(stderr, "Decompressing cpio [%s]\n", RAMDISK_XZ);
|
||||
LZMADecoder decoder;
|
||||
decoder.set_out(make_unique<BufOutStream>());
|
||||
decoder.setOut(make_unique<BufOutStream>());
|
||||
decoder.write(it->second->data, it->second->filesize);
|
||||
decoder.finalize();
|
||||
entries.erase(it);
|
||||
char *buf;
|
||||
size_t sz;
|
||||
static_cast<BufOutStream *>(decoder.get_out())->getbuf(buf, sz);
|
||||
static_cast<BufOutStream *>(decoder.getOut())->getbuf(buf, sz);
|
||||
load_cpio(buf, sz);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user