diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:05:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:09:24 +0100 |
commit | d57d81e529a44d8042401e36057a69ebe97e870a (patch) | |
tree | 3c434c6998bb9c8754c9b662c4bdb485c0aff29b /sal/osl | |
parent | cf54f2a10f128cf5d79397911b5be710e7081963 (diff) |
Clean up C-style casts from pointers to void
Change-Id: I5e370445affbcd32b05588111f74590bf24f39d6
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/conditn.cxx | 12 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 6 | ||||
-rw-r--r-- | sal/osl/unx/file_stat.cxx | 4 | ||||
-rw-r--r-- | sal/osl/unx/file_volume.cxx | 6 | ||||
-rw-r--r-- | sal/osl/unx/mutex.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/pipe.cxx | 10 | ||||
-rw-r--r-- | sal/osl/unx/process.cxx | 32 | ||||
-rw-r--r-- | sal/osl/unx/process_impl.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/profile.cxx | 56 | ||||
-rw-r--r-- | sal/osl/unx/security.cxx | 8 | ||||
-rw-r--r-- | sal/osl/unx/signal.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/socket.cxx | 26 | ||||
-rw-r--r-- | sal/osl/unx/thread.cxx | 32 |
13 files changed, 99 insertions, 99 deletions
diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx index 37040bff16cb..5d4b0bb5edc8 100644 --- a/sal/osl/unx/conditn.cxx +++ b/sal/osl/unx/conditn.cxx @@ -40,7 +40,7 @@ oslCondition SAL_CALL osl_createCondition() oslConditionImpl* pCond; int nRet=0; - pCond = (oslConditionImpl*) malloc(sizeof(oslConditionImpl)); + pCond = static_cast<oslConditionImpl*>(malloc(sizeof(oslConditionImpl))); if ( pCond == 0 ) { @@ -80,7 +80,7 @@ void SAL_CALL osl_destroyCondition(oslCondition Condition) { oslConditionImpl* pCond; - pCond = (oslConditionImpl*)Condition; + pCond = static_cast<oslConditionImpl*>(Condition); SAL_INFO( "sal.osl.condition", "osl_destroyCondition(" << pCond << ")" ); @@ -103,7 +103,7 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition) int nRet=0; assert(Condition); - pCond = (oslConditionImpl*)Condition; + pCond = static_cast<oslConditionImpl*>(Condition); nRet = pthread_mutex_lock(&pCond->m_Lock); if ( nRet != 0 ) @@ -142,7 +142,7 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition) assert(Condition); - pCond = (oslConditionImpl*)Condition; + pCond = static_cast<oslConditionImpl*>(Condition); nRet = pthread_mutex_lock(&pCond->m_Lock); if ( nRet != 0 ) @@ -172,7 +172,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time oslConditionResult Result = osl_cond_result_ok; assert(Condition); - pCond = (oslConditionImpl*)Condition; + pCond = static_cast<oslConditionImpl*>(Condition); SAL_INFO( "sal.osl.condition", "osl_waitCondition(" << pCond << ")" ); @@ -253,7 +253,7 @@ sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition) int nRet=0; assert(Condition); - pCond = (oslConditionImpl*)Condition; + pCond = static_cast<oslConditionImpl*>(Condition); nRet = pthread_mutex_lock(&pCond->m_Lock); SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_checkCondition(" << pCond << "): pthread_mutex_lock failed: " << strerror(nRet) ); diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index abb7a184df39..a5bfc9983688 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -195,7 +195,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect if( pdir ) { /* create and initialize impl structure */ - oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*) rtl_allocateMemory( sizeof(oslDirectoryImpl) ); + oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(rtl_allocateMemory( sizeof(oslDirectoryImpl) )); if( pDirImpl ) { @@ -229,7 +229,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect oslFileError SAL_CALL osl_closeDirectory( oslDirectory Directory ) { - oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*) Directory; + oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(Directory); oslFileError err = osl_File_E_None; OSL_ASSERT( Directory ); @@ -283,7 +283,7 @@ static struct dirent* osl_readdir_impl_(DIR* pdir, bool bFilterLocalAndParentDir oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirectoryItem* pItem, SAL_UNUSED_PARAMETER sal_uInt32 /*uHint*/) { - oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*)Directory; + oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(Directory); rtl_uString* ustrFileName = NULL; rtl_uString* ustrFilePath = NULL; struct dirent* pEntry; diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx index ab61199f212b..7818282893b9 100644 --- a/sal/osl/unx/file_stat.cxx +++ b/sal/osl/unx/file_stat.cxx @@ -422,8 +422,8 @@ oslFileError SAL_CALL osl_setFileTime ( sal_Bool SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b) { - DirectoryItem_Impl *pA = (DirectoryItem_Impl *) a; - DirectoryItem_Impl *pB = (DirectoryItem_Impl *) b; + DirectoryItem_Impl *pA = static_cast<DirectoryItem_Impl *>(a); + DirectoryItem_Impl *pB = static_cast<DirectoryItem_Impl *>(b); if (a == b) return sal_True; /* same name => same item, unless renaming / moving madness has occurred */ diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index ae480b6274f8..7b07955111dd 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -354,7 +354,7 @@ static rtl_uString* oslMakeUStrFromPsz(const sal_Char* pszStr, rtl_uString** ust oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **pstrPath ) { - oslVolumeDeviceHandleImpl* pItem = (oslVolumeDeviceHandleImpl*) Handle; + oslVolumeDeviceHandleImpl* pItem = static_cast<oslVolumeDeviceHandleImpl*>(Handle); sal_Char Buffer[PATH_MAX]; Buffer[0] = '\0'; @@ -386,7 +386,7 @@ oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uSt oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) { - oslVolumeDeviceHandleImpl* pItem =(oslVolumeDeviceHandleImpl*) Handle; + oslVolumeDeviceHandleImpl* pItem =static_cast<oslVolumeDeviceHandleImpl*>(Handle); if ( pItem == 0 ) { @@ -409,7 +409,7 @@ oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handl oslFileError osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) { - oslVolumeDeviceHandleImpl* pItem =(oslVolumeDeviceHandleImpl*) Handle; + oslVolumeDeviceHandleImpl* pItem =static_cast<oslVolumeDeviceHandleImpl*>(Handle); if ( pItem == 0 ) { diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx index 5898622c0754..9a004755a668 100644 --- a/sal/osl/unx/mutex.cxx +++ b/sal/osl/unx/mutex.cxx @@ -42,7 +42,7 @@ typedef struct _oslMutexImpl /*****************************************************************************/ oslMutex SAL_CALL osl_createMutex() { - oslMutexImpl* pMutex = (oslMutexImpl*) malloc(sizeof(oslMutexImpl)); + oslMutexImpl* pMutex = static_cast<oslMutexImpl*>(malloc(sizeof(oslMutexImpl))); pthread_mutexattr_t aMutexAttr; int nRet=0; diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index 9815a8236f41..98bb9a1d459d 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -77,7 +77,7 @@ oslPipe __osl_createPipeImpl(void) { oslPipe pPipeImpl; - pPipeImpl = (oslPipe)calloc(1, sizeof(struct oslPipeImpl)); + pPipeImpl = static_cast<oslPipe>(calloc(1, sizeof(struct oslPipeImpl))); if (pPipeImpl == NULL) return NULL; pPipeImpl->m_nRefCount =1; @@ -490,7 +490,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, } nRet = recv(pPipe->m_Socket, - (sal_Char*)pBuffer, + pBuffer, BytesToRead, 0); if ( nRet < 0 ) @@ -517,7 +517,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe, } nRet = send(pPipe->m_Socket, - (sal_Char*)pBuffer, + pBuffer, BytesToSend, 0); if ( nRet <= 0 ) @@ -555,7 +555,7 @@ sal_Int32 SAL_CALL osl_writePipe( oslPipe pPipe, const void *pBuffer , sal_Int32 BytesToSend -= RetVal; BytesSend += RetVal; - pBuffer= (sal_Char*)pBuffer + RetVal; + pBuffer= static_cast<sal_Char const *>(pBuffer) + RetVal; } return BytesSend; @@ -581,7 +581,7 @@ sal_Int32 SAL_CALL osl_readPipe( oslPipe pPipe, void *pBuffer , sal_Int32 n ) BytesToRead -= RetVal; BytesRead += RetVal; - pBuffer= (sal_Char*)pBuffer + RetVal; + pBuffer= static_cast<sal_Char*>(pBuffer) + RetVal; } return BytesRead; } diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index d9b4d9567801..af4e59e73429 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -127,7 +127,7 @@ static void ChildStatusProc(void *pData) ProcessData *pdata; int stdOutput[2] = { -1, -1 }, stdInput[2] = { -1, -1 }, stdError[2] = { -1, -1 }; - pdata = (ProcessData *)pData; + pdata = static_cast<ProcessData *>(pData); /* make a copy of our data, because forking will only copy our local stack of the thread, so the process data will not be accessible @@ -469,7 +469,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( if ( pArguments == 0 && nArguments > 0 ) { - pArguments = (sal_Char**) malloc( ( nArguments + 2 ) * sizeof(sal_Char*) ); + pArguments = static_cast<sal_Char**>(malloc( ( nArguments + 2 ) * sizeof(sal_Char*) )); } for ( idx = 0 ; idx < nArguments ; ++idx ) @@ -493,7 +493,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( if ( pEnvironment == 0 ) { - pEnvironment = (sal_Char**) malloc( ( nEnvironmentVars + 2 ) * sizeof(sal_Char*) ); + pEnvironment = static_cast<sal_Char**>(malloc( ( nEnvironmentVars + 2 ) * sizeof(sal_Char*) )); } rtl_uString2String( &strEnv, @@ -626,14 +626,14 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, if (Security != NULL) { - Data.m_uid = ((oslSecurityImpl*)Security)->m_pPasswd.pw_uid; - Data.m_gid = ((oslSecurityImpl*)Security)->m_pPasswd.pw_gid; - Data.m_name = ((oslSecurityImpl*)Security)->m_pPasswd.pw_name; + Data.m_uid = static_cast<oslSecurityImpl*>(Security)->m_pPasswd.pw_uid; + Data.m_gid = static_cast<oslSecurityImpl*>(Security)->m_pPasswd.pw_gid; + Data.m_name = static_cast<oslSecurityImpl*>(Security)->m_pPasswd.pw_name; } else Data.m_uid = (uid_t)-1; - Data.m_pProcImpl = (oslProcessImpl*) malloc(sizeof(oslProcessImpl)); + Data.m_pProcImpl = static_cast<oslProcessImpl*>(malloc(sizeof(oslProcessImpl))); Data.m_pProcImpl->m_pid = 0; Data.m_pProcImpl->m_terminated = osl_createCondition(); Data.m_pProcImpl->m_pnext = NULL; @@ -693,7 +693,7 @@ oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process) if (Process == NULL) return osl_Process_E_Unknown; - if (kill(((oslProcessImpl*)Process)->m_pid, SIGKILL) != 0) + if (kill(static_cast<oslProcessImpl*>(Process)->m_pid, SIGKILL) != 0) { switch (errno) { @@ -735,7 +735,7 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident) pChild = pChild->m_pnext; } - pProcImpl = (oslProcessImpl*) malloc(sizeof(oslProcessImpl)); + pProcImpl = static_cast<oslProcessImpl*>(malloc(sizeof(oslProcessImpl))); pProcImpl->m_pid = Ident; pProcImpl->m_terminated = osl_createCondition(); @@ -781,7 +781,7 @@ void SAL_CALL osl_freeProcessHandle(oslProcess Process) /* remove process from child list */ while (pChild != NULL) { - if (pChild == (oslProcessImpl*)Process) + if (pChild == static_cast<oslProcessImpl*>(Process)) { if (pPrev != NULL) pPrev->m_pnext = pChild->m_pnext; @@ -797,7 +797,7 @@ void SAL_CALL osl_freeProcessHandle(oslProcess Process) osl_releaseMutex(ChildListMutex); - osl_destroyCondition(((oslProcessImpl*)Process)->m_terminated); + osl_destroyCondition(static_cast<oslProcessImpl*>(Process)->m_terminated); free(Process); } @@ -992,7 +992,7 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F if (Process == NULL) pid = getpid(); else - pid = ((oslProcessImpl*)Process)->m_pid; + pid = static_cast<oslProcessImpl*>(Process)->m_pid; if (! pInfo || (pInfo->Size != sizeof(oslProcessInfo))) return osl_Process_E_Unknown; @@ -1008,9 +1008,9 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F if (Fields & osl_Process_EXITCODE) { if ((Process != NULL) && - osl_checkCondition(((oslProcessImpl*)Process)->m_terminated)) + osl_checkCondition(static_cast<oslProcessImpl*>(Process)->m_terminated)) { - pInfo->Code = ((oslProcessImpl*)Process)->m_status; + pInfo->Code = static_cast<oslProcessImpl*>(Process)->m_status; pInfo->Fields |= osl_Process_EXITCODE; } } @@ -1159,7 +1159,7 @@ oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const Ti /* check if process is a child of ours */ while (pChild != NULL) { - if (pChild == (oslProcessImpl*)Process) + if (pChild == static_cast<oslProcessImpl*>(Process)) break; pChild = pChild->m_pnext; @@ -1179,7 +1179,7 @@ oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const Ti else /* alien process; StatusThread will not be able to set the condition terminated */ { - pid_t pid = ((oslProcessImpl*)Process)->m_pid; + pid_t pid = static_cast<oslProcessImpl*>(Process)->m_pid; if (pTimeout) { diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 1462d15df48d..a7c42b11b001 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -200,7 +200,7 @@ void SAL_CALL osl_setCommandArgs (int argc, char ** argv) SAL_WARN_IF(g_command_args.m_nCount != 0, "sal.osl", "args already set"); if (g_command_args.m_nCount == 0) { - rtl_uString** ppArgs = (rtl_uString**)rtl_allocateZeroMemory (argc * sizeof(rtl_uString*)); + rtl_uString** ppArgs = static_cast<rtl_uString**>(rtl_allocateZeroMemory (argc * sizeof(rtl_uString*))); if (ppArgs != 0) { rtl_TextEncoding encoding = osl_getThreadTextEncoding(); diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index ce40c80938be..a291d5a04df1 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -155,7 +155,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o return NULL; } - pProfile = (osl_TProfileImpl*)calloc(1, sizeof(osl_TProfileImpl)); + pProfile = static_cast<osl_TProfileImpl*>(calloc(1, sizeof(osl_TProfileImpl))); if ( pProfile == 0 ) { @@ -186,7 +186,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) { - osl_TProfileImpl* pProfile = (osl_TProfileImpl*)Profile; + osl_TProfileImpl* pProfile = static_cast<osl_TProfileImpl*>(Profile); osl_TProfileImpl* pTmpProfile; if ( Profile == 0 ) @@ -282,7 +282,7 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) { - osl_TProfileImpl* pProfile = (osl_TProfileImpl*) Profile; + osl_TProfileImpl* pProfile = static_cast<osl_TProfileImpl*>(Profile); osl_TFile* pFile; bool bRet = false; @@ -361,7 +361,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, osl_TProfileImpl* pTmpProfile=0; bool bRet = false; - pTmpProfile = (osl_TProfileImpl*) Profile; + pTmpProfile = static_cast<osl_TProfileImpl*>(Profile); if ( pTmpProfile == 0 ) { @@ -495,7 +495,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, osl_TProfileImpl* pProfile = 0; osl_TProfileImpl* pTmpProfile = 0; - pTmpProfile = (osl_TProfileImpl*) Profile; + pTmpProfile = static_cast<osl_TProfileImpl*>(Profile); if ( pTmpProfile == 0 ) { @@ -521,7 +521,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, return sal_False; } - Line = (sal_Char*) malloc(strlen(pszEntry)+strlen(pszString)+48); + Line = static_cast<sal_Char*>(malloc(strlen(pszEntry)+strlen(pszString)+48)); if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) { @@ -648,7 +648,7 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, osl_TProfileImpl* pTmpProfile = 0; bool bRet = false; - pTmpProfile = (osl_TProfileImpl*) Profile; + pTmpProfile = static_cast<osl_TProfileImpl*>(Profile); if ( pTmpProfile == 0 ) { @@ -717,7 +717,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, osl_TProfileImpl* pTmpProfile = 0; bool bRet = false; - pTmpProfile = (osl_TProfileImpl*) Profile; + pTmpProfile = static_cast<osl_TProfileImpl*>(Profile); if ( pTmpProfile == 0 ) { @@ -801,7 +801,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, osl_TProfileImpl* pTmpProfile = 0; bool bRet = false; - pTmpProfile = (osl_TProfileImpl*) Profile; + pTmpProfile = static_cast<osl_TProfileImpl*>(Profile); if ( pTmpProfile == 0 ) { @@ -951,7 +951,7 @@ static bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode) static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption ProfileFlags ) { int Flags; - osl_TFile* pFile = (osl_TFile*) calloc(1, sizeof(osl_TFile)); + osl_TFile* pFile = static_cast<osl_TFile*>(calloc(1, sizeof(osl_TFile))); bool bWriteable = false; if ( ProfileFlags & ( osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE ) ) @@ -1101,7 +1101,7 @@ static sal_Char* OslProfile_getLine(osl_TFile* pFile) pChr++); Max = pChr - pFile->m_pReadPtr; - pNewLine = (sal_Char*) rtl_allocateMemory( nLineBytes + Max + 1 ); + pNewLine = static_cast<sal_Char*>(rtl_allocateMemory( nLineBytes + Max + 1 )); if( pLine ) { memcpy( pNewLine, pLine, nLineBytes ); @@ -1148,7 +1148,7 @@ static bool OslProfile_putLine(osl_TFile* pFile, const sal_Char *pszLine) if ( pFile->m_pWriteBuf == 0 ) { - pFile->m_pWriteBuf = (sal_Char*) malloc(Len+3); + pFile->m_pWriteBuf = static_cast<sal_Char*>(malloc(Len+3)); pFile->m_nWriteBufLen = Len+3; pFile->m_nWriteBufFree = Len+3; } @@ -1158,7 +1158,7 @@ static bool OslProfile_putLine(osl_TFile* pFile, const sal_Char *pszLine) { sal_Char* pTmp; - pTmp=(sal_Char*) realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) ); + pTmp=static_cast<sal_Char*>(realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) )); if ( pTmp == 0 ) { return false; @@ -1206,7 +1206,7 @@ static sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) if (pProfile->m_Lines == NULL) { pProfile->m_MaxLines = LINES_INI; - pProfile->m_Lines = (sal_Char **)malloc(pProfile->m_MaxLines * sizeof(sal_Char *)); + pProfile->m_Lines = static_cast<sal_Char **>(malloc(pProfile->m_MaxLines * sizeof(sal_Char *))); memset(pProfile->m_Lines,0,pProfile->m_MaxLines * sizeof(sal_Char *)); } else @@ -1215,8 +1215,8 @@ static sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) unsigned int oldmax=pProfile->m_MaxLines; pProfile->m_MaxLines += LINES_ADD; - pProfile->m_Lines = (sal_Char **)realloc(pProfile->m_Lines, - pProfile->m_MaxLines * sizeof(sal_Char *)); + pProfile->m_Lines = static_cast<sal_Char **>(realloc(pProfile->m_Lines, + pProfile->m_MaxLines * sizeof(sal_Char *))); for ( idx = oldmax ; idx < pProfile->m_MaxLines ; ++idx ) { pProfile->m_Lines[idx]=0; @@ -1246,14 +1246,14 @@ static sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Line, sa if (pProfile->m_Lines == NULL) { pProfile->m_MaxLines = LINES_INI; - pProfile->m_Lines = (sal_Char **)malloc(pProfile->m_MaxLines * sizeof(sal_Char *)); + pProfile->m_Lines = static_cast<sal_Char **>(malloc(pProfile->m_MaxLines * sizeof(sal_Char *))); memset(pProfile->m_Lines,0,pProfile->m_MaxLines * sizeof(sal_Char *)); } else { pProfile->m_MaxLines += LINES_ADD; - pProfile->m_Lines = (sal_Char **)realloc(pProfile->m_Lines, - pProfile->m_MaxLines * sizeof(sal_Char *)); + pProfile->m_Lines = static_cast<sal_Char **>(realloc(pProfile->m_Lines, + pProfile->m_MaxLines * sizeof(sal_Char *))); memset(&pProfile->m_Lines[pProfile->m_NoLines], 0, @@ -1363,14 +1363,14 @@ static bool addEntry(osl_TProfileImpl* pProfile, if (pSection->m_Entries == NULL) { pSection->m_MaxEntries = ENTRIES_INI; - pSection->m_Entries = (osl_TProfileEntry *)malloc( - pSection->m_MaxEntries * sizeof(osl_TProfileEntry)); + pSection->m_Entries = static_cast<osl_TProfileEntry *>(malloc( + pSection->m_MaxEntries * sizeof(osl_TProfileEntry))); } else { pSection->m_MaxEntries += ENTRIES_ADD; - pSection->m_Entries = (osl_TProfileEntry *)realloc(pSection->m_Entries, - pSection->m_MaxEntries * sizeof(osl_TProfileEntry)); + pSection->m_Entries = static_cast<osl_TProfileEntry *>(realloc(pSection->m_Entries, + pSection->m_MaxEntries * sizeof(osl_TProfileEntry))); } if (pSection->m_Entries == NULL) @@ -1420,7 +1420,7 @@ static bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Sec if (pProfile->m_Sections == NULL) { pProfile->m_MaxSections = SECTIONS_INI; - pProfile->m_Sections = (osl_TProfileSection *)malloc(pProfile->m_MaxSections * sizeof(osl_TProfileSection)); + pProfile->m_Sections = static_cast<osl_TProfileSection *>(malloc(pProfile->m_MaxSections * sizeof(osl_TProfileSection))); memset(pProfile->m_Sections,0,pProfile->m_MaxSections * sizeof(osl_TProfileSection)); } else @@ -1429,8 +1429,8 @@ static bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Sec unsigned int oldmax=pProfile->m_MaxSections; pProfile->m_MaxSections += SECTIONS_ADD; - pProfile->m_Sections = (osl_TProfileSection *)realloc(pProfile->m_Sections, - pProfile->m_MaxSections * sizeof(osl_TProfileSection)); + pProfile->m_Sections = static_cast<osl_TProfileSection *>(realloc(pProfile->m_Sections, + pProfile->m_MaxSections * sizeof(osl_TProfileSection))); for ( idx = oldmax ; idx < pProfile->m_MaxSections ; ++idx ) { pProfile->m_Sections[idx].m_Entries=0; @@ -1783,7 +1783,7 @@ static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_ static osl_TProfileImpl* acquireProfile(oslProfile Profile, bool bWriteable) { - osl_TProfileImpl* pProfile = (osl_TProfileImpl*)Profile; + osl_TProfileImpl* pProfile = static_cast<osl_TProfileImpl*>(Profile); oslProfileOption PFlags=0; if ( bWriteable ) @@ -1797,7 +1797,7 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, bool bWriteable) if (pProfile == NULL) { - if ( ( pProfile = (osl_TProfileImpl*) osl_openProfile(0, PFlags ) ) != NULL ) + if ( ( pProfile = static_cast<osl_TProfileImpl*>(osl_openProfile(0, PFlags )) ) != NULL ) { pProfile->m_Flags |= FLG_AUTOOPEN; } diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index d569d1dd8640..5ee9adf3945d 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -232,7 +232,7 @@ bool SAL_CALL osl_psz_getUserIdent(oslSecurity Security, sal_Char *pszIdent, sal sal_Char buffer[32]; sal_Int32 nChr; - oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; + oslSecurityImpl *pSecImpl = static_cast<oslSecurityImpl *>(Security); if (pSecImpl == NULL) return false; @@ -263,7 +263,7 @@ sal_Bool SAL_CALL osl_getUserName(oslSecurity Security, rtl_uString **ustrName) static bool SAL_CALL osl_psz_getUserName(oslSecurity Security, sal_Char* pszName, sal_uInt32 nMax) { - oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; + oslSecurityImpl *pSecImpl = static_cast<oslSecurityImpl *>(Security); if (pSecImpl == NULL || pSecImpl->m_pPasswd.pw_name == NULL) return false; @@ -294,7 +294,7 @@ sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **pustrDirect static bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirectory, sal_uInt32 nMax) { - oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; + oslSecurityImpl *pSecImpl = static_cast<oslSecurityImpl *>(Security); if (pSecImpl == NULL) return false; @@ -495,7 +495,7 @@ static bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* pszDir sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security) { - oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; + oslSecurityImpl *pSecImpl = static_cast<oslSecurityImpl *>(Security); if (pSecImpl == NULL) return sal_False; diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx index 49ce7f7515f2..85773bd273cc 100644 --- a/sal/osl/unx/signal.cxx +++ b/sal/osl/unx/signal.cxx @@ -483,7 +483,7 @@ oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler, if (! bInitSignal) bInitSignal = InitSignal(); - pHandler = (oslSignalHandlerImpl*) calloc(1, sizeof(oslSignalHandlerImpl)); + pHandler = static_cast<oslSignalHandlerImpl*>(calloc(1, sizeof(oslSignalHandlerImpl))); if (pHandler != NULL) { diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index efa389544f70..db0865bb548c 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -441,7 +441,7 @@ oslSocket __osl_createSocketImpl(int Socket) { oslSocket pSocket; - pSocket = (oslSocket)calloc(1, sizeof(struct oslSocketImpl)); + pSocket = static_cast<oslSocket>(calloc(1, sizeof(struct oslSocketImpl))); pSocket->m_Socket = Socket; pSocket->m_nLastError = 0; @@ -468,7 +468,7 @@ void __osl_destroySocketImpl(oslSocket Socket) static oslSocketAddr __osl_createSocketAddr(void) { - oslSocketAddr pAddr = (oslSocketAddr) rtl_allocateZeroMemory( sizeof( struct oslSocketAddrImpl )); + oslSocketAddr pAddr = static_cast<oslSocketAddr>(rtl_allocateZeroMemory( sizeof( struct oslSocketAddrImpl ))); #if OSL_DEBUG_LEVEL > 1 g_nSocketAddr ++; #endif @@ -832,7 +832,7 @@ static oslHostAddr _osl_hostentToHostAddr (const struct hostent *he) return (oslHostAddr)NULL; } - pAddr= (oslHostAddr) malloc(sizeof(struct oslHostAddrImpl)); + pAddr= static_cast<oslHostAddr>(malloc(sizeof(struct oslHostAddrImpl))); OSL_ASSERT(pAddr); if (pAddr == NULL) { @@ -891,7 +891,7 @@ oslHostAddr SAL_CALL osl_psz_createHostAddr ( if (cn == NULL) return (oslHostAddr)NULL; - pHostAddr= (oslHostAddr) malloc(sizeof(struct oslHostAddrImpl)); + pHostAddr= static_cast<oslHostAddr>(malloc(sizeof(struct oslHostAddrImpl))); OSL_ASSERT(pHostAddr); if (pHostAddr == NULL) { @@ -1779,7 +1779,7 @@ sal_Int32 SAL_CALL osl_receiveSocket(oslSocket pSocket, do { nRead = recv(pSocket->m_Socket, - (sal_Char*)pBuffer, + pBuffer, BytesToRead, MSG_FLAG_TO_NATIVE(Flag)); } while ( nRead < 0 && errno == EINTR ); @@ -1822,7 +1822,7 @@ sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket pSocket, pSocket->m_nLastError=0; nRead = recvfrom(pSocket->m_Socket, - (sal_Char*)pBuffer, + pBuffer, BufferSize, MSG_FLAG_TO_NATIVE(Flag), pSystemSockAddr, @@ -1860,7 +1860,7 @@ sal_Int32 SAL_CALL osl_sendSocket(oslSocket pSocket, do { nWritten = send(pSocket->m_Socket, - (sal_Char*)pBuffer, + pBuffer, BytesToSend, MSG_FLAG_TO_NATIVE(Flag)); } while ( nWritten < 0 && errno == EINTR ); @@ -1907,7 +1907,7 @@ sal_Int32 SAL_CALL osl_sendToSocket(oslSocket pSocket, /* Then sendto should behave like send. */ nWritten = sendto(pSocket->m_Socket, - (sal_Char*)pBuffer, + pBuffer, BytesToSend, MSG_FLAG_TO_NATIVE(Flag), pSystemSockAddr, @@ -1929,7 +1929,7 @@ sal_Int32 SAL_CALL osl_sendToSocket(oslSocket pSocket, sal_Int32 SAL_CALL osl_readSocket ( oslSocket pSocket, void *pBuffer, sal_Int32 n ) { - sal_uInt8 * Ptr = (sal_uInt8 *)pBuffer; + sal_uInt8 * Ptr = static_cast<sal_uInt8 *>(pBuffer); sal_uInt32 BytesRead= 0; sal_uInt32 BytesToRead= n; @@ -1964,7 +1964,7 @@ sal_Int32 SAL_CALL osl_writeSocket( /* loop until all desired bytes were send or an error occurred */ sal_uInt32 BytesSend= 0; sal_uInt32 BytesToSend= n; - sal_uInt8 *Ptr = ( sal_uInt8 * )pBuffer; + sal_uInt8 const *Ptr = static_cast<sal_uInt8 const *>(pBuffer); OSL_ASSERT( pSocket ); @@ -2166,7 +2166,7 @@ sal_Int32 SAL_CALL osl_getSocketOption(oslSocket pSocket, if(getsockopt(pSocket->m_Socket, OPTION_LEVEL_TO_NATIVE(Level), OPTION_TO_NATIVE(Option), - (sal_Char*)pBuffer, + pBuffer, &nOptLen) == -1) { pSocket->m_nLastError=errno; @@ -2195,7 +2195,7 @@ sal_Bool SAL_CALL osl_setSocketOption(oslSocket pSocket, nRet = setsockopt(pSocket->m_Socket, OPTION_LEVEL_TO_NATIVE(Level), OPTION_TO_NATIVE(Option), - (sal_Char*)pBuffer, + pBuffer, BufferLen); if ( nRet < 0 ) @@ -2336,7 +2336,7 @@ oslSocketSet SAL_CALL osl_createSocketSet() { oslSocketSetImpl* pSet; - pSet= (oslSocketSetImpl*)malloc(sizeof(oslSocketSetImpl)); + pSet= static_cast<oslSocketSetImpl*>(malloc(sizeof(oslSocketSetImpl))); OSL_ASSERT(pSet); diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index a0c0cc4e3743..e6bcc451a4c3 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -203,7 +203,7 @@ static void osl_thread_cleanup_Impl (Thread_Impl * pImpl) static void* osl_thread_start_Impl (void* pData) { bool terminate; - Thread_Impl* pImpl= (Thread_Impl*)pData; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(pData); assert(pImpl); @@ -349,7 +349,7 @@ oslThread osl_createSuspendedThread ( void SAL_CALL osl_destroyThread(oslThread Thread) { if (Thread != NULL) { - Thread_Impl * impl = (Thread_Impl *) Thread; + Thread_Impl * impl = static_cast<Thread_Impl *>(Thread); bool active; pthread_mutex_lock(&impl->m_Lock); active = (impl->m_Flags & THREADIMPL_FLAGS_ACTIVE) != 0; @@ -363,7 +363,7 @@ void SAL_CALL osl_destroyThread(oslThread Thread) void SAL_CALL osl_resumeThread(oslThread Thread) { - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) { @@ -385,7 +385,7 @@ void SAL_CALL osl_resumeThread(oslThread Thread) void SAL_CALL osl_suspendThread(oslThread Thread) { - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) { @@ -413,7 +413,7 @@ void SAL_CALL osl_suspendThread(oslThread Thread) sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) { bool active; - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) return sal_False; @@ -429,7 +429,7 @@ void SAL_CALL osl_joinWithThread(oslThread Thread) { pthread_t thread; bool attached; - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) return; @@ -457,7 +457,7 @@ void SAL_CALL osl_joinWithThread(oslThread Thread) void SAL_CALL osl_terminateThread(oslThread Thread) { - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) { @@ -482,7 +482,7 @@ void SAL_CALL osl_terminateThread(oslThread Thread) sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) { bool terminate; - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) { @@ -608,7 +608,7 @@ static sal_uInt16 insertThreadId (pthread_t hThread) if (pEntry == NULL) { - pEntry = (HashEntry*) calloc(sizeof(HashEntry), 1); + pEntry = static_cast<HashEntry*>(calloc(sizeof(HashEntry), 1)); pEntry->Handle = hThread; @@ -661,7 +661,7 @@ static void removeThreadId (pthread_t hThread) oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread) { - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); sal_uInt16 Ident; if (pImpl) @@ -796,7 +796,7 @@ void SAL_CALL osl_setThreadPriority ( #endif /* NO_PTHREAD_PRIORITY */ - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) { @@ -880,7 +880,7 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread) #endif /* NO_PTHREAD_PRIORITY */ oslThreadPriority Priority = osl_Thread_PriorityNormal; - Thread_Impl* pImpl= (Thread_Impl*)Thread; + Thread_Impl* pImpl= static_cast<Thread_Impl*>(Thread); if (!pImpl) { @@ -940,7 +940,7 @@ typedef struct _wrapper_pthread_key oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallback ) { - wrapper_pthread_key *pKey = (wrapper_pthread_key*)rtl_allocateMemory(sizeof(wrapper_pthread_key)); + wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(rtl_allocateMemory(sizeof(wrapper_pthread_key))); if (pKey) { @@ -958,7 +958,7 @@ oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallbac void SAL_CALL osl_destroyThreadKey(oslThreadKey Key) { - wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; + wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(Key); if (pKey) { pthread_key_delete(pKey->m_key); @@ -968,7 +968,7 @@ void SAL_CALL osl_destroyThreadKey(oslThreadKey Key) void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key) { - wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; + wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(Key); return pKey ? pthread_getspecific(pKey->m_key) : NULL; } @@ -976,7 +976,7 @@ sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData) { bool bRet; void *pOldData = NULL; - wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; + wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(Key); if (!pKey) return sal_False; |