[Libreoffice-commits] core.git: svl/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Sat Mar 30 10:27:19 UTC 2019
svl/source/misc/msodocumentlockfile.cxx | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
New commits:
commit 107fd82751c35818152eabd45bdf882972d3c100
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Mar 30 10:29:50 2019 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Mar 30 11:26:58 2019 +0100
Slightly simplify URL handling
Change-Id: Ie63745c1cb826399dc78f93ebb21af8d165c4bff
Reviewed-on: https://gerrit.libreoffice.org/69946
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx
index 432fb6e07ecd..aa9f651fae16 100644
--- a/svl/source/misc/msodocumentlockfile.cxx
+++ b/svl/source/misc/msodocumentlockfile.cxx
@@ -59,28 +59,21 @@ MSODocumentLockFile::~MSODocumentLockFile() {}
OUString MSODocumentLockFile::GenerateURL(const OUString& aOrigURL, const OUString& aPrefix)
{
- INetURLObject aDocURL = LockFileCommon::ResolveLinks(INetURLObject(aOrigURL));
- OUString aURL = aDocURL.GetPartBeforeLastName();
- aURL += aPrefix;
+ INetURLObject aURL = LockFileCommon::ResolveLinks(INetURLObject(aOrigURL));
// For text documents MSO Word cuts some of the first characters of the file name
- OUString sFileName = aDocURL.GetName();
+ OUString sFileName = aURL.GetName();
if (isWordFormat(aOrigURL))
{
- sal_Int32 nFileNameLength
- = aDocURL.GetName().getLength() - aDocURL.GetFileExtension().getLength() - 1;
+ const sal_Int32 nFileNameLength
+ = sFileName.getLength() - aURL.GetFileExtension().getLength() - 1;
if (nFileNameLength >= 8)
- aURL += sFileName.copy(2);
+ sFileName = sFileName.copy(2);
else if (nFileNameLength == 7)
- aURL += sFileName.copy(1);
- else
- aURL += sFileName;
- }
- else
- {
- aURL += sFileName;
+ sFileName = sFileName.copy(1);
}
- return INetURLObject(aURL).GetMainURL(INetURLObject::DecodeMechanism::NONE);
+ aURL.SetName(aPrefix + sFileName);
+ return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
}
void MSODocumentLockFile::WriteEntryToStream(
More information about the Libreoffice-commits
mailing list