summaryrefslogtreecommitdiff
path: root/dtrans
diff options
context:
space:
mode:
Diffstat (limited to 'dtrans')
-rw-r--r--dtrans/source/win32/dnd/source.cxx2
-rw-r--r--dtrans/source/win32/dnd/target.cxx12
-rw-r--r--dtrans/source/win32/dtobj/DTransHelper.cxx2
-rw-r--r--dtrans/source/win32/dtobj/DataFmtTransl.cxx8
-rw-r--r--dtrans/source/win32/misc/ImplHelper.cxx22
5 files changed, 21 insertions, 25 deletions
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx
index b6d1d9a628bd..06c8e4977def 100644
--- a/dtrans/source/win32/dnd/source.cxx
+++ b/dtrans/source/win32/dnd/source.cxx
@@ -314,7 +314,7 @@ unsigned __stdcall DndOleSTAFunc(LPVOID pParams)
// We force the creation of a thread message queue. This is necessary
// for a later call to AttachThreadInput
MSG msgtemp;
- PeekMessage( &msgtemp, nullptr, WM_USER, WM_USER, PM_NOREMOVE);
+ PeekMessageW( &msgtemp, nullptr, WM_USER, WM_USER, PM_NOREMOVE);
DWORD threadId= GetCurrentThreadId();
diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx
index b797d4e769d8..ab3c554ea5bc 100644
--- a/dtrans/source/win32/dnd/target.cxx
+++ b/dtrans/source/win32/dnd/target.cxx
@@ -76,7 +76,7 @@ void SAL_CALL DropTarget::disposing()
if( m_threadIdTarget)
{
// Call RevokeDragDrop and wait for the OLE thread to die;
- PostThreadMessage( m_threadIdTarget, WM_REVOKEDRAGDROP, reinterpret_cast<WPARAM>(this), 0);
+ PostThreadMessageW( m_threadIdTarget, WM_REVOKEDRAGDROP, reinterpret_cast<WPARAM>(this), 0);
WaitForSingleObject( m_hOleThread, INFINITE);
CloseHandle( m_hOleThread);
//OSL_ENSURE( SUCCEEDED( hr), "HWND not valid!" );
@@ -142,13 +142,13 @@ void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments )
m_threadIdWindow= GetWindowThreadProcessId( m_hWnd, nullptr);
// The event is set by the thread that we will create momentarily.
// It indicates that the thread is ready to receive messages.
- HANDLE m_evtThreadReady= CreateEvent( nullptr, FALSE, FALSE, nullptr);
+ HANDLE m_evtThreadReady= CreateEventW( nullptr, FALSE, FALSE, nullptr);
m_hOleThread= CreateThread( nullptr, 0, DndTargetOleSTAFunc,
&m_evtThreadReady, 0, &m_threadIdTarget);
WaitForSingleObject( m_evtThreadReady, INFINITE);
CloseHandle( m_evtThreadReady);
- PostThreadMessage( m_threadIdTarget, WM_REGISTERDRAGDROP, reinterpret_cast<WPARAM>(this), 0);
+ PostThreadMessageW( m_threadIdTarget, WM_REGISTERDRAGDROP, reinterpret_cast<WPARAM>(this), 0);
}
else if( hr == S_OK || hr == S_FALSE)
{
@@ -197,7 +197,7 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams)
{
MSG msg;
// force the creation of a message queue
- PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE);
+ PeekMessageW( &msg, nullptr, 0, 0, PM_NOREMOVE);
// Signal the creator ( DropTarget::initialize) that the thread is
// ready to receive messages.
SetEvent( *static_cast<HANDLE*>(pParams));
@@ -206,7 +206,7 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams)
DWORD threadId= GetCurrentThreadId();
// We force the creation of a thread message queue. This is necessary
// for a later call to AttachThreadInput
- while( GetMessage(&msg, nullptr, 0, 0) )
+ while( GetMessageW(&msg, nullptr, 0, 0) )
{
if( msg.message == WM_REGISTERDRAGDROP)
{
@@ -238,7 +238,7 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams)
break;
}
TranslateMessage( &msg);
- DispatchMessage( &msg);
+ DispatchMessageW( &msg);
}
OleUninitialize();
}
diff --git a/dtrans/source/win32/dtobj/DTransHelper.cxx b/dtrans/source/win32/dtobj/DTransHelper.cxx
index 49151f4d4fd1..552ec1368f1a 100644
--- a/dtrans/source/win32/dtobj/DTransHelper.cxx
+++ b/dtrans/source/win32/dtobj/DTransHelper.cxx
@@ -177,7 +177,7 @@ sal_uInt32 SAL_CALL CStgTransferHelper::memSize( CLIPFORMAT cf ) const
HGLOBAL hGlob;
GetHGlobalFromStream( m_lpStream, &hGlob );
- if ( CF_TEXT == cf || RegisterClipboardFormat( "HTML Format" ) == cf )
+ if ( CF_TEXT == cf || RegisterClipboardFormatW( L"HTML Format" ) == cf )
{
sal_Char* pText = static_cast< sal_Char* >( GlobalLock( hGlob ) );
if ( pText )
diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.cxx b/dtrans/source/win32/dtobj/DataFmtTransl.cxx
index 9c6f40047967..c72f2646563b 100644
--- a/dtrans/source/win32/dtobj/DataFmtTransl.cxx
+++ b/dtrans/source/win32/dtobj/DataFmtTransl.cxx
@@ -87,7 +87,7 @@ CFormatEtc CDataFormatTranslator::getFormatEtcFromDataFlavor( const DataFlavor&
aFormat >>= aClipFmtName;
OSL_ASSERT( aClipFmtName.getLength( ) );
- cf = RegisterClipboardFormatW( reinterpret_cast<LPCWSTR>(aClipFmtName.getStr( )) );
+ cf = RegisterClipboardFormatW( SAL_W(aClipFmtName.getStr( )) );
OSL_ENSURE( CF_INVALID != cf, "RegisterClipboardFormat failed" );
}
@@ -163,7 +163,7 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const
if ( !aClipFmtName.getLength( ) )
return CFormatEtc( CF_INVALID );
- CLIPFORMAT cf = sal::static_int_cast<CLIPFORMAT>(RegisterClipboardFormatW( reinterpret_cast<LPCWSTR>(aClipFmtName.getStr( )) ));
+ CLIPFORMAT cf = sal::static_int_cast<CLIPFORMAT>(RegisterClipboardFormatW( SAL_W(aClipFmtName.getStr( )) ));
return getFormatEtcForClipformat( cf );
}
@@ -172,7 +172,7 @@ OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat )
OSL_PRECOND( CF_INVALID != aClipformat, "Invalid clipboard format" );
sal_Unicode wBuff[ MAX_CLIPFORMAT_NAME + 1 ]; // Null terminator isn't counted, apparently.
- sal_Int32 nLen = GetClipboardFormatNameW( aClipformat, reinterpret_cast<LPWSTR>(wBuff), MAX_CLIPFORMAT_NAME );
+ sal_Int32 nLen = GetClipboardFormatNameW( aClipformat, SAL_W(wBuff), MAX_CLIPFORMAT_NAME );
return OUString( wBuff, nLen );
}
@@ -204,7 +204,7 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT
of which FileContents it wants to paste
see MSDN: "Handling Shell Data Transfer Scenarios"
*/
- if ( cf == RegisterClipboardFormatA( CFSTR_FILECONTENTS ) )
+ if ( cf == RegisterClipboardFormat( CFSTR_FILECONTENTS ) )
fetc.setLindex( 0 );
return fetc;
diff --git a/dtrans/source/win32/misc/ImplHelper.cxx b/dtrans/source/win32/misc/ImplHelper.cxx
index 8047ffc9a424..f9d5a07a7f28 100644
--- a/dtrans/source/win32/misc/ImplHelper.cxx
+++ b/dtrans/source/win32/misc/ImplHelper.cxx
@@ -92,27 +92,23 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype )
else
OSL_ASSERT( false );
- // we use the GetLocaleInfoA because don't want to provide
- // a unicode wrapper function for Win9x in sal/systools
- char buff[6];
- sal_Int32 nResult = GetLocaleInfoA(
- lcid, lctype | LOCALE_USE_CP_ACP, buff, sizeof( buff ) );
+ // First, get required buffer size, in characters
+ int nResult = GetLocaleInfoW(
+ lcid, lctype, nullptr, 0 );
OSL_ASSERT( nResult );
if ( nResult )
{
- sal_Int32 len = MultiByteToWideChar(
- CP_ACP, 0, buff, -1, nullptr, 0 );
+ std::unique_ptr<wchar_t> buff( new wchar_t[nResult] );
+ // Now get the actual data
+ nResult = GetLocaleInfoW( lcid, lctype, buff.get(), nResult );
- OSL_ASSERT( len > 0 );
+ OSL_ASSERT(nResult);
- std::vector< sal_Unicode > lpwchBuff(len);
+ if (nResult)
+ winCP = SAL_U( buff.get() );
- len = MultiByteToWideChar(
- CP_ACP, 0, buff, -1, reinterpret_cast<LPWSTR>(&lpwchBuff[0]), len );
-
- winCP = OUString( &lpwchBuff[0], (len - 1) );
}
return winCP;