diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 08:52:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 12:07:54 +0100 |
commit | 85acc270fc670443cd700c471d9b495e12d4e6dc (patch) | |
tree | 59172f6ee9a51d92548dc64735946b4fcd2a3f7d /sal/qa | |
parent | eea439b4b1305449616e8d0d368f3ccff1a7eca9 (diff) |
improve function-local statics in sal
Change-Id: I0853cf13162bae44cf8a5c44a4546a73f05772d9
Reviewed-on: https://gerrit.libreoffice.org/63780
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index fcc8c41cf4ab..ecb65ae8cd3f 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -4922,8 +4922,7 @@ namespace osl_Directory static OUString const & get_test_path() { - static OUString test_path; - if (test_path.isEmpty()) + static OUString test_path = [&]() { OUString tmp; osl::FileBase::RC rc = osl::FileBase::getTempDirURL(tmp); @@ -4962,14 +4961,16 @@ namespace osl_Directory #endif tmp_x += OString(TEST_PATH_POSTFIX); - rc = osl::FileBase::getFileURLFromSystemPath(OStringToOUString(tmp_x, RTL_TEXTENCODING_UTF8), test_path); + OUString tmpTestPath; + rc = osl::FileBase::getFileURLFromSystemPath(OStringToOUString(tmp_x, RTL_TEXTENCODING_UTF8), tmpTestPath); CPPUNIT_ASSERT_EQUAL_MESSAGE ( "Cannot convert the system path back to an URL", osl::FileBase::E_None, rc - ); - } + ); + return tmpTestPath; + }(); return test_path; } |