[Libreoffice-commits] core.git: vcl/quartz
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 19 08:00:02 UTC 2018
vcl/quartz/utils.cxx | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 21614aadc2b7a7bb6d2e00a5a081d8d233e4384b
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Sep 15 17:28:30 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 19 09:59:38 2018 +0200
use unique_ptr in GetOUString
Change-Id: If229508c3d6cb57b0a52a1f0d9ecd3b82d9f1760
Reviewed-on: https://gerrit.libreoffice.org/60699
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
index bbb29170a8b5..0e0ac8f4d90a 100644
--- a/vcl/quartz/utils.cxx
+++ b/vcl/quartz/utils.cxx
@@ -46,12 +46,11 @@ OUString GetOUString( CFStringRef rStr )
return OUString( reinterpret_cast<sal_Unicode const *>(pConstStr), nLength );
}
- UniChar* pStr = static_cast<UniChar*>( std::malloc( sizeof(UniChar)*nLength ) );
+ std::unique_ptr<UniChar[]> pStr(new UniChar[nLength]);
CFRange aRange = { 0, nLength };
- CFStringGetCharacters( rStr, aRange, pStr );
+ CFStringGetCharacters( rStr, aRange, pStr.get() );
- OUString aRet( reinterpret_cast<sal_Unicode *>(pStr), nLength );
- std::free( pStr );
+ OUString aRet( reinterpret_cast<sal_Unicode *>(pStr.get()), nLength );
return aRet;
}
More information about the Libreoffice-commits
mailing list