summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--twrp-functions.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index d7c9c2cab..5df44c69a 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -97,7 +97,7 @@ int TWFunc::Exec_Cmd(const string& cmd) {
}
// Returns "file.name" from a full /path/to/file.name
-string TWFunc::Get_Filename(string Path) {
+string TWFunc::Get_Filename(const string& Path) {
size_t pos = Path.find_last_of("/");
if (pos != string::npos) {
string Filename;
@@ -108,7 +108,7 @@ string TWFunc::Get_Filename(string Path) {
}
// Returns "/path/to/" from a full /path/to/file.name
-string TWFunc::Get_Path(string Path) {
+string TWFunc::Get_Path(const string& Path) {
size_t pos = Path.find_last_of("/");
if (pos != string::npos) {
string Pathonly;
@@ -390,7 +390,7 @@ int32_t TWFunc::timespec_diff_ms(timespec& start, timespec& end)
#ifndef BUILD_TWRPTAR_MAIN
// Returns "/path" from a full /path/to/file.name
-string TWFunc::Get_Root_Path(string Path) {
+string TWFunc::Get_Root_Path(const string& Path) {
string Local_Path = Path;
// Make sure that we have a leading slash
@@ -567,7 +567,7 @@ void TWFunc::Update_Log_File(void) {
void TWFunc::Update_Intent_File(string Intent) {
if (PartitionManager.Mount_By_Path("/cache", false) && !Intent.empty()) {
- TWFunc::write_file("/cache/recovery/intent", Intent);
+ TWFunc::write_to_file("/cache/recovery/intent", Intent);
}
}
@@ -759,7 +759,7 @@ int TWFunc::read_file(string fn, uint64_t& results) {
return -1;
}
-int TWFunc::write_file(string fn, string& line) {
+int TWFunc::write_to_file(const string& fn, const string& line) {
FILE *file;
file = fopen(fn.c_str(), "w");
if (file != NULL) {
@@ -1042,11 +1042,11 @@ int TWFunc::Set_Brightness(std::string brightness_value)
if (DataManager::GetIntValue("tw_has_brightnesss_file")) {
LOGINFO("TWFunc::Set_Brightness: Setting brightness control to %s\n", brightness_value.c_str());
- result = TWFunc::write_file(DataManager::GetStrValue("tw_brightness_file"), brightness_value);
+ result = TWFunc::write_to_file(DataManager::GetStrValue("tw_brightness_file"), brightness_value);
DataManager::GetValue("tw_secondary_brightness_file", secondary_brightness_file);
if (!secondary_brightness_file.empty()) {
LOGINFO("TWFunc::Set_Brightness: Setting secondary brightness control to %s\n", brightness_value.c_str());
- TWFunc::write_file(secondary_brightness_file, brightness_value);
+ TWFunc::write_to_file(secondary_brightness_file, brightness_value);
}
}
return result;
@@ -1123,7 +1123,7 @@ void TWFunc::copy_kernel_log(string curr_storage) {
std::string result;
Exec_Cmd(dmesgCmd, result);
- write_file(dmesgDst, result);
+ write_to_file(dmesgDst, result);
gui_msg(Msg("copy_kernel_log=Copied kernel log to {1}")(dmesgDst));
tw_set_default_metadata(dmesgDst.c_str());
}