[Libreoffice-commits] online.git: wsd/Storage.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Sun Sep 22 18:25:22 UTC 2019
wsd/Storage.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 9c21408112a48aaded3e27e1257e54f1d8e53364
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Sep 21 21:49:58 2019 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Sun Sep 22 20:25:04 2019 +0200
wsd: close iconv after converting
Change-Id: Idc0894362d0839449f7b1e1ae8c52c3ddb1dff45
Reviewed-on: https://gerrit.libreoffice.org/79352
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 992f4a0d3..c96bd208f 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -733,9 +733,10 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const Authorization&
{
// the suggested target has to be in UTF-7; default to extension
// only when the conversion fails
- std::string suggestedTarget = "." + Poco::Path(saveAsFilename).getExtension();
+ std::string suggestedTarget = '.' + Poco::Path(saveAsFilename).getExtension();
- iconv_t cd = iconv_open("UTF-7", "UTF-8");
+ //TODO: Perhaps we should cache this descriptor and reuse, as iconv_open might be expensive.
+ const iconv_t cd = iconv_open("UTF-7", "UTF-8");
if (cd == (iconv_t) -1)
LOG_ERR("Failed to initialize iconv for UTF-7 conversion, using '" << suggestedTarget << "'.");
else
@@ -756,6 +757,8 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const Authorization&
suggestedTarget = std::string(&buffer[0], buffer.size() - out_left);
LOG_TRC("Converted '" << saveAsFilename << "' to UTF-7 as '" << suggestedTarget << "'.");
}
+
+ iconv_close(cd);
}
if (isRename)
More information about the Libreoffice-commits
mailing list