summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-08 08:41:17 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-08 08:41:17 +0100
commit7c6278431483efe76059a6a86889f73233fd034b (patch)
tree8fb81d4c31d5ef20a6ef089b91b0fac77e1b438b /shell
parentc0d7a40be2444df158c34fb8aca6a9ff28d9138a (diff)
loplugin:useuniqueptr (clang-cl)
Change-Id: I9b9a6af2a7ff2dd64c474ec7f2dd084d4feb76f0
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 78f960b07c11..66686a7e0d4b 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
+
#include "config.hxx"
#include "utilities.hxx"
@@ -157,11 +161,10 @@ std::wstring getShortPathName( const std::wstring& aLongName )
if ( length != 0 )
{
- WCHAR* buffer = new WCHAR[ length+1 ];
- length = GetShortPathNameW( aLongName.c_str(), buffer, length );
+ auto buffer = std::unique_ptr<WCHAR[]>(new WCHAR[ length+1 ]);
+ length = GetShortPathNameW( aLongName.c_str(), buffer.get(), length );
if ( length != 0 )
- shortName = std::wstring( buffer );
- delete [] buffer;
+ shortName = std::wstring( buffer.get() );
}
return shortName;
}