aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-29 16:30:24 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-29 16:32:00 +0000
commit07b716bfea0b84facf5445a28b7cbbbe9a1c1c64 (patch)
tree48ac307df99a5ea9baf78aeea1ec379eae77bdec /src
parentMerge pull request #5359 (diff)
downloadmonero-07b716bfea0b84facf5445a28b7cbbbe9a1c1c64.tar.xz
util: name replace_file arguments better
It was confusing unless you read code and the rename(2) man page.
Diffstat (limited to 'src')
-rw-r--r--src/common/util.cpp8
-rw-r--r--src/common/util.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 80b8a9e81..bc828fb66 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -640,16 +640,16 @@ std::string get_nix_version_display_string()
return res;
}
- std::error_code replace_file(const std::string& replacement_name, const std::string& replaced_name)
+ std::error_code replace_file(const std::string& old_name, const std::string& new_name)
{
int code;
#if defined(WIN32)
// Maximizing chances for success
std::wstring wide_replacement_name;
- try { wide_replacement_name = string_tools::utf8_to_utf16(replacement_name); }
+ try { wide_replacement_name = string_tools::utf8_to_utf16(old_name); }
catch (...) { return std::error_code(GetLastError(), std::system_category()); }
std::wstring wide_replaced_name;
- try { wide_replaced_name = string_tools::utf8_to_utf16(replaced_name); }
+ try { wide_replaced_name = string_tools::utf8_to_utf16(new_name); }
catch (...) { return std::error_code(GetLastError(), std::system_category()); }
DWORD attributes = ::GetFileAttributesW(wide_replaced_name.c_str());
@@ -661,7 +661,7 @@ std::string get_nix_version_display_string()
bool ok = 0 != ::MoveFileExW(wide_replacement_name.c_str(), wide_replaced_name.c_str(), MOVEFILE_REPLACE_EXISTING);
code = ok ? 0 : static_cast<int>(::GetLastError());
#else
- bool ok = 0 == std::rename(replacement_name.c_str(), replaced_name.c_str());
+ bool ok = 0 == std::rename(old_name.c_str(), new_name.c_str());
code = ok ? 0 : errno;
#endif
return std::error_code(code, std::system_category());
diff --git a/src/common/util.h b/src/common/util.h
index ef2305bf4..bd4135cfd 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -145,7 +145,7 @@ namespace tools
bool create_directories_if_necessary(const std::string& path);
/*! \brief std::rename wrapper for nix and something strange for windows.
*/
- std::error_code replace_file(const std::string& replacement_name, const std::string& replaced_name);
+ std::error_code replace_file(const std::string& old_name, const std::string& new_name);
bool sanitize_locale();