[Libreoffice-commits] online.git: loolwsd/Util.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jun 6 01:55:07 UTC 2016
loolwsd/Util.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
New commits:
commit 6b1a57c9eb3122135452a8053c512091e6f9c505
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jun 5 20:34:24 2016 -0400
loolwsd: improved random directory generator
Change-Id: I611debe9cd33b8b15c2fab3c49ad19cc6ad6a995
Reviewed-on: https://gerrit.libreoffice.org/25946
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 78a90f0..f6bfa78 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -95,10 +95,7 @@ namespace rng
/// file/directory names.
std::string getFilename(const size_t length)
{
- std::stringstream ss;
- Poco::Base64Encoder b64(ss);
- b64 << getBytes(length).data();
- std::string s = ss.str();
+ std::string s = getB64String(length);
std::replace(s.begin(), s.end(), '/', '_');
return s.substr(0, length);
}
@@ -126,7 +123,6 @@ namespace Util
/// Create a secure, random directory path.
std::string createRandomDir(const std::string& path)
{
- Poco::File(path).createDirectories();
const auto name = rng::getFilename(64);
Poco::File(Poco::Path(path, name)).createDirectories();
return name;
More information about the Libreoffice-commits
mailing list