summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-14 16:45:51 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-15 07:59:10 +0000
commit613213240a84327a0a72bb5ee98cc88d50c1fd0e (patch)
tree718ae88e8ea896ff4dc8cb8542d1de9349dd74d9 /tools
parent810e664de088721b6452016d83fb3ef3e6ca5eb1 (diff)
clang-cl loplugin: tools
Change-Id: I6f02d9607405e144727f925c8f8a1de6041688b9 Reviewed-on: https://gerrit.libreoffice.org/29844 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx25
-rw-r--r--tools/source/misc/cpuid.cxx2
-rw-r--r--tools/source/misc/pathutils.cxx2
-rw-r--r--tools/source/stream/strmwnt.cxx26
4 files changed, 27 insertions, 28 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 79f20b117ad8..161455739d95 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -54,9 +54,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif
#ifdef _WIN32
- CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
- equalsAscii
- ( "file://10.10.1.1/sampledir/sample.file" ) );
+ CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
+ == "file://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
@@ -81,8 +80,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif
#ifdef _WIN32
- CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
- equalsAscii( "file://137.65.170.24/c$/Img0001.jpg" ) );
+ CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
+ == "file://137.65.170.24/c$/Img0001.jpg" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
@@ -107,8 +106,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif
#ifdef _WIN32
- CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
- equalsAscii( "file://hive-winxp-x86/pmladek/test2.odt" ) );
+ CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
+ == "file://hive-winxp-x86/pmladek/test2.odt" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
@@ -126,8 +125,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif
#ifdef _WIN32
- CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
- equalsAscii( "file://10.10.1.1/sampledir/sample.file" ) );
+ CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
+ == "file://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
@@ -150,8 +149,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif
#ifdef _WIN32
- CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
- equalsAscii( "file://137.65.170.24/c$/Img0001.jpg" ) );
+ CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
+ == "file://137.65.170.24/c$/Img0001.jpg" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
@@ -175,8 +174,8 @@ namespace tools_urlobj
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::Smb );
#endif
#ifdef _WIN32
- CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
- equalsAscii( "file://hive-winxp-x86/pmladek/test2.odt" ) );
+ CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE )
+ == "file://hive-winxp-x86/pmladek/test2.odt" );
CPPUNIT_ASSERT( aUrl.GetProtocol( ) == INetProtocol::File );
#endif
CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE )
diff --git a/tools/source/misc/cpuid.cxx b/tools/source/misc/cpuid.cxx
index 5bef56c0fe9c..1518dfc175c4 100644
--- a/tools/source/misc/cpuid.cxx
+++ b/tools/source/misc/cpuid.cxx
@@ -24,7 +24,7 @@ namespace
#include <intrin.h>
void getCpuId(uint32_t array[4])
{
- __cpuid((int*)array, 1);
+ __cpuid(reinterpret_cast<int*>(array), 1);
}
#else
#include <cpuid.h>
diff --git a/tools/source/misc/pathutils.cxx b/tools/source/misc/pathutils.cxx
index d939483e4764..28e63ac674a8 100644
--- a/tools/source/misc/pathutils.cxx
+++ b/tools/source/misc/pathutils.cxx
@@ -98,7 +98,7 @@ WCHAR * buildPath(
return p;
} else {
SetLastError(ERROR_FILENAME_EXCED_RANGE);
- return NULL;
+ return nullptr;
}
}
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index 627471c64edf..204602fff220 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -40,7 +40,7 @@ public:
StreamData()
{
- hFile = 0;
+ hFile = nullptr;
}
};
@@ -138,7 +138,7 @@ std::size_t SvFileStream::GetData( void* pData, std::size_t nSize )
DWORD nCount = 0;
if( IsOpen() )
{
- bool bResult = ReadFile(pInstanceData->hFile,(LPVOID)pData,nSize,&nCount,NULL);
+ bool bResult = ReadFile(pInstanceData->hFile,pData,nSize,&nCount,nullptr);
if( !bResult )
{
std::size_t nTestError = GetLastError();
@@ -153,7 +153,7 @@ std::size_t SvFileStream::PutData( const void* pData, std::size_t nSize )
DWORD nCount = 0;
if( IsOpen() )
{
- if(!WriteFile(pInstanceData->hFile,(LPVOID)pData,nSize,&nCount,NULL))
+ if(!WriteFile(pInstanceData->hFile,pData,nSize,&nCount,nullptr))
SetError(::GetSvError( GetLastError() ) );
}
return nCount;
@@ -168,9 +168,9 @@ sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
{
if( nPos != STREAM_SEEK_TO_END )
// 64-Bit files are not supported
- nNewPos=SetFilePointer(pInstanceData->hFile,nPos,NULL,FILE_BEGIN);
+ nNewPos=SetFilePointer(pInstanceData->hFile,nPos,nullptr,FILE_BEGIN);
else
- nNewPos=SetFilePointer(pInstanceData->hFile,0L,NULL,FILE_END);
+ nNewPos=SetFilePointer(pInstanceData->hFile,0L,nullptr,FILE_END);
if( nNewPos == 0xFFFFFFFF )
{
@@ -318,10 +318,10 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode )
aFileNameA.getStr(),
nAccessMode,
nShareMode,
- (LPSECURITY_ATTRIBUTES)NULL,
+ nullptr,
nOpenAction,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
- (HANDLE) NULL
+ nullptr
);
if( pInstanceData->hFile!=INVALID_HANDLE_VALUE && (
@@ -352,10 +352,10 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode )
aFileNameA.getStr(),
GENERIC_READ,
nShareMode,
- (LPSECURITY_ATTRIBUTES)NULL,
+ nullptr,
nOpenAction,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
- (HANDLE) NULL
+ nullptr
);
if( GetLastError() == ERROR_ALREADY_EXISTS )
SetLastError( ERROR_SUCCESS );
@@ -407,18 +407,18 @@ void SvFileStream::SetSize(sal_uInt64 const nSize)
if( IsOpen() )
{
- int bError = false;
+ bool bError = false;
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( SetFilePointer(hFile,nSize,NULL,FILE_BEGIN ) != 0xffffffff)
+ if( SetFilePointer(hFile,nSize,nullptr,FILE_BEGIN ) != 0xffffffff)
{
bool bSucc = SetEndOfFile( hFile );
if( !bSucc )
bError = true;
}
- if( SetFilePointer( hFile,nOld,NULL,FILE_BEGIN ) == 0xffffffff)
+ if( SetFilePointer( hFile,nOld,nullptr,FILE_BEGIN ) == 0xffffffff)
bError = true;
}
if( bError )