[Libreoffice-commits] core.git: sal/osl
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 15 13:35:23 UTC 2021
sal/osl/w32/tempfile.cxx | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
New commits:
commit 181fc61c4cce5192e57657c313ee7fa4f640fb69
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Feb 15 12:49:30 2021 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Feb 15 14:34:37 2021 +0100
Reuse known length of the temp dir path
And make this code a bit more C++-ish.
Change-Id: I59d4f46698ad4606f09e6ffcae8f205798b427ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110912
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx
index 5424bfbde077..a4c272e57768 100644
--- a/sal/osl/w32/tempfile.cxx
+++ b/sal/osl/w32/tempfile.cxx
@@ -21,6 +21,7 @@
#include <osl/file.h>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <rtl/ustring.hxx>
#include "file-impl.hxx"
#include "file_error.hxx"
@@ -227,16 +228,12 @@ oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
}
else if ( nLength )
{
- rtl_uString *ustrTempPath = nullptr;
-
if ( '\\' == lpBuffer[nLength-1] )
- lpBuffer[nLength-1] = 0;
-
- rtl_uString_newFromStr( &ustrTempPath, o3tl::toU(lpBuffer) );
+ --nLength;
- error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
+ const OUString ustrTempPath(o3tl::toU(lpBuffer), static_cast<sal_Int32>(nLength));
- rtl_uString_release( ustrTempPath );
+ error = osl_getFileURLFromSystemPath(ustrTempPath.pData, pustrTempDir);
}
else
error = oslTranslateFileError( GetLastError() );
More information about the Libreoffice-commits
mailing list