summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-26 11:28:57 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-30 11:23:41 +0200
commit362a21d3a129b90149f6ef645c127f5e86e0ba61 (patch)
tree8583cb29b33de56e4489cb8950d2714a1fb2957e /avmedia
parent81ce629c9e8a4fc26ded9d49157e3f3263991e03 (diff)
Use explicit function names for fooA/fooW WinAPI; prefer fooW
We should only use generic foo function name when it takes params that are also dependent on UNICODE define, like LoadCursor( nullptr, IDC_ARROW ) where IDC_ARROW is defined in MSVC headers synchronised with LoadCursor definition. We should always use Unicode API for any file paths operations, because otherwise we will get "?" for any character in path that is not in current non-unicode codepage, which will result in failed file operations. Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633 Reviewed-on: https://gerrit.libreoffice.org/42935 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/win/player.cxx24
-rw-r--r--avmedia/source/win/window.cxx42
2 files changed, 33 insertions, 33 deletions
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 4ba72ca9a368..268babd1b17c 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -44,7 +44,7 @@ namespace avmedia { namespace win {
LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
- Player* pPlayer = reinterpret_cast<Player*>(::GetWindowLongPtr( hWnd, 0 ));
+ Player* pPlayer = reinterpret_cast<Player*>(::GetWindowLongPtrW( hWnd, 0 ));
bool bProcessed = true;
if( pPlayer )
@@ -62,7 +62,7 @@ LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM
else
bProcessed = false;
- return( bProcessed ? 0 : DefWindowProc( hWnd, nMsg, nPar1, nPar2 ) );
+ return( bProcessed ? 0 : DefWindowProcW( hWnd, nMsg, nPar1, nPar2 ) );
}
@@ -226,31 +226,31 @@ void SAL_CALL Player::start( )
{
if ( mbAddWindow )
{
- static WNDCLASS* mpWndClass = nullptr;
+ static WNDCLASSW* mpWndClass = nullptr;
if ( !mpWndClass )
{
- mpWndClass = new WNDCLASS;
+ mpWndClass = new WNDCLASSW;
memset( mpWndClass, 0, sizeof( *mpWndClass ) );
- mpWndClass->hInstance = GetModuleHandle( nullptr );
+ mpWndClass->hInstance = GetModuleHandleW( nullptr );
mpWndClass->cbWndExtra = sizeof( DWORD );
mpWndClass->lpfnWndProc = MediaPlayerWndProc_2;
- mpWndClass->lpszClassName = "com_sun_star_media_Sound_Player";
+ mpWndClass->lpszClassName = L"com_sun_star_media_Sound_Player";
mpWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
mpWndClass->hCursor = ::LoadCursor( nullptr, IDC_ARROW );
- ::RegisterClass( mpWndClass );
+ RegisterClassW( mpWndClass );
}
if ( !mnFrameWnd )
{
- mnFrameWnd = ::CreateWindow( mpWndClass->lpszClassName, nullptr,
- 0,
- 0, 0, 0, 0,
- nullptr, nullptr, mpWndClass->hInstance, nullptr );
+ mnFrameWnd = CreateWindowW( mpWndClass->lpszClassName, nullptr,
+ 0,
+ 0, 0, 0, 0,
+ nullptr, nullptr, mpWndClass->hInstance, nullptr );
if ( mnFrameWnd )
{
::ShowWindow(mnFrameWnd, SW_HIDE);
- ::SetWindowLongPtr( mnFrameWnd, 0, reinterpret_cast<LONG_PTR>(this) );
+ SetWindowLongPtrW( mnFrameWnd, 0, reinterpret_cast<LONG_PTR>(this) );
// mpVW->put_Owner( (OAHWND) mnFrameWnd );
setNotifyWnd( mnFrameWnd );
}
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 8b31cbb2fa61..16deeee09a1e 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -43,7 +43,7 @@ namespace avmedia { namespace win {
LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
- Window* pWindow = reinterpret_cast<Window*>(::GetWindowLongPtr( hWnd, 0 ));
+ Window* pWindow = reinterpret_cast<Window*>(GetWindowLongPtrW( hWnd, 0 ));
bool bProcessed = true;
if( pWindow )
@@ -136,22 +136,22 @@ LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM n
else
bProcessed = false;
- return( bProcessed ? 0 : DefWindowProc( hWnd, nMsg, nPar1, nPar2 ) );
+ return( bProcessed ? 0 : DefWindowProcW( hWnd, nMsg, nPar1, nPar2 ) );
}
-WNDCLASS* lcl_getWndClass()
+WNDCLASSW* lcl_getWndClass()
{
- WNDCLASS* s_pWndClass = new WNDCLASS;
+ WNDCLASSW* s_pWndClass = new WNDCLASSW;
memset( s_pWndClass, 0, sizeof( *s_pWndClass ) );
- s_pWndClass->hInstance = GetModuleHandle( nullptr );
+ s_pWndClass->hInstance = GetModuleHandleW( nullptr );
s_pWndClass->cbWndExtra = sizeof( DWORD );
s_pWndClass->lpfnWndProc = MediaPlayerWndProc;
- s_pWndClass->lpszClassName = "com_sun_star_media_PlayerWnd";
+ s_pWndClass->lpszClassName = L"com_sun_star_media_PlayerWnd";
s_pWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
s_pWndClass->hCursor = ::LoadCursor( nullptr, IDC_ARROW );
- ::RegisterClass( s_pWndClass );
+ RegisterClassW( s_pWndClass );
return s_pWndClass;
}
@@ -261,7 +261,7 @@ void Window::ImplLayoutVideoWindow()
bool Window::create( const uno::Sequence< uno::Any >& rArguments )
{
IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() );
- static WNDCLASS* mpWndClass = lcl_getWndClass();
+ static WNDCLASSW* mpWndClass = lcl_getWndClass();
if( !mnFrameWnd && pVideoWindow && mpWndClass )
{
@@ -273,23 +273,23 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments )
mnParentWnd = reinterpret_cast<HWND>(nWnd);
- mnFrameWnd = ::CreateWindow( mpWndClass->lpszClassName, nullptr,
- WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- aRect.X, aRect.Y, aRect.Width, aRect.Height,
- mnParentWnd, nullptr, mpWndClass->hInstance, nullptr );
+ mnFrameWnd = CreateWindowW( mpWndClass->lpszClassName, nullptr,
+ WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ aRect.X, aRect.Y, aRect.Width, aRect.Height,
+ mnParentWnd, nullptr, mpWndClass->hInstance, nullptr );
if( mnFrameWnd )
{
- ::SetWindowLongPtr( mnFrameWnd, 0, reinterpret_cast<LONG_PTR>(this) );
+ SetWindowLongPtrW( mnFrameWnd, 0, reinterpret_cast<LONG_PTR>(this) );
- pVideoWindow->put_Owner( reinterpret_cast<OAHWND>(mnFrameWnd) );
- pVideoWindow->put_MessageDrain( reinterpret_cast<OAHWND>(mnFrameWnd) );
- pVideoWindow->put_WindowStyle( WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
+ pVideoWindow->put_Owner( reinterpret_cast<OAHWND>(mnFrameWnd) );
+ pVideoWindow->put_MessageDrain( reinterpret_cast<OAHWND>(mnFrameWnd) );
+ pVideoWindow->put_WindowStyle( WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
- mrPlayer.setNotifyWnd( mnFrameWnd );
+ mrPlayer.setNotifyWnd( mnFrameWnd );
- meZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
- ImplLayoutVideoWindow();
+ meZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
+ ImplLayoutVideoWindow();
}
}
@@ -303,7 +303,7 @@ void Window::processGraphEvent()
void Window::updatePointer()
{
- char* pCursorName;
+ LPCTSTR pCursorName;
switch( mnPointerType )
{
@@ -316,7 +316,7 @@ void Window::updatePointer()
break;
}
- ::SetCursor( ::LoadCursor( nullptr, pCursorName ) );
+ SetCursor( LoadCursor( nullptr, pCursorName ) );
}
void SAL_CALL Window::update( )