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