Kaydet (Commit) 7c627843 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:useuniqueptr (clang-cl)

Change-Id: I9b9a6af2a7ff2dd64c474ec7f2dd084d4feb76f0
üst c0d7a40b
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <sal/config.h>
#include <memory>
#include "config.hxx" #include "config.hxx"
#include "utilities.hxx" #include "utilities.hxx"
...@@ -157,11 +161,10 @@ std::wstring getShortPathName( const std::wstring& aLongName ) ...@@ -157,11 +161,10 @@ std::wstring getShortPathName( const std::wstring& aLongName )
if ( length != 0 ) if ( length != 0 )
{ {
WCHAR* buffer = new WCHAR[ length+1 ]; auto buffer = std::unique_ptr<WCHAR[]>(new WCHAR[ length+1 ]);
length = GetShortPathNameW( aLongName.c_str(), buffer, length ); length = GetShortPathNameW( aLongName.c_str(), buffer.get(), length );
if ( length != 0 ) if ( length != 0 )
shortName = std::wstring( buffer ); shortName = std::wstring( buffer.get() );
delete [] buffer;
} }
return shortName; return shortName;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment