diff options
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/w32/tempfile.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
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() ); |