summaryrefslogtreecommitdiff
path: root/sfx2
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 /sfx2
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 'sfx2')
-rw-r--r--sfx2/source/appl/shutdowniconw32.cxx22
-rw-r--r--sfx2/source/doc/graphhelp.cxx3
-rw-r--r--sfx2/source/doc/guisaveas.cxx2
-rw-r--r--sfx2/source/doc/syspathw32.cxx2
4 files changed, 14 insertions, 15 deletions
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index f384339f25f2..e670d62e4d7e 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -96,9 +96,9 @@ typedef struct tagMYITEM
static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, bool bOwnerdraw, const OUString& module )
{
MENUITEMINFOW mi;
- memset( &mi, 0, sizeof( MENUITEMINFOW ) );
+ memset( &mi, 0, sizeof( mi ) );
- mi.cbSize = sizeof( MENUITEMINFOW );
+ mi.cbSize = sizeof( mi );
if( id == static_cast<UINT>( -1 ) )
{
mi.fMask=MIIM_TYPE;
@@ -326,7 +326,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
EnableMenuItem( popupMenu, IDM_TEMPLATE, MF_BYCOMMAND | (ShutdownIcon::bModalMode ? MF_GRAYED : MF_ENABLED) );
int m = TrackPopupMenuEx( popupMenu, TPM_RETURNCMD|TPM_LEFTALIGN|TPM_RIGHTBUTTON,
pt.x, pt.y, hWnd, nullptr );
- BOOL const ret = PostMessage( hWnd, 0, 0, 0 );
+ BOOL const ret = PostMessageW( hWnd, 0, 0, 0 );
SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
switch( m )
{
@@ -344,11 +344,11 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
break;
case IDM_EXIT:
// delete taskbar icon
- NOTIFYICONDATAA nid;
- nid.cbSize=sizeof(NOTIFYICONDATA);
+ NOTIFYICONDATAW nid;
+ nid.cbSize=sizeof(nid);
nid.hWnd = hWnd;
nid.uID = ID_QUICKSTART;
- Shell_NotifyIconA(NIM_DELETE, &nid);
+ Shell_NotifyIconW(NIM_DELETE, &nid);
break;
}
@@ -372,11 +372,11 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
else if ( uMsg == s_uMsgKillTray )
{
// delete taskbar icon
- NOTIFYICONDATAA nid;
- nid.cbSize=sizeof(NOTIFYICONDATA);
+ NOTIFYICONDATAW nid;
+ nid.cbSize=sizeof(nid);
nid.hWnd = hWnd;
nid.uID = ID_QUICKSTART;
- Shell_NotifyIconA(NIM_DELETE, &nid);
+ Shell_NotifyIconW(NIM_DELETE, &nid);
BOOL const ret = PostMessageW(aExecuterWindow, WM_COMMAND, IDM_EXIT, reinterpret_cast<LPARAM>(hWnd));
SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
@@ -628,7 +628,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
}
}
- hIcon = static_cast<HICON>(LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ),
+ hIcon = static_cast<HICON>(LoadImageW( hModule, MAKEINTRESOURCEW( pMyItem->iconId ),
IMAGE_ICON, cx, cy,
LR_DEFAULTCOLOR | LR_SHARED ));
@@ -719,7 +719,7 @@ static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, L
{
typedef HRESULT (WINAPI *SHCoCreateInstance_PROC)( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknwon, REFIID iid, LPVOID *ppv );
- SHCoCreateInstance_PROC lpfnSHCoCreateInstance = reinterpret_cast<SHCoCreateInstance_PROC>(GetProcAddress( hModShell, MAKEINTRESOURCE(102) ));
+ SHCoCreateInstance_PROC lpfnSHCoCreateInstance = reinterpret_cast<SHCoCreateInstance_PROC>(GetProcAddress( hModShell, MAKEINTRESOURCEA(102) ));
if ( lpfnSHCoCreateInstance )
hResult = lpfnSHCoCreateInstance( lpszReserved, clsid, pUnkUnknown, iid, ppv );
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index eb8ad7ffe736..02664519ee8a 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -88,7 +88,6 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta )
OUString aMetaFile = aTempFile.GetFileName();
OUString aMetaURL = aTempFile.GetURL();
- OString aWinFile = OUStringToOString( aMetaFile, osl_getThreadTextEncoding() );
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aMetaURL, StreamMode::STD_READWRITE );
if ( pStream )
@@ -99,7 +98,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta )
delete pStream;
if ( !nFailed )
- pResult = GetEnhMetaFileA( aWinFile.getStr() );
+ pResult = GetEnhMetaFileW( SAL_W(aMetaFile.getStr()) );
}
}
#else
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 548ccd30d161..86a02dc5dd8f 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1195,7 +1195,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir )
if( SUCCEEDED(hRes) )
{
OUString sTempINetFiles;
- if( osl::FileBase::getFileURLFromSystemPath(reinterpret_cast<sal_Unicode*>(sPath), sTempINetFiles) == osl::FileBase::E_None )
+ if( osl::FileBase::getFileURLFromSystemPath(SAL_U(sPath), sTempINetFiles) == osl::FileBase::E_None )
bIsInTempPath = !sTempINetFiles.isEmpty() && sLocationURL.startsWith( sTempINetFiles );
}
}
diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx
index c190a7e159bd..ea6e13c078ba 100644
--- a/sfx2/source/doc/syspathw32.cxx
+++ b/sfx2/source/doc/syspathw32.cxx
@@ -61,7 +61,7 @@ static bool SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize )
bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize)
{
#ifdef _WIN32
- return SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize );
+ return SHGetSpecialFolderW32( CSIDL_TEMPLATES, SAL_W(pFolder), nSize );
#else
(void)pFolder;
(void)nSize;