diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-22 13:11:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 07:54:51 +0100 |
commit | 9af8f190ed1bf3f76897ad0c078db16451d6fb69 (patch) | |
tree | 015089ee72a67eca7db999845cabb8104c8ce3aa /shell | |
parent | 9602e63c818722c3910343b7af53917d031861c8 (diff) |
More loplugin:cstylecast on Windows
Automatic rewrite (of loplugin:cstylecast and loplugin:unnecessaryparen) after
cab0427cadddb3aaf1349c66f2fa13a4234ba4b2 "Enable loplugin:cstylecast for some
more cases" and a409d32e7f6fc09e041079d6dbc3c927497adfed "More
loplugin:cstylecast"
Change-Id: Ib3355159dd08333e1b7a8d091caf2069cdcc7862
Reviewed-on: https://gerrit.libreoffice.org/48317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'shell')
8 files changed, 19 insertions, 19 deletions
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index a4e4d63e5a53..644aa40c687c 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -143,7 +143,7 @@ namespace for ( i = 0; i < ERRTABLESIZE; ++i ) { if ( dwError == errtable[i].oscode ) - return (oslFileError)errtable[i].errnocode; + return static_cast<oslFileError>(errtable[i].errnocode); } /* The error code wasn't in the table. We check for a range of */ diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx b/shell/source/win32/shlxthandler/infotips/infotips.cxx index 682fb3478eef..088eb8e5a983 100644 --- a/shell/source/win32/shlxthandler/infotips/infotips.cxx +++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx @@ -150,7 +150,7 @@ std::wstring formatSizeOfFile( DWORD dwSize ) char *buffer=nullptr; int decimal, sign; - double dFileSize = (double)dwSize/KB; + double dFileSize = static_cast<double>(dwSize)/KB; buffer = _fcvt( dFileSize, 1, &decimal, &sign ); diff --git a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx index 88a194e9a603..222c9342d9ea 100644 --- a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx @@ -149,7 +149,7 @@ BOOL CFullPropSpec::SetProperty( WCHAR const * wcsProperty ) CoTaskMemFree( _psProperty.lpwstr ); } _psProperty.ulKind = PRSPEC_LPWSTR; - int len = (int) ( (wcslen( wcsProperty ) + 1) * sizeof( WCHAR ) ); + int len = static_cast<int>( (wcslen( wcsProperty ) + 1) * sizeof( WCHAR ) ); _psProperty.lpwstr = static_cast<WCHAR *>(CoTaskMemAlloc( len )); if ( nullptr != _psProperty.lpwstr ) { diff --git a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx index 3c734be76fe4..0d0e475ef678 100644 --- a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx @@ -59,7 +59,7 @@ unsigned long BufferStream::sread (unsigned char *buf, unsigned long size) if (hr == S_OK) return newsize; else - return (unsigned long)0; + return static_cast<unsigned long>(0); } long BufferStream::stell () @@ -72,7 +72,7 @@ long BufferStream::stell () hr = stream->Seek (Move, STREAM_SEEK_CUR, &NewPosition); if (hr == S_OK) - return (long) NewPosition.QuadPart; + return static_cast<long>(NewPosition.QuadPart); else return -1; } @@ -82,7 +82,7 @@ long BufferStream::sseek (long offset, int origin) HRESULT hr; LARGE_INTEGER Move; DWORD dwOrigin; - Move.QuadPart = (__int64)offset; + Move.QuadPart = static_cast<__int64>(offset); switch (origin) { diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx index dd71a44f2390..655f1c6cadde 100644 --- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx +++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx @@ -285,7 +285,7 @@ void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader ) OutputDebugStringFormatW( L"CPropertyHdl: LoadProperties\n" ); PROPVARIANT propvarValues; - for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i ) + for ( UINT i = 0; i < UINT(gPropertyMapTableSize); ++i ) { PropVariantClear( &propvarValues ); HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues); diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx index 4fe52c351bc9..87a125a21b1a 100644 --- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx +++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx @@ -194,7 +194,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Read(void *pv, ULONG cb, ULONG *pcb HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *) { - __int64 size = (__int64) ref_zip_buffer_.size(); + __int64 size = static_cast<__int64>(ref_zip_buffer_.size()); __int64 p = 0; switch (dwOrigin) @@ -202,7 +202,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD case STREAM_SEEK_SET: break; case STREAM_SEEK_CUR: - p = (__int64) pos_; + p = static_cast<__int64>(pos_); break; case STREAM_SEEK_END: p = size - 1; @@ -215,7 +215,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD if ( ( p >= 0 ) && (p < size) ) { - pos_ = (size_t) p; + pos_ = static_cast<size_t>(p); hr = S_OK; } return hr; diff --git a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx index 12ed69e549cf..c55d9513b67c 100644 --- a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx +++ b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx @@ -50,13 +50,13 @@ std::wstring iso8601_date_to_local_date(const std::wstring& isoDate ) { std::string asDateTime = WStringToString( ws8601DateTime ); SYSTEMTIME DateTime; - DateTime.wYear = ( unsigned short )strtol( asDateTime.substr( 0, 4 ).c_str(), nullptr, 10 ); - DateTime.wMonth = ( unsigned short )strtol( asDateTime.substr( 5, 2 ).c_str(), nullptr, 10 ); + DateTime.wYear = static_cast<unsigned short>(strtol( asDateTime.substr( 0, 4 ).c_str(), nullptr, 10 )); + DateTime.wMonth = static_cast<unsigned short>(strtol( asDateTime.substr( 5, 2 ).c_str(), nullptr, 10 )); DateTime.wDayOfWeek = 0; - DateTime.wDay = ( unsigned short )strtol( asDateTime.substr( 8, 2 ).c_str(), nullptr, 10 ); - DateTime.wHour = ( unsigned short )strtol( asDateTime.substr( 11,2 ).c_str(), nullptr, 10 ); - DateTime.wMinute = ( unsigned short )strtol( asDateTime.substr( 14,2 ).c_str(), nullptr, 10 ); - DateTime.wSecond = ( unsigned short )strtol( asDateTime.substr( 17,2 ).c_str(), nullptr, 10 ); + DateTime.wDay = static_cast<unsigned short>(strtol( asDateTime.substr( 8, 2 ).c_str(), nullptr, 10 )); + DateTime.wHour = static_cast<unsigned short>(strtol( asDateTime.substr( 11,2 ).c_str(), nullptr, 10 )); + DateTime.wMinute = static_cast<unsigned short>(strtol( asDateTime.substr( 14,2 ).c_str(), nullptr, 10 )); + DateTime.wSecond = static_cast<unsigned short>(strtol( asDateTime.substr( 17,2 ).c_str(), nullptr, 10 )); DateTime.wMilliseconds = 0; //get Date info from structure diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx index 1a1ee62fe4ec..0cf7f204cf7e 100644 --- a/shell/source/win32/zipfile/zipfile.cxx +++ b/shell/source/win32/zipfile/zipfile.cxx @@ -444,7 +444,7 @@ void ZipFile::GetUncompressedContent( return; m_pStream->sseek(end.cdir_offset, SEEK_SET); CentralDirectoryEntry entry; - while (m_pStream->stell() != -1 && (unsigned long)m_pStream->stell() < end.cdir_offset + end.cdir_size) + while (m_pStream->stell() != -1 && static_cast<unsigned long>(m_pStream->stell()) < end.cdir_offset + end.cdir_size) { if (!readCentralDirectoryEntry(m_pStream, entry)) return; @@ -516,7 +516,7 @@ ZipFile::DirectoryPtr_t ZipFile::GetDirectory() const return dir; m_pStream->sseek(end.cdir_offset, SEEK_SET); CentralDirectoryEntry entry; - while (m_pStream->stell() != -1 && (unsigned long)m_pStream->stell() < end.cdir_offset + end.cdir_size) + while (m_pStream->stell() != -1 && static_cast<unsigned long>(m_pStream->stell()) < end.cdir_offset + end.cdir_size) { if (!readCentralDirectoryEntry(m_pStream, entry)) return dir; @@ -555,7 +555,7 @@ long ZipFile::GetFileLongestFileNameLength() const return lmax; m_pStream->sseek(end.cdir_offset, SEEK_SET); CentralDirectoryEntry entry; - while (m_pStream->stell() != -1 && (unsigned long)m_pStream->stell() < end.cdir_offset + end.cdir_size) + while (m_pStream->stell() != -1 && static_cast<unsigned long>(m_pStream->stell()) < end.cdir_offset + end.cdir_size) { if (!readCentralDirectoryEntry(m_pStream, entry)) return lmax; |