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 /sal/osl | |
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 'sal/osl')
-rw-r--r-- | sal/osl/w32/backtrace.cxx | 8 | ||||
-rw-r--r-- | sal/osl/w32/dllentry.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/file.cxx | 6 | ||||
-rw-r--r-- | sal/osl/w32/file_dirvol.cxx | 10 | ||||
-rw-r--r-- | sal/osl/w32/file_error.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/file_url.cxx | 4 | ||||
-rw-r--r-- | sal/osl/w32/nlsupport.cxx | 6 | ||||
-rw-r--r-- | sal/osl/w32/pipe.cxx | 4 | ||||
-rw-r--r-- | sal/osl/w32/process.cxx | 12 | ||||
-rw-r--r-- | sal/osl/w32/profile.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/security.cxx | 20 | ||||
-rw-r--r-- | sal/osl/w32/socket.cxx | 22 | ||||
-rw-r--r-- | sal/osl/w32/thread.cxx | 16 | ||||
-rw-r--r-- | sal/osl/w32/time.cxx | 16 |
14 files changed, 65 insertions, 65 deletions
diff --git a/sal/osl/w32/backtrace.cxx b/sal/osl/w32/backtrace.cxx index e5a6e5873e68..160d4e7d0207 100644 --- a/sal/osl/w32/backtrace.cxx +++ b/sal/osl/w32/backtrace.cxx @@ -61,11 +61,11 @@ OUString osl::detail::backtraceAsString(sal_uInt32 maxDepth) for( sal_uInt32 i = 0; i < nFrames; i++ ) { SymFromAddr( hProcess, reinterpret_cast<DWORD64>(aStack[ i ]), nullptr, pSymbol ); - aBuf.append( (sal_Int32)(nFrames - i - 1) ); + aBuf.append( static_cast<sal_Int32>(nFrames - i - 1) ); aBuf.append( ": " ); aBuf.appendAscii( pSymbol->Name ); aBuf.append( " - 0x" ); - aBuf.append( (sal_Int64)pSymbol->Address, 16 ); + aBuf.append( static_cast<sal_Int64>(pSymbol->Address), 16 ); aBuf.append( "\n" ); } @@ -107,11 +107,11 @@ OUString sal::backtrace_to_string(BacktraceState* backtraceState) for( int i = 0; i < nFrames; i++ ) { SymFromAddr( hProcess, reinterpret_cast<DWORD64>(backtraceState->buffer[ i ]), nullptr, pSymbol ); - aBuf.append( (sal_Int32)(nFrames - i - 1) ); + aBuf.append( static_cast<sal_Int32>(nFrames - i - 1) ); aBuf.append( ": " ); aBuf.appendAscii( pSymbol->Name ); aBuf.append( " - 0x" ); - aBuf.append( (sal_Int64)pSymbol->Address, 16 ); + aBuf.append( static_cast<sal_Int64>(pSymbol->Address), 16 ); aBuf.append( "\n" ); } diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx index 77d16e9fb5d4..ffdaeb80dac9 100644 --- a/sal/osl/w32/dllentry.cxx +++ b/sal/osl/w32/dllentry.cxx @@ -216,7 +216,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID ) { DWORD dwThreadId = 0; - DWORD_PTR dwParentProcessId = (DWORD_PTR)_wtol( szBuffer ); + DWORD_PTR dwParentProcessId = static_cast<DWORD_PTR>(_wtol( szBuffer )); if ( dwParentProcessId && GetParentProcessId() == dwParentProcessId ) { diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index 1a08315742ba..aed1b315bb9e 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -253,7 +253,7 @@ oslFileError FileHandle_Impl::setPos(sal_uInt64 uPos) sal_uInt64 FileHandle_Impl::getSize() const { - LONGLONG bufend = std::max((LONGLONG)0, m_bufptr) + m_buflen; + LONGLONG bufend = std::max(LONGLONG(0), m_bufptr) + m_buflen; return std::max(m_size, sal::static_int_cast< sal_uInt64 >(bufend)); } @@ -407,7 +407,7 @@ oslFileError FileHandle_Impl::readFileAt( return osl_File_E_None; } - SIZE_T const bytes = std::min(m_buflen - bufpos, (SIZE_T) nBytesRequested); + SIZE_T const bytes = std::min(m_buflen - bufpos, static_cast<SIZE_T>(nBytesRequested)); memcpy(&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes); nBytesRequested -= bytes; *pBytesRead += bytes; @@ -482,7 +482,7 @@ oslFileError FileHandle_Impl::writeFileAt( m_buflen = sal::static_int_cast< SIZE_T >(uDone); } - SIZE_T const bytes = std::min(m_bufsiz - bufpos, (SIZE_T) nBytesToWrite); + SIZE_T const bytes = std::min(m_bufsiz - bufpos, static_cast<SIZE_T>(nBytesToWrite)); memcpy(&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes); nBytesToWrite -= bytes; *pBytesWritten += bytes; diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index d59932e315fc..1ae8d33c0b78 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -57,7 +57,7 @@ BOOL TimeValueToFileTime(const TimeValue *cpTimeVal, FILETIME *pFTime) { __int64 timeValue; - __int64 localTime = cpTimeVal->Seconds*(__int64)10000000+cpTimeVal->Nanosec/100; + __int64 localTime = cpTimeVal->Seconds*__int64(10000000)+cpTimeVal->Nanosec/100; osl::detail::setFiletime(FTime, localTime); fSuccess = 0 <= (timeValue= osl::detail::getFiletime(BaseFileTime) + osl::detail::getFiletime(FTime)); if (fSuccess) @@ -89,8 +89,8 @@ BOOL FileTimeToTimeValue(const FILETIME *cpFTime, TimeValue *pTimeVal) if ( fSuccess ) { - pTimeVal->Seconds = (unsigned long) (Value / 10000000L); - pTimeVal->Nanosec = (unsigned long)((Value % 10000000L) * 100); + pTimeVal->Seconds = static_cast<unsigned long>(Value / 10000000L); + pTimeVal->Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100); } } return fSuccess; @@ -1630,7 +1630,7 @@ oslFileError SAL_CALL osl_getFileStatus( pStatus->uAttributes = pItemImpl->FindData.dwFileAttributes; pStatus->uValidFields |= osl_FileStatus_Mask_Attributes; - pStatus->uFileSize = (sal_uInt64)pItemImpl->FindData.nFileSizeLow + ((sal_uInt64)pItemImpl->FindData.nFileSizeHigh << 32); + pStatus->uFileSize = static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeLow) + (static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeHigh) << 32); pStatus->uValidFields |= osl_FileStatus_Mask_FileSize; if ( uFieldMask & osl_FileStatus_Mask_LinkTargetURL ) @@ -1685,7 +1685,7 @@ oslFileError SAL_CALL osl_setFileAttributes( dwFileAttributes = GetFileAttributesW( o3tl::toW(rtl_uString_getStr(ustrSysPath)) ); - if ( (DWORD)-1 != dwFileAttributes ) + if ( DWORD(-1) != dwFileAttributes ) { dwFileAttributes &= ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN); diff --git a/sal/osl/w32/file_error.cxx b/sal/osl/w32/file_error.cxx index da71664b6fdb..5336c17fd970 100644 --- a/sal/osl/w32/file_error.cxx +++ b/sal/osl/w32/file_error.cxx @@ -103,7 +103,7 @@ oslFileError oslTranslateFileError (/*DWORD*/ unsigned long dwError) for (i = 0; i < n; ++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/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index f89f2033e168..9b5cb51b110a 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -513,7 +513,7 @@ static bool osl_decodeURL_( rtl_String* strUTF8, rtl_uString** pstrDecodedURL ) aToken[1] = *pSrc++; aToken[2] = 0; - aChar = (sal_Char)strtoul( aToken, nullptr, 16 ); + aChar = static_cast<sal_Char>(strtoul( aToken, nullptr, 16 )); /* The chars are path delimiters and must not be encoded */ @@ -575,7 +575,7 @@ static void osl_encodeURL_( rtl_uString *strURL, rtl_String **pstrEncodedURL ) default: if (!( ( cCurrent >= 'a' && cCurrent <= 'z' ) || ( cCurrent >= 'A' && cCurrent <= 'Z' ) || ( cCurrent >= '0' && cCurrent <= '9' ) ) ) { - sprintf( pURLDest, "%%%02X", (unsigned char)cCurrent ); + sprintf( pURLDest, "%%%02X", static_cast<unsigned char>(cCurrent) ); pURLDest += 3; break; } diff --git a/sal/osl/w32/nlsupport.cxx b/sal/osl/w32/nlsupport.cxx index 5c937ed6de39..1de8cb780dd1 100644 --- a/sal/osl/w32/nlsupport.cxx +++ b/sal/osl/w32/nlsupport.cxx @@ -56,7 +56,7 @@ struct EnumLocalesParams LCID Locale; }; -static DWORD g_dwTLSLocaleEncId = (DWORD) -1; +static DWORD g_dwTLSLocaleEncId = DWORD(-1); /***************************************************************************** * callback function test @@ -148,14 +148,14 @@ rtl_TextEncoding SAL_CALL osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) struct EnumLocalesParams params = { L"", L"", 0 }; /* initialise global TLS id */ - if( (DWORD) -1 == g_dwTLSLocaleEncId ) + if( DWORD(-1) == g_dwTLSLocaleEncId ) { oslMutex globalMutex = * osl_getGlobalMutex(); /* initializing must be thread save */ osl_acquireMutex( globalMutex ); - if( (DWORD) -1 == g_dwTLSLocaleEncId ) + if( DWORD(-1) == g_dwTLSLocaleEncId ) g_dwTLSLocaleEncId = TlsAlloc(); osl_releaseMutex( globalMutex ); diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx index febc4f19c562..b61526f3edf6 100644 --- a/sal/osl/w32/pipe.cxx +++ b/sal/osl/w32/pipe.cxx @@ -386,7 +386,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, if (lastError == ERROR_PIPE_NOT_CONNECTED) nBytes = 0; else - nBytes = (DWORD) -1; + nBytes = DWORD(-1); pPipe->m_Error = osl_Pipe_E_ConnectionAbort; } @@ -415,7 +415,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe, if (GetLastError() == ERROR_PIPE_NOT_CONNECTED) nBytes = 0; else - nBytes = (DWORD) -1; + nBytes = DWORD(-1); pPipe->m_Error = osl_Pipe_E_ConnectionAbort; } diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx index e17d43a787a5..897b88a1767e 100644 --- a/sal/osl/w32/process.cxx +++ b/sal/osl/w32/process.cxx @@ -147,7 +147,7 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident) { oslProcessImpl* pProcImpl; HANDLE hProcess = OpenProcess( - STANDARD_RIGHTS_REQUIRED | PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, (DWORD)Ident); + STANDARD_RIGHTS_REQUIRED | PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, static_cast<DWORD>(Ident)); if (hProcess) { @@ -222,7 +222,7 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F lpAddress = static_cast<LPBYTE>(lpAddress) + Info.RegionSize; } - while (reinterpret_cast<uintptr_t>(lpAddress) <= (uintptr_t)0x7FFFFFFF); // 2GB address space + while (reinterpret_cast<uintptr_t>(lpAddress) <= uintptr_t(0x7FFFFFFF)); // 2GB address space pInfo->Fields |= osl_Process_HEAPUSAGE; } @@ -237,12 +237,12 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F __int64 Value; Value = osl::detail::getFiletime(UserTime); - pInfo->UserTime.Seconds = (unsigned long) (Value / 10000000L); - pInfo->UserTime.Nanosec = (unsigned long)((Value % 10000000L) * 100); + pInfo->UserTime.Seconds = static_cast<unsigned long>(Value / 10000000L); + pInfo->UserTime.Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100); Value = osl::detail::getFiletime(KernelTime); - pInfo->SystemTime.Seconds = (unsigned long) (Value / 10000000L); - pInfo->SystemTime.Nanosec = (unsigned long)((Value % 10000000L) * 100); + pInfo->SystemTime.Seconds = static_cast<unsigned long>(Value / 10000000L); + pInfo->SystemTime.Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100); pInfo->Fields |= osl_Process_CPUTIMES; } diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index d4e0ed6e5dbb..b9fd1dc6e646 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -1207,7 +1207,7 @@ static bool getLine(osl_TFile* pFile, sal_Char *pszLine, int MaxLen) (pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1)); pChr++); - Max = min((int) (pChr - pFile->m_pReadPtr), MaxLen); + Max = min(static_cast<int>(pChr - pFile->m_pReadPtr), MaxLen); memcpy(pLine, pFile->m_pReadPtr, Max); MaxLen -= Max; pLine += Max; diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx index 986afc83412e..8192dbbb6ded 100644 --- a/sal/osl/w32/security.cxx +++ b/sal/osl/w32/security.cxx @@ -329,21 +329,21 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent) { dwSidSize+=wsprintfW(o3tl::toW(Ident) + wcslen(o3tl::toW(Ident)), L"0x%02hx%02hx%02hx%02hx%02hx%02hx", - (USHORT)psia->Value[0], - (USHORT)psia->Value[1], - (USHORT)psia->Value[2], - (USHORT)psia->Value[3], - (USHORT)psia->Value[4], - (USHORT)psia->Value[5]); + static_cast<USHORT>(psia->Value[0]), + static_cast<USHORT>(psia->Value[1]), + static_cast<USHORT>(psia->Value[2]), + static_cast<USHORT>(psia->Value[3]), + static_cast<USHORT>(psia->Value[4]), + static_cast<USHORT>(psia->Value[5])); } else { dwSidSize+=wsprintfW(o3tl::toW(Ident) + wcslen(o3tl::toW(Ident)), L"%lu", - (ULONG)(psia->Value[5] ) + - (ULONG)(psia->Value[4] << 8) + - (ULONG)(psia->Value[3] << 16) + - (ULONG)(psia->Value[2] << 24) ); + static_cast<ULONG>(psia->Value[5] ) + + static_cast<ULONG>(psia->Value[4] << 8) + + static_cast<ULONG>(psia->Value[3] << 16) + + static_cast<ULONG>(psia->Value[2] << 24) ); } /* loop through SidSubAuthorities */ diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx index a369d7ab8d87..bf27bba1a04d 100644 --- a/sal/osl/w32/socket.cxx +++ b/sal/osl/w32/socket.cxx @@ -65,18 +65,18 @@ static DWORD FamilyMap[]= { static oslAddrFamily osl_AddrFamilyFromNative(DWORD nativeType) { - oslAddrFamily i= (oslAddrFamily) 0; + oslAddrFamily i= oslAddrFamily(0); while(i != osl_Socket_FamilyInvalid) { if(FamilyMap[i] == nativeType) return i; - i = (oslAddrFamily) ( (int)i + 1); + i = static_cast<oslAddrFamily>( static_cast<int>(i) + 1); } return i; } #define FAMILY_FROM_NATIVE(y) osl_AddrFamilyFromNative(y) -#define FAMILY_TO_NATIVE(x) (short)FamilyMap[x] +#define FAMILY_TO_NATIVE(x) static_cast<short>(FamilyMap[x]) static DWORD ProtocolMap[]= { 0, /* osl_Socket_FamilyInet */ @@ -99,12 +99,12 @@ static DWORD TypeMap[]= { static oslSocketType osl_SocketTypeFromNative(DWORD nativeType) { - oslSocketType i= (oslSocketType)0; + oslSocketType i= oslSocketType(0); while(i != osl_Socket_TypeInvalid) { if(TypeMap[i] == nativeType) return i; - i = (oslSocketType)((int)i+1); + i = static_cast<oslSocketType>(static_cast<int>(i)+1); } return i; } @@ -197,14 +197,14 @@ static int SocketError[]= { static oslSocketError osl_SocketErrorFromNative(int nativeType) { - oslSocketError i= (oslSocketError)0; + oslSocketError i= oslSocketError(0); while(i != osl_Socket_E_InvalidError) { if(SocketError[i] == nativeType) return i; - i = (oslSocketError)( (int) i + 1); + i = static_cast<oslSocketError>( static_cast<int>(i) + 1); } return i; } @@ -263,7 +263,7 @@ static oslSocketAddr createSocketAddrWithFamily( pInetAddr->sin_family = FAMILY_TO_NATIVE(osl_Socket_FamilyInet); pInetAddr->sin_addr.s_addr = nAddr; - pInetAddr->sin_port = (sal_uInt16)(port&0xffff); + pInetAddr->sin_port = static_cast<sal_uInt16>(port&0xffff); break; } default: @@ -394,7 +394,7 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr ( } oslSocketAddr pAddr = - createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( (sal_uInt16) Port), nAddr ); + createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( static_cast<sal_uInt16>(Port)), nAddr ); return pAddr; } @@ -411,7 +411,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr ( oslSocketAddr pAddr = nullptr; if(Addr != OSL_INADDR_NONE) { - pAddr = createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( (sal_uInt16)Port), Addr ); + pAddr = createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( static_cast<sal_uInt16>(Port)), Addr ); } return pAddr; } @@ -723,7 +723,7 @@ sal_Bool SAL_CALL osl_setInetPortOfSocketAddr ( if (pSystemInetAddr->sin_family != FAMILY_TO_NATIVE(osl_Socket_FamilyInet)) return false; - pSystemInetAddr->sin_port= htons((short)Port); + pSystemInetAddr->sin_port= htons(static_cast<short>(Port)); return true; } diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx index 1e347dc3ebd5..716e299f2a50 100644 --- a/sal/osl/w32/thread.cxx +++ b/sal/osl/w32/thread.cxx @@ -134,9 +134,9 @@ oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread) osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread); if (pThreadImpl != nullptr) - return (oslThreadIdentifier)pThreadImpl->m_ThreadId; + return static_cast<oslThreadIdentifier>(pThreadImpl->m_ThreadId); else - return (oslThreadIdentifier)GetCurrentThreadId(); + return static_cast<oslThreadIdentifier>(GetCurrentThreadId()); } void SAL_CALL osl_destroyThread(oslThread Thread) @@ -366,7 +366,7 @@ void SAL_CALL osl_setThreadName(char const * name) { #pragma pack(pop) info.dwType = 0x1000; info.szName = name; - info.dwThreadID = (DWORD) -1; + info.dwThreadID = DWORD(-1); info.dwFlags = 0; __try { RaiseException( @@ -453,7 +453,7 @@ oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback if ( pTls ) { pTls->pfnCallback = pCallback; - if ( (DWORD)-1 == (pTls->dwIndex = TlsAlloc()) ) + if ( DWORD(-1) == (pTls->dwIndex = TlsAlloc()) ) { rtl_freeMemory( pTls ); pTls = nullptr; @@ -511,7 +511,7 @@ sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData) return false; } -DWORD g_dwTLSTextEncodingIndex = (DWORD)-1; +DWORD g_dwTLSTextEncodingIndex = DWORD(-1); rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void) { @@ -519,7 +519,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void) rtl_TextEncoding _encoding; BOOL gotACP; - if ( (DWORD)-1 == g_dwTLSTextEncodingIndex ) + if ( DWORD(-1) == g_dwTLSTextEncodingIndex ) g_dwTLSTextEncodingIndex = TlsAlloc(); dwEncoding = reinterpret_cast<DWORD_PTR>(TlsGetValue( g_dwTLSTextEncodingIndex )); @@ -529,7 +529,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void) if ( !gotACP ) { _encoding = rtl_getTextEncodingFromWindowsCodePage( GetACP() ); - TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>((DWORD_PTR)MAKELONG( _encoding, TRUE )) ); + TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>(static_cast<DWORD_PTR>(MAKELONG( _encoding, TRUE ))) ); } return _encoding; @@ -539,7 +539,7 @@ rtl_TextEncoding SAL_CALL osl_setThreadTextEncoding( rtl_TextEncoding Encoding ) { rtl_TextEncoding oldEncoding = osl_getThreadTextEncoding(); - TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>((DWORD_PTR)MAKELONG( Encoding, TRUE)) ); + TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>(static_cast<DWORD_PTR>(MAKELONG( Encoding, TRUE))) ); return oldEncoding; } diff --git a/sal/osl/w32/time.cxx b/sal/osl/w32/time.cxx index 51f05ab30a4c..d1284b663fae 100644 --- a/sal/osl/w32/time.cxx +++ b/sal/osl/w32/time.cxx @@ -70,8 +70,8 @@ sal_Bool SAL_CALL osl_getSystemTime(TimeValue* pTimeVal) Value = *reinterpret_cast<__int64 *>(&CurTime) - *reinterpret_cast<__int64 *>(&OffTime); - pTimeVal->Seconds = (unsigned long) (Value / 10000000L); - pTimeVal->Nanosec = (unsigned long)((Value % 10000000L) * 100); + pTimeVal->Seconds = static_cast<unsigned long>(Value / 10000000L); + pTimeVal->Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100); return true; } @@ -143,9 +143,9 @@ sal_Bool SAL_CALL osl_getLocalTimeFromSystemTime( const TimeValue* pSystemTimeVa if ( Success== TIME_ZONE_ID_DAYLIGHT ) bias+=aTimeZoneInformation.DaylightBias; - if ( (sal_Int64) pSystemTimeVal->Seconds > ( bias * 60 ) ) + if ( static_cast<sal_Int64>(pSystemTimeVal->Seconds) > ( bias * 60 ) ) { - pLocalTimeVal->Seconds = (sal_uInt32) (pSystemTimeVal->Seconds - ( bias * 60) ); + pLocalTimeVal->Seconds = static_cast<sal_uInt32>(pSystemTimeVal->Seconds - ( bias * 60) ); pLocalTimeVal->Nanosec = pSystemTimeVal->Nanosec; return true; @@ -170,9 +170,9 @@ sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime( const TimeValue* pLocalTimeVal if ( Success== TIME_ZONE_ID_DAYLIGHT ) bias+=aTimeZoneInformation.DaylightBias; - if ( (sal_Int64) pLocalTimeVal->Seconds + ( bias * 60 ) > 0 ) + if ( static_cast<sal_Int64>(pLocalTimeVal->Seconds) + ( bias * 60 ) > 0 ) { - pSystemTimeVal->Seconds = (sal_uInt32) ( pLocalTimeVal->Seconds + ( bias * 60) ); + pSystemTimeVal->Seconds = static_cast<sal_uInt32>( pLocalTimeVal->Seconds + ( bias * 60) ); pSystemTimeVal->Nanosec = pLocalTimeVal->Nanosec; return true; @@ -195,9 +195,9 @@ sal_uInt32 SAL_CALL osl_getGlobalTimer(void) _ftime( ¤tTime ); - nSeconds = (sal_uInt32)( currentTime.time - startTime.time ); + nSeconds = static_cast<sal_uInt32>( currentTime.time - startTime.time ); - return ( nSeconds * 1000 ) + (long)( currentTime.millitm - startTime.millitm ); + return ( nSeconds * 1000 ) + static_cast<long>( currentTime.millitm - startTime.millitm ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |