summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-15 13:28:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-03-15 16:26:41 +0000
commit66d532fca4cf9504a53bbe0c8a584d1144fc8e0f (patch)
treec7fbb9c3dd39db623853a490735d89fafe7fb37f
parent96328945afe8f920df41741931163ba56b7b2820 (diff)
can't use auto_ptr with an array, wrong delete vs new[]
-rw-r--r--dtrans/source/win32/misc/ImplHelper.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/dtrans/source/win32/misc/ImplHelper.cxx b/dtrans/source/win32/misc/ImplHelper.cxx
index 5243aaccc51e..04c850e7d434 100644
--- a/dtrans/source/win32/misc/ImplHelper.cxx
+++ b/dtrans/source/win32/misc/ImplHelper.cxx
@@ -46,6 +46,8 @@
#include <sehandler.hxx>
#endif
+#include <vector>
+
//------------------------------------------------------------------------
// defines
//------------------------------------------------------------------------
@@ -133,15 +135,12 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype )
OSL_ASSERT( len > 0 );
- std::auto_ptr< sal_Unicode > lpwchBuff( new sal_Unicode[len] );
+ std::vector< sal_Unicode > lpwchBuff(len);
- if ( NULL != lpwchBuff.get( ) )
- {
- len = MultiByteToWideChar(
- CP_ACP, 0, buff, -1, reinterpret_cast<LPWSTR>(lpwchBuff.get( )), len );
+ len = MultiByteToWideChar(
+ CP_ACP, 0, buff, -1, reinterpret_cast<LPWSTR>(&lpwchBuff[0]), len );
- winCP = OUString( lpwchBuff.get( ), (len - 1) );
- }
+ winCP = OUString( &lpwchBuff[0], (len - 1) );
}
return winCP;