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

clang-cl loplugin: tools

Change-Id: I6f02d9607405e144727f925c8f8a1de6041688b9
Reviewed-on: https://gerrit.libreoffice.org/29844Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Tested-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 810e664d
...@@ -54,9 +54,8 @@ namespace tools_urlobj ...@@ -54,9 +54,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
equalsAscii == "file://10.10.1.1/sampledir/sample.file" );
( "file://10.10.1.1/sampledir/sample.file" ) );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ) CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
...@@ -81,8 +80,8 @@ namespace tools_urlobj ...@@ -81,8 +80,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
equalsAscii( "file://137.65.170.24/c$/Img0001.jpg" ) ); == "file://137.65.170.24/c$/Img0001.jpg" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ) CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
...@@ -107,8 +106,8 @@ namespace tools_urlobj ...@@ -107,8 +106,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
equalsAscii( "file://hive-winxp-x86/pmladek/test2.odt" ) ); == "file://hive-winxp-x86/pmladek/test2.odt" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ) CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
...@@ -126,8 +125,8 @@ namespace tools_urlobj ...@@ -126,8 +125,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
equalsAscii( "file://10.10.1.1/sampledir/sample.file" ) ); == "file://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ) CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
...@@ -150,8 +149,8 @@ namespace tools_urlobj ...@@ -150,8 +149,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
equalsAscii( "file://137.65.170.24/c$/Img0001.jpg" ) ); == "file://137.65.170.24/c$/Img0001.jpg" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ) CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
...@@ -175,8 +174,8 @@ namespace tools_urlobj ...@@ -175,8 +174,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
equalsAscii( "file://hive-winxp-x86/pmladek/test2.odt" ) ); == "file://hive-winxp-x86/pmladek/test2.odt" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File ); CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif #endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ) CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
......
...@@ -24,7 +24,7 @@ namespace ...@@ -24,7 +24,7 @@ namespace
#include <intrin.h> #include <intrin.h>
void getCpuId(uint32_t array[4]) void getCpuId(uint32_t array[4])
{ {
__cpuid((int*)array, 1); __cpuid(reinterpret_cast<int*>(array), 1);
} }
#else #else
#include <cpuid.h> #include <cpuid.h>
......
...@@ -98,7 +98,7 @@ WCHAR * buildPath( ...@@ -98,7 +98,7 @@ WCHAR * buildPath(
return p; return p;
} else { } else {
SetLastError(ERROR_FILENAME_EXCED_RANGE); SetLastError(ERROR_FILENAME_EXCED_RANGE);
return NULL; return nullptr;
} }
} }
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
StreamData() StreamData()
{ {
hFile = 0; hFile = nullptr;
} }
}; };
...@@ -138,7 +138,7 @@ std::size_t SvFileStream::GetData( void* pData, std::size_t nSize ) ...@@ -138,7 +138,7 @@ std::size_t SvFileStream::GetData( void* pData, std::size_t nSize )
DWORD nCount = 0; DWORD nCount = 0;
if( IsOpen() ) if( IsOpen() )
{ {
bool bResult = ReadFile(pInstanceData->hFile,(LPVOID)pData,nSize,&nCount,NULL); bool bResult = ReadFile(pInstanceData->hFile,pData,nSize,&nCount,nullptr);
if( !bResult ) if( !bResult )
{ {
std::size_t nTestError = GetLastError(); std::size_t nTestError = GetLastError();
...@@ -153,7 +153,7 @@ std::size_t SvFileStream::PutData( const void* pData, std::size_t nSize ) ...@@ -153,7 +153,7 @@ std::size_t SvFileStream::PutData( const void* pData, std::size_t nSize )
DWORD nCount = 0; DWORD nCount = 0;
if( IsOpen() ) if( IsOpen() )
{ {
if(!WriteFile(pInstanceData->hFile,(LPVOID)pData,nSize,&nCount,NULL)) if(!WriteFile(pInstanceData->hFile,pData,nSize,&nCount,nullptr))
SetError(::GetSvError( GetLastError() ) ); SetError(::GetSvError( GetLastError() ) );
} }
return nCount; return nCount;
...@@ -168,9 +168,9 @@ sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos) ...@@ -168,9 +168,9 @@ sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
{ {
if( nPos != STREAM_SEEK_TO_END ) if( nPos != STREAM_SEEK_TO_END )
// 64-Bit files are not supported // 64-Bit files are not supported
nNewPos=SetFilePointer(pInstanceData->hFile,nPos,NULL,FILE_BEGIN); nNewPos=SetFilePointer(pInstanceData->hFile,nPos,nullptr,FILE_BEGIN);
else else
nNewPos=SetFilePointer(pInstanceData->hFile,0L,NULL,FILE_END); nNewPos=SetFilePointer(pInstanceData->hFile,0L,nullptr,FILE_END);
if( nNewPos == 0xFFFFFFFF ) if( nNewPos == 0xFFFFFFFF )
{ {
...@@ -318,10 +318,10 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode ) ...@@ -318,10 +318,10 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode )
aFileNameA.getStr(), aFileNameA.getStr(),
nAccessMode, nAccessMode,
nShareMode, nShareMode,
(LPSECURITY_ATTRIBUTES)NULL, nullptr,
nOpenAction, nOpenAction,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
(HANDLE) NULL nullptr
); );
if( pInstanceData->hFile!=INVALID_HANDLE_VALUE && ( if( pInstanceData->hFile!=INVALID_HANDLE_VALUE && (
...@@ -352,10 +352,10 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode ) ...@@ -352,10 +352,10 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode )
aFileNameA.getStr(), aFileNameA.getStr(),
GENERIC_READ, GENERIC_READ,
nShareMode, nShareMode,
(LPSECURITY_ATTRIBUTES)NULL, nullptr,
nOpenAction, nOpenAction,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
(HANDLE) NULL nullptr
); );
if( GetLastError() == ERROR_ALREADY_EXISTS ) if( GetLastError() == ERROR_ALREADY_EXISTS )
SetLastError( ERROR_SUCCESS ); SetLastError( ERROR_SUCCESS );
...@@ -407,18 +407,18 @@ void SvFileStream::SetSize(sal_uInt64 const nSize) ...@@ -407,18 +407,18 @@ void SvFileStream::SetSize(sal_uInt64 const nSize)
if( IsOpen() ) if( IsOpen() )
{ {
int bError = false; bool bError = false;
HANDLE hFile = pInstanceData->hFile; HANDLE hFile = pInstanceData->hFile;
DWORD const nOld = SetFilePointer( hFile, 0L, NULL, FILE_CURRENT ); DWORD const nOld = SetFilePointer( hFile, 0L, nullptr, FILE_CURRENT );
if( nOld != 0xffffffff ) if( nOld != 0xffffffff )
{ {
if( SetFilePointer(hFile,nSize,NULL,FILE_BEGIN ) != 0xffffffff) if( SetFilePointer(hFile,nSize,nullptr,FILE_BEGIN ) != 0xffffffff)
{ {
bool bSucc = SetEndOfFile( hFile ); bool bSucc = SetEndOfFile( hFile );
if( !bSucc ) if( !bSucc )
bError = true; bError = true;
} }
if( SetFilePointer( hFile,nOld,NULL,FILE_BEGIN ) == 0xffffffff) if( SetFilePointer( hFile,nOld,nullptr,FILE_BEGIN ) == 0xffffffff)
bError = true; bError = true;
} }
if( bError ) if( bError )
......
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