[Libreoffice-commits] online.git: tools/Config.cpp
Miklos Vajna
vmiklos at collabora.co.uk
Mon Jul 3 06:09:14 UTC 2017
tools/Config.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 9a75040bf02e215135ca3f5366c171561eee69ea
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jul 3 08:08:19 2017 +0200
tools: avoid string concatenation resulting in allocation of unnecessary temporary strings
By using std::stringstream instead.
Change-Id: I6fe12afd4adc13166746b1d98bf8ea75a28208e5
diff --git a/tools/Config.cpp b/tools/Config.cpp
index 54b95d69..232cc569 100644
--- a/tools/Config.cpp
+++ b/tools/Config.cpp
@@ -206,12 +206,12 @@ int Config::main(const std::vector<std::string>& args)
stream << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(pwdhash[j]);
const std::string passwordHash = stream.str();
- const std::string pwdConfigValue = "pbkdf2.sha512." +
- std::to_string(_adminConfig.pwdIterations) + "." +
- saltHash + "." + passwordHash;
+ std::stringstream pwdConfigValue("pbkdf2.sha512.");
+ pwdConfigValue << std::to_string(_adminConfig.pwdIterations) << ".";
+ pwdConfigValue << saltHash << "." << passwordHash;
_loolConfig.setString("admin_console.secure_password[@desc]",
"Salt and password hash combination generated using PBKDF2 with SHA512 digest.");
- _loolConfig.setString("admin_console.secure_password", pwdConfigValue);
+ _loolConfig.setString("admin_console.secure_password", pwdConfigValue.str());
std::cout << "Saving configuration to : " << ConfigFile << " ..." << std::endl;
_loolConfig.save(ConfigFile);
More information about the Libreoffice-commits
mailing list