Kaydet (Commit) 66d532fc authored tarafından Caolán McNamara's avatar Caolán McNamara

can't use auto_ptr with an array, wrong delete vs new[]

üst 96328945
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#include <sehandler.hxx> #include <sehandler.hxx>
#endif #endif
#include <vector>
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// defines // defines
//------------------------------------------------------------------------ //------------------------------------------------------------------------
...@@ -133,15 +135,12 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype ) ...@@ -133,15 +135,12 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype )
OSL_ASSERT( len > 0 ); 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[0]), len );
len = MultiByteToWideChar(
CP_ACP, 0, buff, -1, reinterpret_cast<LPWSTR>(lpwchBuff.get( )), len );
winCP = OUString( lpwchBuff.get( ), (len - 1) ); winCP = OUString( &lpwchBuff[0], (len - 1) );
}
} }
return winCP; return winCP;
......
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