[Libreoffice-commits] .: dtrans/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Mar 15 09:27:11 PDT 2012
dtrans/source/win32/misc/ImplHelper.cxx | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
New commits:
commit 66d532fca4cf9504a53bbe0c8a584d1144fc8e0f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 15 13:28:18 2012 +0000
can't use auto_ptr with an array, wrong delete vs new[]
diff --git a/dtrans/source/win32/misc/ImplHelper.cxx b/dtrans/source/win32/misc/ImplHelper.cxx
index 5243aac..04c850e 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;
More information about the Libreoffice-commits
mailing list