mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-11 20:42:20 +00:00
Convert indentation to spaces
The tab war is lost
This commit is contained in:
@@ -14,29 +14,29 @@
|
||||
#define align_off(p, a) (do_align(p, a) - (p))
|
||||
|
||||
struct file_attr {
|
||||
struct stat st;
|
||||
char con[128];
|
||||
struct stat st;
|
||||
char con[128];
|
||||
};
|
||||
|
||||
struct raw_file {
|
||||
std::string path;
|
||||
file_attr attr;
|
||||
uint8_t *buf = nullptr;
|
||||
size_t sz = 0;
|
||||
std::string path;
|
||||
file_attr attr;
|
||||
uint8_t *buf = nullptr;
|
||||
size_t sz = 0;
|
||||
|
||||
raw_file() = default;
|
||||
raw_file(const raw_file&) = delete;
|
||||
raw_file(raw_file &&d) {
|
||||
path = std::move(d.path);
|
||||
attr = d.attr;
|
||||
buf = d.buf;
|
||||
sz = d.sz;
|
||||
d.buf = nullptr;
|
||||
d.sz = 0;
|
||||
}
|
||||
~raw_file() {
|
||||
free(buf);
|
||||
}
|
||||
raw_file() = default;
|
||||
raw_file(const raw_file&) = delete;
|
||||
raw_file(raw_file &&d) {
|
||||
path = std::move(d.path);
|
||||
attr = d.attr;
|
||||
buf = d.buf;
|
||||
sz = d.sz;
|
||||
d.buf = nullptr;
|
||||
d.sz = 0;
|
||||
}
|
||||
~raw_file() {
|
||||
free(buf);
|
||||
}
|
||||
};
|
||||
|
||||
ssize_t fd_path(int fd, char *path, size_t size);
|
||||
@@ -63,11 +63,11 @@ std::string full_read(const char *filename);
|
||||
void write_zero(int fd, size_t size);
|
||||
void file_readline(bool trim, const char *file, const std::function<bool(std::string_view)> &fn);
|
||||
static inline void file_readline(const char *file,
|
||||
const std::function<bool(std::string_view)> &fn) {
|
||||
file_readline(false, file, fn);
|
||||
const std::function<bool(std::string_view)> &fn) {
|
||||
file_readline(false, file, fn);
|
||||
}
|
||||
void parse_prop_file(const char *file,
|
||||
const std::function<bool(std::string_view, std::string_view)> &fn);
|
||||
const std::function<bool(std::string_view, std::string_view)> &fn);
|
||||
void *__mmap(const char *filename, size_t *size, bool rw);
|
||||
void frm_rf(int dirfd);
|
||||
void clone_dir(int src, int dest);
|
||||
@@ -77,38 +77,38 @@ void restore_folder(const char *dir, std::vector<raw_file> &files);
|
||||
|
||||
template <typename T>
|
||||
void full_read(const char *filename, T &buf, size_t &size) {
|
||||
static_assert(std::is_pointer<T>::value);
|
||||
full_read(filename, reinterpret_cast<void**>(&buf), &size);
|
||||
static_assert(std::is_pointer<T>::value);
|
||||
full_read(filename, reinterpret_cast<void**>(&buf), &size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void fd_full_read(int fd, T &buf, size_t &size) {
|
||||
static_assert(std::is_pointer<T>::value);
|
||||
fd_full_read(fd, reinterpret_cast<void**>(&buf), &size);
|
||||
static_assert(std::is_pointer<T>::value);
|
||||
fd_full_read(fd, reinterpret_cast<void**>(&buf), &size);
|
||||
}
|
||||
|
||||
template <typename B>
|
||||
void mmap_ro(const char *filename, B &buf, size_t &sz) {
|
||||
buf = (B) __mmap(filename, &sz, false);
|
||||
buf = (B) __mmap(filename, &sz, false);
|
||||
}
|
||||
|
||||
template <typename B, typename L>
|
||||
void mmap_ro(const char *filename, B &buf, L &sz) {
|
||||
size_t __sz;
|
||||
buf = (B) __mmap(filename, &__sz, false);
|
||||
sz = __sz;
|
||||
size_t __sz;
|
||||
buf = (B) __mmap(filename, &__sz, false);
|
||||
sz = __sz;
|
||||
}
|
||||
|
||||
template <typename B>
|
||||
void mmap_rw(const char *filename, B &buf, size_t &sz) {
|
||||
buf = (B) __mmap(filename, &sz, true);
|
||||
buf = (B) __mmap(filename, &sz, true);
|
||||
}
|
||||
|
||||
template <typename B, typename L>
|
||||
void mmap_rw(const char *filename, B &buf, L &sz) {
|
||||
size_t __sz;
|
||||
buf = (B) __mmap(filename, &__sz, true);
|
||||
sz = __sz;
|
||||
size_t __sz;
|
||||
buf = (B) __mmap(filename, &__sz, true);
|
||||
sz = __sz;
|
||||
}
|
||||
|
||||
using sFILE = std::unique_ptr<FILE, decltype(&fclose)>;
|
||||
@@ -117,25 +117,25 @@ sDIR make_dir(DIR *dp);
|
||||
sFILE make_file(FILE *fp);
|
||||
|
||||
static inline sDIR open_dir(const char *path) {
|
||||
return make_dir(opendir(path));
|
||||
return make_dir(opendir(path));
|
||||
}
|
||||
|
||||
static inline sDIR xopen_dir(const char *path) {
|
||||
return make_dir(xopendir(path));
|
||||
return make_dir(xopendir(path));
|
||||
}
|
||||
|
||||
static inline sDIR xopen_dir(int dirfd) {
|
||||
return make_dir(xfdopendir(dirfd));
|
||||
return make_dir(xfdopendir(dirfd));
|
||||
}
|
||||
|
||||
static inline sFILE open_file(const char *path, const char *mode) {
|
||||
return make_file(fopen(path, mode));
|
||||
return make_file(fopen(path, mode));
|
||||
}
|
||||
|
||||
static inline sFILE xopen_file(const char *path, const char *mode) {
|
||||
return make_file(xfopen(path, mode));
|
||||
return make_file(xfopen(path, mode));
|
||||
}
|
||||
|
||||
static inline sFILE xopen_file(int fd, const char *mode) {
|
||||
return make_file(xfdopen(fd, mode));
|
||||
return make_file(xfdopen(fd, mode));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user