Kaydet (Commit) 6e64342d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

clang-cl loplugin: svl

The DdeInternal::Cli/SrvCallback functions apparently had broken signatures for
64-bit Windows (32-bit DWORD vs. 64-bit ULONG_PTR parameters), but I assume that
was actually harmless, as I think that, for Windows x86-64, those arguments are
pushed on the stack right-to-left (regardless of CALLBACK), and they are the
last arguments, and SrvCallback doesn't look at them at all, and CliCallback
only looks at the lower 32-bit DWORD of the first one (nInfo1).

Change-Id: Id77749dd2d29180e2d11b0ae2ad248ac1a7f1bdf
Reviewed-on: https://gerrit.libreoffice.org/29848Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 0deb7d16
...@@ -226,17 +226,17 @@ bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptTyp ...@@ -226,17 +226,17 @@ bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptTyp
{ {
bool isInstalled = false; bool isInstalled = false;
#ifdef _WIN32 #ifdef _WIN32
int nLayouts = GetKeyboardLayoutList(0, NULL); int nLayouts = GetKeyboardLayoutList(0, nullptr);
if (nLayouts > 0) if (nLayouts > 0)
{ {
HKL *lpList = (HKL*)LocalAlloc(LPTR, (nLayouts * sizeof(HKL))); HKL *lpList = static_cast<HKL*>(LocalAlloc(LPTR, (nLayouts * sizeof(HKL))));
if (lpList) if (lpList)
{ {
nLayouts = GetKeyboardLayoutList(nLayouts, lpList); nLayouts = GetKeyboardLayoutList(nLayouts, lpList);
for(int i = 0; i < nLayouts; ++i) for(int i = 0; i < nLayouts; ++i)
{ {
LCID lang = MAKELCID((WORD)((DWORD_PTR)lpList[i] & 0xffff), SORT_DEFAULT); LCID lang = MAKELCID((WORD)(reinterpret_cast<DWORD_PTR>(lpList[i]) & 0xffff), SORT_DEFAULT);
if (MsLangId::getScriptType(lang) == scriptType) if (MsLangId::getScriptType(lang) == scriptType)
{ {
isInstalled = true; isInstalled = true;
......
...@@ -48,7 +48,7 @@ DdeInstData* ImpInitInstData() ...@@ -48,7 +48,7 @@ DdeInstData* ImpInitInstData()
void ImpDeinitInstData() void ImpDeinitInstData()
{ {
delete theDdeInstData; delete theDdeInstData;
theDdeInstData = 0; theDdeInstData = nullptr;
} }
...@@ -58,13 +58,13 @@ struct DdeImp ...@@ -58,13 +58,13 @@ struct DdeImp
long nStatus; long nStatus;
}; };
HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType, HDDEDATA CALLBACK DdeInternal::CliCallback( UINT nCode, UINT nCbType,
HCONV hConv, HSZ, HSZ hText2, HCONV hConv, HSZ, HSZ hText2,
HDDEDATA hData, DWORD nInfo1, DWORD ) HDDEDATA hData, ULONG_PTR nInfo1, ULONG_PTR )
{ {
HDDEDATA nRet = DDE_FNOTPROCESSED; HDDEDATA nRet = DDE_FNOTPROCESSED;
const std::vector<DdeConnection*> &rAll = DdeConnection::GetConnections(); const std::vector<DdeConnection*> &rAll = DdeConnection::GetConnections();
DdeConnection* self = 0; DdeConnection* self = nullptr;
DdeInstData* pInst = ImpGetInstData(); DdeInstData* pInst = ImpGetInstData();
assert(pInst); assert(pInst);
...@@ -90,7 +90,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType, ...@@ -90,7 +90,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType,
{ {
nCode = (*iter)->nType & (XCLASS_MASK | XTYP_MASK); nCode = (*iter)->nType & (XCLASS_MASK | XTYP_MASK);
(*iter)->bBusy = false; (*iter)->bBusy = false;
(*iter)->Done( 0 != hData ); (*iter)->Done( nullptr != hData );
bFound = true; bFound = true;
} }
break; break;
...@@ -101,7 +101,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType, ...@@ -101,7 +101,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType,
? DMLERR_NO_ERROR ? DMLERR_NO_ERROR
: DdeGetLastError( pInst->hDdeInstCli ); : DdeGetLastError( pInst->hDdeInstCli );
iter = self->aTransactions.end(); iter = self->aTransactions.end();
nRet = 0; nRet = nullptr;
bFound = true; bFound = true;
break; break;
...@@ -121,7 +121,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType, ...@@ -121,7 +121,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType,
if( !hData ) if( !hData )
{ {
static_cast<DdeLink*>(*iter)->Notify(); static_cast<DdeLink*>(*iter)->Notify();
nRet = (HDDEDATA)DDE_FACK; nRet = reinterpret_cast<HDDEDATA>(DDE_FACK);
break; break;
} }
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
...@@ -137,7 +137,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType, ...@@ -137,7 +137,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( WORD nCode, WORD nCbType,
d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); d.pImp->nFmt = DdeData::GetInternalFormat( nCbType );
d.Lock(); d.Lock();
(*iter)->Data( &d ); (*iter)->Data( &d );
nRet = (HDDEDATA)DDE_FACK; nRet = reinterpret_cast<HDDEDATA>(DDE_FACK);
break; break;
} }
} }
...@@ -149,7 +149,7 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic ) ...@@ -149,7 +149,7 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic )
{ {
pImp = new DdeImp; pImp = new DdeImp;
pImp->nStatus = DMLERR_NO_ERROR; pImp->nStatus = DMLERR_NO_ERROR;
pImp->hConv = NULL; pImp->hConv = nullptr;
DdeInstData* pInst = ImpGetInstData(); DdeInstData* pInst = ImpGetInstData();
if( !pInst ) if( !pInst )
...@@ -159,7 +159,7 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic ) ...@@ -159,7 +159,7 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic )
if ( !pInst->hDdeInstCli ) if ( !pInst->hDdeInstCli )
{ {
pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli, pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli,
(PFNCALLBACK)DdeInternal::CliCallback, DdeInternal::CliCallback,
APPCLASS_STANDARD | APPCMD_CLIENTONLY | APPCLASS_STANDARD | APPCMD_CLIENTONLY |
CBF_FAIL_ALLSVRXACTIONS | CBF_FAIL_ALLSVRXACTIONS |
CBF_SKIP_REGISTRATIONS | CBF_SKIP_REGISTRATIONS |
...@@ -171,7 +171,7 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic ) ...@@ -171,7 +171,7 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic )
if ( pImp->nStatus == DMLERR_NO_ERROR ) if ( pImp->nStatus == DMLERR_NO_ERROR )
{ {
pImp->hConv = DdeConnect( pInst->hDdeInstCli,pService->getHSZ(),pTopic->getHSZ(), NULL); pImp->hConv = DdeConnect( pInst->hDdeInstCli,pService->getHSZ(),pTopic->getHSZ(), nullptr);
if( !pImp->hConv ) if( !pImp->hConv )
pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli );
} }
...@@ -272,25 +272,25 @@ DdeTransaction::~DdeTransaction() ...@@ -272,25 +272,25 @@ DdeTransaction::~DdeTransaction()
void DdeTransaction::Execute() void DdeTransaction::Execute()
{ {
HSZ hItem = pName->getHSZ(); HSZ hItem = pName->getHSZ();
void* pData = (void*)aDdeData.getData(); void const * pData = aDdeData.getData();
DWORD nData = (DWORD)aDdeData.getSize(); DWORD nData = (DWORD)aDdeData.getSize();
SotClipboardFormatId nIntFmt = aDdeData.pImp->nFmt; SotClipboardFormatId nIntFmt = aDdeData.pImp->nFmt;
UINT nExtFmt = DdeData::GetExternalFormat( nIntFmt ); UINT nExtFmt = DdeData::GetExternalFormat( nIntFmt );
DdeInstData* pInst = ImpGetInstData(); DdeInstData* pInst = ImpGetInstData();
if ( nType == XTYP_EXECUTE ) if ( nType == XTYP_EXECUTE )
hItem = NULL; hItem = nullptr;
if ( nType != XTYP_EXECUTE && nType != XTYP_POKE ) if ( nType != XTYP_EXECUTE && nType != XTYP_POKE )
{ {
pData = NULL; pData = nullptr;
nData = 0L; nData = 0L;
} }
if ( nTime ) if ( nTime )
{ {
HDDEDATA hData = DdeClientTransaction( (unsigned char*)pData, HDDEDATA hData = DdeClientTransaction( static_cast<LPBYTE>(const_cast<void *>(pData)),
nData, rDde.pImp->hConv, nData, rDde.pImp->hConv,
hItem, nExtFmt, (UINT)nType, hItem, nExtFmt, (UINT)nType,
(DWORD)nTime, (DWORD FAR*)NULL ); (DWORD)nTime, nullptr );
rDde.pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); rDde.pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli );
if( hData && nType == XTYP_REQUEST ) if( hData && nType == XTYP_REQUEST )
...@@ -311,10 +311,12 @@ void DdeTransaction::Execute() ...@@ -311,10 +311,12 @@ void DdeTransaction::Execute()
DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId); DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId);
nId = 0; nId = 0;
bBusy = true; bBusy = true;
HDDEDATA hRet = DdeClientTransaction( (unsigned char*)pData, nData, DWORD result;
HDDEDATA hRet = DdeClientTransaction( static_cast<LPBYTE>(const_cast<void *>(pData)), nData,
rDde.pImp->hConv, hItem, nExtFmt, rDde.pImp->hConv, hItem, nExtFmt,
(UINT)nType, TIMEOUT_ASYNC, (UINT)nType, TIMEOUT_ASYNC,
(DWORD FAR *) ((long*) &nId) ); &result );
nId = result;
rDde.pImp->nStatus = hRet ? DMLERR_NO_ERROR rDde.pImp->nStatus = hRet ? DMLERR_NO_ERROR
: DdeGetLastError( pInst->hDdeInstCli ); : DdeGetLastError( pInst->hDdeInstCli );
} }
...@@ -356,7 +358,7 @@ DdeLink::~DdeLink() ...@@ -356,7 +358,7 @@ DdeLink::~DdeLink()
void DdeLink::Notify() void DdeLink::Notify()
{ {
aNotify.Call( NULL ); aNotify.Call( nullptr );
} }
DdeRequest::DdeRequest( DdeConnection& d, const OUString& i, long n ) DdeRequest::DdeRequest( DdeConnection& d, const OUString& i, long n )
...@@ -382,7 +384,7 @@ DdePoke::DdePoke( DdeConnection& d, const OUString& i, const DdeData& rData, ...@@ -382,7 +384,7 @@ DdePoke::DdePoke( DdeConnection& d, const OUString& i, const DdeData& rData,
DdeExecute::DdeExecute( DdeConnection& d, const OUString& rData, long n ) DdeExecute::DdeExecute( DdeConnection& d, const OUString& rData, long n )
: DdeTransaction( d, OUString(), n ) : DdeTransaction( d, OUString(), n )
{ {
aDdeData = DdeData( (void*)rData.getStr(), sizeof(sal_Unicode) * (rData.getLength() + 1), SotClipboardFormatId::STRING ); aDdeData = DdeData( rData.getStr(), sizeof(sal_Unicode) * (rData.getLength() + 1), SotClipboardFormatId::STRING );
nType = XTYP_EXECUTE; nType = XTYP_EXECUTE;
} }
......
...@@ -33,17 +33,17 @@ ...@@ -33,17 +33,17 @@
DdeData::DdeData() DdeData::DdeData()
{ {
pImp = new DdeDataImp; pImp = new DdeDataImp;
pImp->hData = NULL; pImp->hData = nullptr;
pImp->nData = 0; pImp->nData = 0;
pImp->pData = NULL; pImp->pData = nullptr;
pImp->nFmt = SotClipboardFormatId::STRING; pImp->nFmt = SotClipboardFormatId::STRING;
} }
DdeData::DdeData(const void* p, long n, SotClipboardFormatId f) DdeData::DdeData(const void* p, long n, SotClipboardFormatId f)
{ {
pImp = new DdeDataImp; pImp = new DdeDataImp;
pImp->hData = NULL; pImp->hData = nullptr;
pImp->pData = (LPBYTE)p; pImp->pData = p;
pImp->nData = n; pImp->nData = n;
pImp->nFmt = f; pImp->nFmt = f;
} }
...@@ -51,8 +51,8 @@ DdeData::DdeData(const void* p, long n, SotClipboardFormatId f) ...@@ -51,8 +51,8 @@ DdeData::DdeData(const void* p, long n, SotClipboardFormatId f)
DdeData::DdeData( const OUString& s ) DdeData::DdeData( const OUString& s )
{ {
pImp = new DdeDataImp; pImp = new DdeDataImp;
pImp->hData = NULL; pImp->hData = nullptr;
pImp->pData = (LPBYTE)s.getStr(); pImp->pData = s.getStr();
pImp->nData = s.getLength()+1; pImp->nData = s.getLength()+1;
pImp->nFmt = SotClipboardFormatId::STRING; pImp->nFmt = SotClipboardFormatId::STRING;
} }
...@@ -77,7 +77,7 @@ DdeData::~DdeData() ...@@ -77,7 +77,7 @@ DdeData::~DdeData()
void DdeData::Lock() void DdeData::Lock()
{ {
if ( pImp->hData ) if ( pImp->hData )
pImp->pData = DdeAccessData( pImp->hData, (LPDWORD) &pImp->nData ); pImp->pData = DdeAccessData( pImp->hData, &pImp->nData );
} }
SotClipboardFormatId DdeData::GetFormat() const SotClipboardFormatId DdeData::GetFormat() const
...@@ -107,7 +107,7 @@ DdeData& DdeData::operator = ( const DdeData& rData ) ...@@ -107,7 +107,7 @@ DdeData& DdeData::operator = ( const DdeData& rData )
DdeData tmp( rData ); DdeData tmp( rData );
delete pImp; delete pImp;
pImp = tmp.pImp; pImp = tmp.pImp;
tmp.pImp = NULL; tmp.pImp = nullptr;
} }
return *this; return *this;
......
...@@ -41,9 +41,9 @@ class DdeInternal ...@@ -41,9 +41,9 @@ class DdeInternal
{ {
public: public:
static HDDEDATA CALLBACK CliCallback static HDDEDATA CALLBACK CliCallback
( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); ( UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR );
static HDDEDATA CALLBACK SvrCallback static HDDEDATA CALLBACK SvrCallback
( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); ( UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR );
static DdeService* FindService( HSZ ); static DdeService* FindService( HSZ );
static DdeTopic* FindTopic( DdeService&, HSZ ); static DdeTopic* FindTopic( DdeService&, HSZ );
static DdeItem* FindItem( DdeTopic&, HSZ ); static DdeItem* FindItem( DdeTopic&, HSZ );
...@@ -66,7 +66,7 @@ public: ...@@ -66,7 +66,7 @@ public:
DdeString( DWORD, const OUString& ); DdeString( DWORD, const OUString& );
~DdeString(); ~DdeString();
int operator==( HSZ ); bool operator==( HSZ );
HSZ getHSZ(); HSZ getHSZ();
OUString toOUString() const { return m_aString; } OUString toOUString() const { return m_aString; }
}; };
...@@ -75,8 +75,8 @@ public: ...@@ -75,8 +75,8 @@ public:
struct DdeDataImp struct DdeDataImp
{ {
HDDEDATA hData; HDDEDATA hData;
LPBYTE pData; void const * pData;
long nData; DWORD nData;
SotClipboardFormatId nFmt; SotClipboardFormatId nFmt;
}; };
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
: nRefCount(0) : nRefCount(0)
, hDdeInstSvr(0) , hDdeInstSvr(0)
, nInstanceSvr(0) , nInstanceSvr(0)
, pServicesSvr(NULL) , pServicesSvr(nullptr)
, hDdeInstCli(0) , hDdeInstCli(0)
, nInstanceCli(0) , nInstanceCli(0)
{ {
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
DdeString::DdeString( DWORD hDdeInst, const sal_Unicode* p ) DdeString::DdeString( DWORD hDdeInst, const sal_Unicode* p )
: m_aString(p) : m_aString(p)
{ {
hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)p, CP_WINUNICODE ); hString = DdeCreateStringHandle( hDdeInst, p, CP_WINUNICODE );
hInst = hDdeInst; hInst = hDdeInst;
} }
DdeString::DdeString( DWORD hDdeInst, const OUString& r) DdeString::DdeString( DWORD hDdeInst, const OUString& r)
: m_aString(r) : m_aString(r)
{ {
hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)r.getStr(), CP_WINUNICODE ); hString = DdeCreateStringHandle( hDdeInst, r.getStr(), CP_WINUNICODE );
hInst = hDdeInst; hInst = hDdeInst;
} }
...@@ -43,7 +43,7 @@ DdeString::~DdeString() ...@@ -43,7 +43,7 @@ DdeString::~DdeString()
DdeFreeStringHandle( hInst, hString ); DdeFreeStringHandle( hInst, hString );
} }
int DdeString::operator==( HSZ h ) bool DdeString::operator==( HSZ h )
{ {
return( !DdeCmpStringHandles( hString, h ) ); return( !DdeCmpStringHandles( hString, h ) );
} }
......
This diff is collapsed.
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