mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-13 18:31:48 +00:00
Introduce UtfCString
This commit is contained in:
@@ -3,7 +3,7 @@ use std::fs::File;
|
||||
use std::io;
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
|
||||
use base::{cstr, Directory, ResultExt, Utf8CStr, Utf8CStrBuf, Utf8CStrSlice, WalkResult};
|
||||
use base::{cstr, Directory, ResultExt, Utf8CStr, Utf8CStrBuf, Utf8CStrBufRef, WalkResult};
|
||||
|
||||
use crate::logging::{magisk_logging, zygisk_logging};
|
||||
|
||||
@@ -57,11 +57,11 @@ pub fn find_apk_path(pkg: &[u8], data: &mut [u8]) -> usize {
|
||||
Ok(Skip)
|
||||
})?;
|
||||
if !buf.is_empty() {
|
||||
buf.append("/base.apk");
|
||||
buf.push_str("/base.apk");
|
||||
}
|
||||
Ok(buf.len())
|
||||
}
|
||||
inner(pkg, &mut Utf8CStrSlice::from(data))
|
||||
inner(pkg, &mut Utf8CStrBufRef::from(data))
|
||||
.log()
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ extern "C" fn logfile_writer(arg: *mut c_void) -> *mut c_void {
|
||||
|
||||
let mut meta = LogMeta::zeroed();
|
||||
let mut msg_buf = [0u8; MAX_MSG_LEN];
|
||||
let mut aux = Utf8CStrArr::<64>::new();
|
||||
let mut aux = Utf8CStrBufArr::<64>::new();
|
||||
|
||||
loop {
|
||||
// Read request
|
||||
|
||||
@@ -13,7 +13,7 @@ use quick_protobuf::{BytesReader, MessageRead, MessageWrite, Writer};
|
||||
use base::libc::{O_CLOEXEC, O_RDONLY};
|
||||
use base::{
|
||||
clone_attr, cstr, debug, libc::mkstemp, Directory, FsPath, FsPathBuf, LibcReturn, LoggedError,
|
||||
LoggedResult, MappedFile, Utf8CStr, Utf8CStrArr, WalkResult,
|
||||
LoggedResult, MappedFile, Utf8CStr, Utf8CStrBufArr, WalkResult,
|
||||
};
|
||||
|
||||
use crate::ffi::{prop_cb_exec, PropCb};
|
||||
@@ -81,7 +81,7 @@ fn check_proto() -> bool {
|
||||
}
|
||||
|
||||
fn file_get_prop(name: &Utf8CStr) -> LoggedResult<String> {
|
||||
let mut buf = Utf8CStrArr::default();
|
||||
let mut buf = Utf8CStrBufArr::default();
|
||||
let path = FsPathBuf::new(&mut buf)
|
||||
.join(PERSIST_PROP_DIR!())
|
||||
.join(name);
|
||||
@@ -93,12 +93,12 @@ fn file_get_prop(name: &Utf8CStr) -> LoggedResult<String> {
|
||||
}
|
||||
|
||||
fn file_set_prop(name: &Utf8CStr, value: Option<&Utf8CStr>) -> LoggedResult<()> {
|
||||
let mut buf = Utf8CStrArr::default();
|
||||
let mut buf = Utf8CStrBufArr::default();
|
||||
let path = FsPathBuf::new(&mut buf)
|
||||
.join(PERSIST_PROP_DIR!())
|
||||
.join(name);
|
||||
if let Some(value) = value {
|
||||
let mut buf = Utf8CStrArr::default();
|
||||
let mut buf = Utf8CStrBufArr::default();
|
||||
let mut tmp = FsPathBuf::new(&mut buf)
|
||||
.join(PERSIST_PROP_DIR!())
|
||||
.join("prop.XXXXXX");
|
||||
@@ -130,7 +130,7 @@ fn proto_read_props() -> LoggedResult<PersistentProperties> {
|
||||
}
|
||||
|
||||
fn proto_write_props(props: &PersistentProperties) -> LoggedResult<()> {
|
||||
let mut buf = Utf8CStrArr::default();
|
||||
let mut buf = Utf8CStrBufArr::default();
|
||||
let mut tmp = FsPathBuf::new(&mut buf).join(concat!(PERSIST_PROP!(), ".XXXXXX"));
|
||||
{
|
||||
let f = unsafe {
|
||||
|
||||
Reference in New Issue
Block a user