Improve byte_data const correctness

This commit is contained in:
topjohnwu
2023-06-03 03:16:03 -07:00
parent 57afae3425
commit 2a654e5d7f
17 changed files with 186 additions and 161 deletions
+3 -3
View File
@@ -73,8 +73,8 @@ static bool check_precompiled(const char *precompiled) {
}
static void load_cil(struct cil_db *db, const char *file) {
auto d = mmap_data(file);
cil_add_file(db, (char *) file, (char *) d.buf, d.sz);
mmap_data d(file);
cil_add_file(db, file, (const char *) d.buf(), d.sz());
LOGD("cil_add [%s]\n", file);
}
@@ -254,7 +254,7 @@ bool sepolicy::to_file(const char *file) {
if (struct stat st{}; xfstat(fd, &st) == 0 && st.st_size > 0) {
ftruncate(fd, 0);
}
xwrite(fd, data.buf, data.sz);
xwrite(fd, data.buf(), data.sz());
close(fd);
return true;