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 | |
parent | cf54f2a10f128cf5d79397911b5be710e7081963 (diff) |
Clean up C-style casts from pointers to void
Change-Id: I5e370445affbcd32b05588111f74590bf24f39d6
Diffstat (limited to 'sal')
37 files changed, 239 insertions, 239 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; diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 20f5cbef53c2..b5c5cc204c9b 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -1793,9 +1793,9 @@ namespace osl_FileStatus void getAccessTime_001() { TimeValue *pTV_current = NULL; - CPPUNIT_ASSERT( ( pTV_current = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_current = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); TimeValue *pTV_access = NULL; - CPPUNIT_ASSERT( ( pTV_access = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_access = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); ::osl::FileStatus rFileStatus( osl_FileStatus_Mask_AccessTime ); nError = rItem.getFileStatus( rFileStatus ); @@ -1833,7 +1833,7 @@ namespace osl_FileStatus void getModifyTime_001() { TimeValue *pTV_current = NULL; - CPPUNIT_ASSERT( ( pTV_current = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_current = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); //create file aTypeURL = aUserDirectoryURL.copy( 0 ); @@ -1853,7 +1853,7 @@ namespace osl_FileStatus //get modify time TimeValue* pTV_modify = NULL; - CPPUNIT_ASSERT( ( pTV_modify = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_modify = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); *pTV_modify = rFileStatus.getModifyTime(); bool bOK = t_compareTime( pTV_modify, pTV_current, delta ); @@ -3452,13 +3452,13 @@ namespace osl_File void setTime_001() { TimeValue *pTV_current = NULL; - CPPUNIT_ASSERT( ( pTV_current = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_current = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); TimeValue *pTV_creation = NULL; - CPPUNIT_ASSERT( ( pTV_creation = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_creation = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); TimeValue *pTV_access = NULL; - CPPUNIT_ASSERT( ( pTV_access = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_access = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); TimeValue *pTV_modify = NULL; - CPPUNIT_ASSERT( ( pTV_modify = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); + CPPUNIT_ASSERT( ( pTV_modify = static_cast<TimeValue*>(malloc( sizeof( TimeValue ) )) ) != NULL ); //get current time bool bOk = osl_getSystemTime( pTV_current ); diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index 60a336348543..be812e04b161 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -135,7 +135,7 @@ namespace osl_Module #if !defined( MACOSX ) // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); - FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString("firstfunc") ); + FuncPtr pFunc = reinterpret_cast<FuncPtr>(aMod.getSymbol( rtl::OUString("firstfunc") )); OUString aFileURL; bRes = osl::Module::getUrlFromAddress( @@ -258,7 +258,7 @@ namespace osl_Module #if !defined( MACOSX ) // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); - FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString("firstfunc") ); + FuncPtr pFunc = reinterpret_cast<FuncPtr>(aMod.getSymbol( rtl::OUString("firstfunc") )); bRes = false; if ( pFunc ) bRes = pFunc( bRes ); @@ -306,7 +306,7 @@ namespace osl_Module ::osl::Module aMod( getDllURL( ) ); ::rtl::OUString funcName( "firstfunc" ); - FuncPtr pFunc = ( FuncPtr ) osl_getSymbol( (oslModule)aMod, funcName.pData ); + FuncPtr pFunc = reinterpret_cast<FuncPtr>(osl_getSymbol( (oslModule)aMod, funcName.pData )); bRes = false; if ( pFunc ) bRes = pFunc( bRes ); diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index ba5b0b7552f1..5ab883645c5f 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -1736,7 +1736,7 @@ namespace osl_Thread // destroy function when the binding thread terminate void SAL_CALL destroyCallback(void * data) { - delete[] (char *) data; + delete[] static_cast<char *>(data); } static ThreadData myThreadData(destroyCallback); @@ -1765,7 +1765,7 @@ private: pc[1] = '\0'; myThreadData.setData(pc); - char* pData = (char*)myThreadData.getData(); + char* pData = static_cast<char*>(myThreadData.getData()); m_Char_Test = *pData; // wait for long time to check the data value in main thread ThreadHelper::thread_sleep_tenth_sec(3); @@ -1792,7 +1792,7 @@ private: oslThreadIdentifier* pId = new oslThreadIdentifier; *pId = getIdentifier(); idData.setData(pId); - oslThreadIdentifier* pIdData = (oslThreadIdentifier*)idData.getData(); + oslThreadIdentifier* pIdData = static_cast<oslThreadIdentifier*>(idData.getData()); //t_print("Thread %d has Data %d\n", getIdentifier(), *pIdData); m_Id = *pIdData; delete pId; @@ -1883,7 +1883,7 @@ namespace osl_ThreadData myKeyThread aThread2('b'); aThread2.create(); // aThread1 and aThread2 should have not terminated yet, check current data, not 'a' 'b' - char* pChar = (char*)myThreadData.getData(); + char* pChar = static_cast<char*>(myThreadData.getData()); char aChar = *pChar; aThread1.join(); @@ -1922,7 +1922,7 @@ namespace osl_ThreadData pc2[1] = '\0'; myThreadData.setData(pc2); - char* pChar = (char*)myThreadData.getData(); + char* pChar = static_cast<char*>(myThreadData.getData()); char aChar = *pChar; aThread1.join(); @@ -1976,7 +1976,7 @@ namespace osl_ThreadData char cData1 = aThread1.m_Char_Test; char cData2 = aThread2.m_Char_Test; - char* pChar = (char*)myThreadData.getData(); + char* pChar = static_cast<char*>(myThreadData.getData()); char aChar = *pChar; CPPUNIT_ASSERT_MESSAGE( @@ -2007,7 +2007,7 @@ namespace osl_ThreadData pc[1] = '\0'; void* pChar = myThreadData.getData(); - char aChar = *(char*)pChar; + char aChar = *static_cast<char*>(pChar); aThread1.join(); aThread2.join(); diff --git a/sal/qa/rtl/alloc/rtl_alloc.cxx b/sal/qa/rtl/alloc/rtl_alloc.cxx index b0f58a63c613..4aee1ca22978 100644 --- a/sal/qa/rtl/alloc/rtl_alloc.cxx +++ b/sal/qa/rtl/alloc/rtl_alloc.cxx @@ -60,7 +60,7 @@ public: // initialise your test code values here. void setUp() SAL_OVERRIDE { - m_pMemory = (char*) rtl_allocateMemory( m_nSizeOfMemory ); + m_pMemory = static_cast<char*>(rtl_allocateMemory( m_nSizeOfMemory )); } void tearDown() SAL_OVERRIDE @@ -79,7 +79,7 @@ public: void rtl_reallocateMemory_001() { sal_uInt32 nSize = 2 * 1024; - m_pMemory = (char*)rtl_reallocateMemory(m_pMemory, nSize); + m_pMemory = static_cast<char*>(rtl_reallocateMemory(m_pMemory, nSize)); CPPUNIT_ASSERT_MESSAGE( "Can reallocate memory.", m_pMemory != NULL); memset(m_pMemory, 2, nSize); @@ -108,7 +108,7 @@ public: // initialise your test code values here. void setUp() SAL_OVERRIDE { - m_pZeroMemory = (char*) rtl_allocateZeroMemory( m_nSizeOfZeroMemory ); + m_pZeroMemory = static_cast<char*>(rtl_allocateZeroMemory( m_nSizeOfZeroMemory )); } void tearDown() SAL_OVERRIDE diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index b7447175039a..329d013dfafb 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -91,7 +91,7 @@ rtl_machdep_pagesize(); int rtl_arena_segment_constructor (void * obj) { - rtl_arena_segment_type * segment = (rtl_arena_segment_type*)(obj); + rtl_arena_segment_type * segment = static_cast<rtl_arena_segment_type*>(obj); QUEUE_START_NAMED(segment, s); QUEUE_START_NAMED(segment, f); @@ -272,7 +272,7 @@ rtl_arena_hash_rescale ( sal_Size new_bytes; new_bytes = new_size * sizeof(rtl_arena_segment_type*); - new_table = (rtl_arena_segment_type **)rtl_arena_alloc (gp_arena_arena, &new_bytes); + new_table = static_cast<rtl_arena_segment_type **>(rtl_arena_alloc (gp_arena_arena, &new_bytes)); if (new_table != 0) { @@ -586,7 +586,7 @@ rtl_arena_segment_coalesce ( void rtl_arena_constructor (void * obj) { - rtl_arena_type * arena = (rtl_arena_type*)(obj); + rtl_arena_type * arena = static_cast<rtl_arena_type*>(obj); rtl_arena_segment_type * head; size_t i; @@ -627,7 +627,7 @@ rtl_arena_constructor (void * obj) void rtl_arena_destructor (void * obj) { - rtl_arena_type * arena = (rtl_arena_type*)(obj); + rtl_arena_type * arena = static_cast<rtl_arena_type*>(obj); rtl_arena_segment_type * head; size_t i; @@ -705,7 +705,7 @@ rtl_arena_activate ( int i, n = (arena->m_qcache_max >> arena->m_quantum_shift); sal_Size size = n * sizeof(rtl_cache_type*); - arena->m_qcache_ptr = (rtl_cache_type**)rtl_arena_alloc (gp_arena_arena, &size); + arena->m_qcache_ptr = static_cast<rtl_cache_type**>(rtl_arena_alloc (gp_arena_arena, &size)); if (!(arena->m_qcache_ptr)) { /* out of memory */ @@ -878,7 +878,7 @@ SAL_CALL rtl_arena_create ( sal_Size size = sizeof(rtl_arena_type); try_alloc: - result = (rtl_arena_type*)rtl_arena_alloc (gp_arena_arena, &size); + result = static_cast<rtl_arena_type*>(rtl_arena_alloc (gp_arena_arena, &size)); if (result != 0) { rtl_arena_type * arena = result; diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx index d63ae65dbb42..5944043eebb3 100644 --- a/sal/rtl/alloc_cache.cxx +++ b/sal/rtl/alloc_cache.cxx @@ -102,7 +102,7 @@ rtl_cache_hash_rescale ( sal_Size new_bytes; new_bytes = new_size * sizeof(rtl_cache_bufctl_type*); - new_table = (rtl_cache_bufctl_type**)rtl_arena_alloc(gp_cache_arena, &new_bytes); + new_table = static_cast<rtl_cache_bufctl_type**>(rtl_arena_alloc(gp_cache_arena, &new_bytes)); if (new_table != 0) { @@ -236,7 +236,7 @@ rtl_cache_hash_remove ( int rtl_cache_slab_constructor (void * obj, SAL_UNUSED_PARAMETER void *) { - rtl_cache_slab_type * slab = (rtl_cache_slab_type*)(obj); + rtl_cache_slab_type * slab = static_cast<rtl_cache_slab_type*>(obj); QUEUE_START_NAMED(slab, slab_); slab->m_ntypes = 0; @@ -278,7 +278,7 @@ rtl_cache_slab_create ( { /* allocate slab struct from slab cache */ assert(cache != gp_cache_slab_cache); - slab = (rtl_cache_slab_type*)rtl_cache_alloc (gp_cache_slab_cache); + slab = static_cast<rtl_cache_slab_type*>(rtl_cache_alloc (gp_cache_slab_cache)); } else { @@ -413,7 +413,7 @@ rtl_cache_slab_alloc ( { /* allocate bufctl */ assert(cache != gp_cache_bufctl_cache); - bufctl = (rtl_cache_bufctl_type*)rtl_cache_alloc (gp_cache_bufctl_cache); + bufctl = static_cast<rtl_cache_bufctl_type*>(rtl_cache_alloc (gp_cache_bufctl_cache)); if (bufctl == 0) { /* out of memory */ @@ -490,7 +490,7 @@ rtl_cache_slab_free ( else { /* embedded slab struct */ - bufctl = (rtl_cache_bufctl_type*)(addr); + bufctl = static_cast<rtl_cache_bufctl_type*>(addr); slab = RTL_CACHE_SLAB(addr, cache->m_slab_size); } @@ -540,7 +540,7 @@ rtl_cache_slab_free ( int rtl_cache_magazine_constructor (void * obj, SAL_UNUSED_PARAMETER void *) { - rtl_cache_magazine_type * mag = (rtl_cache_magazine_type*)(obj); + rtl_cache_magazine_type * mag = static_cast<rtl_cache_magazine_type*>(obj); /* @@@ sal_Size size = (sal_Size)(arg); @@@ */ mag->m_mag_next = 0; @@ -704,7 +704,7 @@ rtl_cache_depot_populate ( { /* allocate new empty magazine */ RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); - empty = (rtl_cache_magazine_type*)rtl_cache_alloc (cache->m_magazine_cache); + empty = static_cast<rtl_cache_magazine_type*>(rtl_cache_alloc (cache->m_magazine_cache)); RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock)); if (empty != 0) { @@ -722,7 +722,7 @@ rtl_cache_depot_populate ( int rtl_cache_constructor (void * obj) { - rtl_cache_type * cache = (rtl_cache_type*)(obj); + rtl_cache_type * cache = static_cast<rtl_cache_type*>(obj); memset (cache, 0, sizeof(rtl_cache_type)); @@ -750,7 +750,7 @@ rtl_cache_constructor (void * obj) void rtl_cache_destructor (void * obj) { - rtl_cache_type * cache = (rtl_cache_type*)(obj); + rtl_cache_type * cache = static_cast<rtl_cache_type*>(obj); /* linkage */ assert(QUEUE_STARTED_NAMED(cache, cache_)); @@ -1059,7 +1059,7 @@ SAL_CALL rtl_cache_create ( sal_Size size = sizeof(rtl_cache_type); try_alloc: - result = (rtl_cache_type*)rtl_arena_alloc (gp_cache_arena, &size); + result = static_cast<rtl_cache_type*>(rtl_arena_alloc (gp_cache_arena, &size)); if (result != 0) { rtl_cache_type * cache = result; diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx index cff293c97083..69313708e3e5 100644 --- a/sal/rtl/alloc_global.cxx +++ b/sal/rtl/alloc_global.cxx @@ -110,9 +110,9 @@ SAL_CALL rtl_allocateMemory_CUSTOM (sal_Size n) SAL_THROW_EXTERN_C() try_alloc: if (size <= RTL_MEMORY_CACHED_LIMIT) - addr = (char*)rtl_cache_alloc(g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT]); + addr = static_cast<char*>(rtl_cache_alloc(g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT])); else - addr = (char*)rtl_arena_alloc (gp_alloc_arena, &size); + addr = static_cast<char*>(rtl_arena_alloc (gp_alloc_arena, &size)); if (addr != 0) { @@ -138,7 +138,7 @@ void SAL_CALL rtl_freeMemory_CUSTOM (void * p) SAL_THROW_EXTERN_C() { if (p != 0) { - char * addr = (char*)(p) - RTL_MEMALIGN; + char * addr = static_cast<char*>(p) - RTL_MEMALIGN; sal_Size size = reinterpret_cast<sal_Size*>(addr)[0]; if (size <= RTL_MEMORY_CACHED_LIMIT) @@ -157,7 +157,7 @@ void * SAL_CALL rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXT if (p != 0) { void * p_old = p; - sal_Size n_old = reinterpret_cast<sal_Size*>( (char*)(p) - RTL_MEMALIGN )[0] - RTL_MEMALIGN; + sal_Size n_old = reinterpret_cast<sal_Size*>( static_cast<char*>(p) - RTL_MEMALIGN )[0] - RTL_MEMALIGN; p = rtl_allocateMemory (n); if (p != 0) diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx index cd25a62a25e0..a3744863bd8d 100644 --- a/sal/rtl/byteseq.cxx +++ b/sal/rtl/byteseq.cxx @@ -50,7 +50,7 @@ void SAL_CALL rtl_byte_sequence_reference2One( nElements = pSequence->nElements; if (nElements) { - pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nElements ); + pNew = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nElements )); if ( pNew != 0 ) memcpy( pNew->elements, pSequence->elements, nElements ); @@ -60,7 +60,7 @@ void SAL_CALL rtl_byte_sequence_reference2One( } else { - pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE ); + pNew = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE )); } if ( pNew != 0 ) @@ -88,7 +88,7 @@ void SAL_CALL rtl_byte_sequence_realloc( if (pSequence->nRefCount > 1) // split { - pNew = (sal_Sequence *)rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nSize ); + pNew = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nSize )); if ( pNew != 0 ) { @@ -109,8 +109,8 @@ void SAL_CALL rtl_byte_sequence_realloc( } else { - pSequence = (sal_Sequence *)rtl_reallocateMemory( - pSequence, SAL_SEQUENCE_HEADER_SIZE + nSize ); + pSequence = static_cast<sal_Sequence *>(rtl_reallocateMemory( + pSequence, SAL_SEQUENCE_HEADER_SIZE + nSize )); } if ( pSequence != 0 ) @@ -153,7 +153,7 @@ void SAL_CALL rtl_byte_sequence_construct( sal_Sequence **ppSequence , sal_Int32 if( nLength ) { - *ppSequence = (sal_Sequence *) rtl_allocateZeroMemory( SAL_SEQUENCE_HEADER_SIZE + nLength ); + *ppSequence = static_cast<sal_Sequence *>(rtl_allocateZeroMemory( SAL_SEQUENCE_HEADER_SIZE + nLength )); if ( *ppSequence != 0 ) { @@ -178,7 +178,7 @@ void SAL_CALL rtl_byte_sequence_constructNoDefault( sal_Sequence **ppSequence , *ppSequence = 0; } - *ppSequence = (sal_Sequence *) rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nLength ); + *ppSequence = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nLength )); if ( *ppSequence != 0 ) { diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx index ba799ec846ca..50de1a9ad822 100644 --- a/sal/rtl/cipher.cxx +++ b/sal/rtl/cipher.cxx @@ -138,7 +138,7 @@ rtlCipherError SAL_CALL rtl_cipher_init ( const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast<Cipher_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; if (pImpl->m_init == NULL) @@ -156,7 +156,7 @@ rtlCipherError SAL_CALL rtl_cipher_encode ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast<Cipher_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; if (pImpl->m_encode == NULL) @@ -173,7 +173,7 @@ rtlCipherError SAL_CALL rtl_cipher_decode ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast<Cipher_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; if (pImpl->m_decode == NULL) @@ -187,7 +187,7 @@ rtlCipherError SAL_CALL rtl_cipher_decode ( */ void SAL_CALL rtl_cipher_destroy (rtlCipher Cipher) SAL_THROW_EXTERN_C() { - Cipher_Impl *pImpl = (Cipher_Impl*)Cipher; + Cipher_Impl *pImpl = static_cast<Cipher_Impl*>(Cipher); if (pImpl && pImpl->m_delete) pImpl->m_delete (Cipher); } @@ -1010,7 +1010,7 @@ rtlCipher SAL_CALL rtl_cipher_createBF (rtlCipherMode Mode) SAL_THROW_EXTERN_C() if (Mode == rtl_Cipher_ModeInvalid) return ((rtlCipher)NULL); - pImpl = ((CipherBF_Impl*)rtl_allocateZeroMemory (sizeof (CipherBF_Impl))); + pImpl = static_cast<CipherBF_Impl*>(rtl_allocateZeroMemory (sizeof (CipherBF_Impl))); if (pImpl) { pImpl->m_cipher.m_algorithm = rtl_Cipher_AlgorithmBF; @@ -1034,7 +1034,7 @@ rtlCipherError SAL_CALL rtl_cipher_initBF ( const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast<CipherBF_Impl*>(Cipher); if ((pImpl == NULL) || (pKeyData == NULL)) return rtl_Cipher_E_Argument; @@ -1060,7 +1060,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeBF ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast<CipherBF_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1075,7 +1075,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeBF ( return __rtl_cipherBF_update ( &(pImpl->m_context), pImpl->m_cipher.m_mode, rtl_Cipher_DirectionEncode, - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast<const sal_uInt8*>(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1086,7 +1086,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast<CipherBF_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1101,7 +1101,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF ( return __rtl_cipherBF_update ( &(pImpl->m_context), pImpl->m_cipher.m_mode, rtl_Cipher_DirectionDecode, - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast<const sal_uInt8*>(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1109,7 +1109,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF ( */ void SAL_CALL rtl_cipher_destroyBF (rtlCipher Cipher) SAL_THROW_EXTERN_C() { - CipherBF_Impl *pImpl = (CipherBF_Impl*)Cipher; + CipherBF_Impl *pImpl = static_cast<CipherBF_Impl*>(Cipher); if (pImpl) { if (pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmBF) @@ -1246,7 +1246,7 @@ rtlCipher SAL_CALL rtl_cipher_createARCFOUR (rtlCipherMode Mode) if (!(Mode == rtl_Cipher_ModeStream)) return ((rtlCipher)NULL); - pImpl = ((CipherARCFOUR_Impl*)rtl_allocateZeroMemory (sizeof (CipherARCFOUR_Impl))); + pImpl = static_cast<CipherARCFOUR_Impl*>(rtl_allocateZeroMemory (sizeof (CipherARCFOUR_Impl))); if (pImpl) { pImpl->m_cipher.m_algorithm = rtl_Cipher_AlgorithmARCFOUR; @@ -1271,7 +1271,7 @@ rtlCipherError SAL_CALL rtl_cipher_initARCFOUR ( SAL_UNUSED_PARAMETER const sal_uInt8 *, SAL_UNUSED_PARAMETER sal_Size) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast<CipherARCFOUR_Impl*>(Cipher); if ((pImpl == NULL) || (pKeyData == NULL)) return rtl_Cipher_E_Argument; @@ -1295,7 +1295,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast<CipherARCFOUR_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1307,7 +1307,7 @@ rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR ( return rtl_cipherARCFOUR_update_Impl ( &(pImpl->m_context), - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast<const sal_uInt8*>(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1318,7 +1318,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast<CipherARCFOUR_Impl*>(Cipher); if (pImpl == NULL) return rtl_Cipher_E_Argument; @@ -1330,7 +1330,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( return rtl_cipherARCFOUR_update_Impl ( &(pImpl->m_context), - (const sal_uInt8*)pData, nDatLen, pBuffer, nBufLen); + static_cast<const sal_uInt8*>(pData), nDatLen, pBuffer, nBufLen); } /* @@ -1338,7 +1338,7 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( */ void SAL_CALL rtl_cipher_destroyARCFOUR (rtlCipher Cipher) SAL_THROW_EXTERN_C() { - CipherARCFOUR_Impl *pImpl = (CipherARCFOUR_Impl*)Cipher; + CipherARCFOUR_Impl *pImpl = static_cast<CipherARCFOUR_Impl*>(Cipher); if (pImpl) { if (pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmARCFOUR) diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx index ef9f9bde2ae3..0baae609efdf 100644 --- a/sal/rtl/cmdargs.cxx +++ b/sal/rtl/cmdargs.cxx @@ -52,7 +52,7 @@ void init() sal_Int32 i, n = osl_getCommandArgCount(); g_ppCommandArgs = - (rtl_uString**)rtl_allocateZeroMemory (n * sizeof(rtl_uString*)); + static_cast<rtl_uString**>(rtl_allocateZeroMemory (n * sizeof(rtl_uString*))); for (i = 0; i < n; i++) { rtl_uString * pArg = 0; diff --git a/sal/rtl/crc.cxx b/sal/rtl/crc.cxx index 1e2c6736b045..beae3750c832 100644 --- a/sal/rtl/crc.cxx +++ b/sal/rtl/crc.cxx @@ -141,7 +141,7 @@ sal_uInt32 SAL_CALL rtl_crc32 ( { if (Data) { - const sal_uInt8 *p = (const sal_uInt8 *)Data; + const sal_uInt8 *p = static_cast<const sal_uInt8 *>(Data); const sal_uInt8 *q = p + DatLen; Crc = ~Crc; diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx index d8321fa9cada..5aba0ea91b67 100644 --- a/sal/rtl/digest.cxx +++ b/sal/rtl/digest.cxx @@ -29,7 +29,7 @@ * rtlDigest internals. * *======================================================================*/ -#define RTL_DIGEST_CREATE(T) ((T*)(rtl_allocateZeroMemory(sizeof(T)))) +#define RTL_DIGEST_CREATE(T) (static_cast<T*>(rtl_allocateZeroMemory(sizeof(T)))) #define RTL_DIGEST_ROTL(a,n) (((a) << (n)) | ((a) >> (32 - (n)))) @@ -132,7 +132,7 @@ rtlDigest SAL_CALL rtl_digest_create (rtlDigestAlgorithm Algorithm) rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (rtlDigest Digest) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest); if (pImpl) return pImpl->m_algorithm; else @@ -145,7 +145,7 @@ rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (rtlDigest Digest) sal_uInt32 SAL_CALL rtl_digest_queryLength (rtlDigest Digest) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest); if (pImpl) return pImpl->m_length; else @@ -159,7 +159,7 @@ rtlDigestError SAL_CALL rtl_digest_init ( rtlDigest Digest, const sal_uInt8 *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest); if (pImpl) { if (pImpl->m_init) @@ -177,7 +177,7 @@ rtlDigestError SAL_CALL rtl_digest_update ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest); if (pImpl && pImpl->m_update) return pImpl->m_update (Digest, pData, nDatLen); else @@ -191,7 +191,7 @@ rtlDigestError SAL_CALL rtl_digest_get ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest); if (pImpl && pImpl->m_get) return pImpl->m_get (Digest, pBuffer, nBufLen); else @@ -203,7 +203,7 @@ rtlDigestError SAL_CALL rtl_digest_get ( */ void SAL_CALL rtl_digest_destroy (rtlDigest Digest) SAL_THROW_EXTERN_C() { - Digest_Impl *pImpl = (Digest_Impl *)Digest; + Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest); if (pImpl && pImpl->m_delete) pImpl->m_delete (Digest); } @@ -407,8 +407,8 @@ rtlDigestError SAL_CALL rtl_digest_updateMD2 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = (DigestMD2_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestMD2_Impl *pImpl = static_cast<DigestMD2_Impl *>(Digest); + const sal_uInt8 *d = static_cast<const sal_uInt8 *>(pData); DigestContextMD2 *ctx; @@ -466,7 +466,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = (DigestMD2_Impl *)Digest; + DigestMD2_Impl *pImpl = static_cast<DigestMD2_Impl *>(Digest); sal_uInt32 i; DigestContextMD2 *ctx; @@ -495,7 +495,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2 ( */ void SAL_CALL rtl_digest_destroyMD2 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestMD2_Impl *pImpl = (DigestMD2_Impl *)Digest; + DigestMD2_Impl *pImpl = static_cast<DigestMD2_Impl *>(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD2) @@ -778,8 +778,8 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestMD5_Impl *pImpl = static_cast<DigestMD5_Impl *>(Digest); + const sal_uInt8 *d = static_cast<const sal_uInt8 *>(pData); DigestContextMD5 *ctx; sal_uInt32 len; @@ -851,7 +851,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD5 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; + DigestMD5_Impl *pImpl = static_cast<DigestMD5_Impl *>(Digest); sal_uInt8 *p = pBuffer; DigestContextMD5 *ctx; @@ -884,7 +884,7 @@ rtlDigestError SAL_CALL rtl_digest_rawMD5 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; + DigestMD5_Impl *pImpl = static_cast<DigestMD5_Impl *>(Digest); sal_uInt8 *p = pBuffer; DigestContextMD5 *ctx; @@ -915,7 +915,7 @@ rtlDigestError SAL_CALL rtl_digest_rawMD5 ( */ void SAL_CALL rtl_digest_destroyMD5 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestMD5_Impl *pImpl = (DigestMD5_Impl *)Digest; + DigestMD5_Impl *pImpl = static_cast<DigestMD5_Impl *>(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD5) @@ -1262,8 +1262,8 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestSHA_Impl *pImpl = static_cast<DigestSHA_Impl *>(Digest); + const sal_uInt8 *d = static_cast<const sal_uInt8 *>(pData); DigestContextSHA *ctx; sal_uInt32 len; @@ -1335,7 +1335,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast<DigestSHA_Impl *>(Digest); sal_uInt8 *p = pBuffer; DigestContextSHA *ctx; @@ -1367,7 +1367,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA ( */ void SAL_CALL rtl_digest_destroySHA (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast<DigestSHA_Impl *>(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmSHA) @@ -1452,8 +1452,8 @@ rtlDigestError SAL_CALL rtl_digest_updateSHA1 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; - const sal_uInt8 *d = (const sal_uInt8 *)pData; + DigestSHA_Impl *pImpl = static_cast<DigestSHA_Impl *>(Digest); + const sal_uInt8 *d = static_cast<const sal_uInt8 *>(pData); DigestContextSHA *ctx; sal_uInt32 len; @@ -1525,7 +1525,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA1 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast<DigestSHA_Impl *>(Digest); sal_uInt8 *p = pBuffer; DigestContextSHA *ctx; @@ -1557,7 +1557,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA1 ( */ void SAL_CALL rtl_digest_destroySHA1 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestSHA_Impl *pImpl = (DigestSHA_Impl *)Digest; + DigestSHA_Impl *pImpl = static_cast<DigestSHA_Impl *>(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmSHA1) @@ -1695,7 +1695,7 @@ rtlDigestError SAL_CALL rtl_digest_initHMAC_MD5 ( rtlDigest Digest, const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast<DigestHMAC_MD5_Impl*>(Digest); ContextHMAC_MD5 *ctx; if ((pImpl == NULL) || (pKeyData == NULL)) @@ -1734,7 +1734,7 @@ rtlDigestError SAL_CALL rtl_digest_updateHMAC_MD5 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast<DigestHMAC_MD5_Impl*>(Digest); ContextHMAC_MD5 *ctx; if ((pImpl == NULL) || (pData == NULL)) @@ -1756,7 +1756,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast<DigestHMAC_MD5_Impl*>(Digest); ContextHMAC_MD5 *ctx; if ((pImpl == NULL) || (pBuffer == NULL)) @@ -1789,7 +1789,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 ( */ void SAL_CALL rtl_digest_destroyHMAC_MD5 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestHMAC_MD5_Impl *pImpl = (DigestHMAC_MD5_Impl*)Digest; + DigestHMAC_MD5_Impl *pImpl = static_cast<DigestHMAC_MD5_Impl*>(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmHMAC_MD5) @@ -1927,7 +1927,7 @@ rtlDigestError SAL_CALL rtl_digest_initHMAC_SHA1 ( rtlDigest Digest, const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast<DigestHMAC_SHA1_Impl*>(Digest); ContextHMAC_SHA1 *ctx; if ((pImpl == NULL) || (pKeyData == NULL)) @@ -1966,7 +1966,7 @@ rtlDigestError SAL_CALL rtl_digest_updateHMAC_SHA1 ( rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast<DigestHMAC_SHA1_Impl*>(Digest); ContextHMAC_SHA1 *ctx; if ((pImpl == NULL) || (pData == NULL)) @@ -1988,7 +1988,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 ( rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast<DigestHMAC_SHA1_Impl*>(Digest); ContextHMAC_SHA1 *ctx; if ((pImpl == NULL) || (pBuffer == NULL)) @@ -2022,7 +2022,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 ( void SAL_CALL rtl_digest_destroyHMAC_SHA1 (rtlDigest Digest) SAL_THROW_EXTERN_C() { - DigestHMAC_SHA1_Impl *pImpl = (DigestHMAC_SHA1_Impl*)Digest; + DigestHMAC_SHA1_Impl *pImpl = static_cast<DigestHMAC_SHA1_Impl*>(Digest); if (pImpl) { if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmHMAC_SHA1) diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx index 4de72e3f6ec7..03ae02dcc4ee 100644 --- a/sal/rtl/hash.cxx +++ b/sal/rtl/hash.cxx @@ -76,11 +76,11 @@ hashString (rtl_uString *pString) static StringHashTable * rtl_str_hash_new (sal_uInt32 nSize) { - StringHashTable *pHash = (StringHashTable *)malloc (sizeof (StringHashTable)); + StringHashTable *pHash = static_cast<StringHashTable *>(malloc (sizeof (StringHashTable))); pHash->nEntries = 0; pHash->nSize = getNextSize (nSize); - pHash->pData = (rtl_uString **) calloc (sizeof (rtl_uString *), pHash->nSize); + pHash->pData = static_cast<rtl_uString **>(calloc (sizeof (rtl_uString *), pHash->nSize)); return pHash; } diff --git a/sal/rtl/locale.cxx b/sal/rtl/locale.cxx index d075eda742f1..8cdff09738fa 100644 --- a/sal/rtl/locale.cxx +++ b/sal/rtl/locale.cxx @@ -88,12 +88,12 @@ extern "C" void rtl_hashtable_init(RTL_HASHTABLE** table, sal_Int8 sizeIndex) if (*table) rtl_hashtable_destroy(*table); - *table = (RTL_HASHTABLE*)rtl_allocateMemory( sizeof(RTL_HASHTABLE) ); + *table = static_cast<RTL_HASHTABLE*>(rtl_allocateMemory( sizeof(RTL_HASHTABLE) )); (*table)->iSize = sizeIndex; (*table)->Size = nSize; (*table)->Elements = 0; - (*table)->Table = (RTL_HASHENTRY**)rtl_allocateMemory( (*table)->Size * sizeof(RTL_HASHENTRY*) ); + (*table)->Table = static_cast<RTL_HASHENTRY**>(rtl_allocateMemory( (*table)->Size * sizeof(RTL_HASHENTRY*) )); while (nSize) { @@ -129,7 +129,7 @@ extern "C" rtl_Locale* rtl_hashtable_add(RTL_HASHTABLE** table, rtl_Locale* valu pEntry = &(*pEntry)->Next; } - RTL_HASHENTRY *newEntry = (RTL_HASHENTRY*)rtl_allocateMemory( sizeof(RTL_HASHENTRY) ); + RTL_HASHENTRY *newEntry = static_cast<RTL_HASHENTRY*>(rtl_allocateMemory( sizeof(RTL_HASHENTRY) )); newEntry->Entry = value; newEntry->Next = NULL; *pEntry = newEntry; @@ -248,7 +248,7 @@ rtl_Locale * SAL_CALL rtl_locale_register( const sal_Unicode * language, const s rtl_uString_newFromStr(&sCountry, country); rtl_uString_newFromStr(&sVariant, variant); - newLocale = (rtl_Locale*)rtl_allocateMemory( sizeof(rtl_Locale) ); + newLocale = static_cast<rtl_Locale*>(rtl_allocateMemory( sizeof(rtl_Locale) )); newLocale->Language = sLanguage; newLocale->Country = sCountry; diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index 912074eb789f..0a5638f57423 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -269,7 +269,7 @@ static void __rtl_random_readPool ( rtlRandomPool SAL_CALL rtl_random_createPool() SAL_THROW_EXTERN_C() { RandomPool_Impl *pImpl = (RandomPool_Impl*)NULL; - pImpl = (RandomPool_Impl*)rtl_allocateZeroMemory (sizeof(RandomPool_Impl)); + pImpl = static_cast<RandomPool_Impl*>(rtl_allocateZeroMemory (sizeof(RandomPool_Impl))); if (pImpl) { if (!__rtl_random_initPool (pImpl)) @@ -286,7 +286,7 @@ rtlRandomPool SAL_CALL rtl_random_createPool() SAL_THROW_EXTERN_C() */ void SAL_CALL rtl_random_destroyPool (rtlRandomPool Pool) SAL_THROW_EXTERN_C() { - RandomPool_Impl *pImpl = (RandomPool_Impl *)Pool; + RandomPool_Impl *pImpl = static_cast<RandomPool_Impl *>(Pool); if (pImpl) { rtl_digest_destroy (pImpl->m_hDigest); @@ -300,8 +300,8 @@ void SAL_CALL rtl_random_destroyPool (rtlRandomPool Pool) SAL_THROW_EXTERN_C() rtlRandomError SAL_CALL rtl_random_addBytes ( rtlRandomPool Pool, const void *Buffer, sal_Size Bytes) SAL_THROW_EXTERN_C() { - RandomPool_Impl *pImpl = (RandomPool_Impl *)Pool; - const sal_uInt8 *pBuffer = (const sal_uInt8 *)Buffer; + RandomPool_Impl *pImpl = static_cast<RandomPool_Impl *>(Pool); + const sal_uInt8 *pBuffer = static_cast<const sal_uInt8 *>(Buffer); if ((pImpl == NULL) || (pBuffer == NULL)) return rtl_Random_E_Argument; @@ -316,8 +316,8 @@ rtlRandomError SAL_CALL rtl_random_addBytes ( rtlRandomError SAL_CALL rtl_random_getBytes ( rtlRandomPool Pool, void *Buffer, sal_Size Bytes) SAL_THROW_EXTERN_C() { - RandomPool_Impl *pImpl = (RandomPool_Impl *)Pool; - sal_uInt8 *pBuffer = (sal_uInt8 *)Buffer; + RandomPool_Impl *pImpl = static_cast<RandomPool_Impl *>(Pool); + sal_uInt8 *pBuffer = static_cast<sal_uInt8 *>(Buffer); if ((pImpl == NULL) || (pBuffer == NULL)) return rtl_Random_E_Argument; diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx index 55351501ab3e..1dba94baf6e3 100644 --- a/sal/rtl/strtmpl.cxx +++ b/sal/rtl/strtmpl.cxx @@ -387,7 +387,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_ST // assert(nLen >= 0); #if !IMPL_RTL_IS_USTRING // take advantage of builtin optimisations - IMPL_RTL_STRCODE* p = (IMPL_RTL_STRCODE*) memchr(pStr, c, nLen); + IMPL_RTL_STRCODE* p = static_cast<IMPL_RTL_STRCODE*>(const_cast<void *>(memchr(pStr, c, nLen))); return p ? p - pStr : -1; #else const IMPL_RTL_STRCODE* pTempStr = pStr; @@ -1148,8 +1148,8 @@ static IMPL_RTL_STRINGDATA* IMPL_RTL_STRINGNAME( ImplAlloc )( sal_Int32 nLen ) = (sal::static_int_cast< sal_uInt32 >(nLen) <= ((SAL_MAX_UINT32 - sizeof (IMPL_RTL_STRINGDATA)) / sizeof (IMPL_RTL_STRCODE))) - ? (IMPL_RTL_STRINGDATA *) rtl_allocateMemory( - sizeof (IMPL_RTL_STRINGDATA) + nLen * sizeof (IMPL_RTL_STRCODE)) + ? static_cast<IMPL_RTL_STRINGDATA *>(rtl_allocateMemory( + sizeof (IMPL_RTL_STRINGDATA) + nLen * sizeof (IMPL_RTL_STRCODE))) : NULL; if (pData != NULL) { pData->refCount = 1; diff --git a/sal/textenc/convertbig5hkscs.cxx b/sal/textenc/convertbig5hkscs.cxx index bec9f66abcee..034b206cb9f0 100644 --- a/sal/textenc/convertbig5hkscs.cxx +++ b/sal/textenc/convertbig5hkscs.cxx @@ -306,7 +306,7 @@ sal_Size ImplConvertUnicodeToBig5Hkscs(void const * pData, if (pContext) nHighSurrogate - = ((ImplUnicodeToTextContext *) pContext)->m_nHighSurrogate; + = static_cast<ImplUnicodeToTextContext *>(pContext)->m_nHighSurrogate; for (; nConverted < nSrcChars; ++nConverted) { @@ -472,7 +472,7 @@ sal_Size ImplConvertUnicodeToBig5Hkscs(void const * pData, } if (pContext) - ((ImplUnicodeToTextContext *) pContext)->m_nHighSurrogate + static_cast<ImplUnicodeToTextContext *>(pContext)->m_nHighSurrogate = nHighSurrogate; if (pInfo) *pInfo = nInfo; diff --git a/sal/textenc/converteuctw.cxx b/sal/textenc/converteuctw.cxx index 972f88772772..e871306a1b25 100644 --- a/sal/textenc/converteuctw.cxx +++ b/sal/textenc/converteuctw.cxx @@ -316,7 +316,7 @@ sal_Size ImplConvertUnicodeToEucTw(void const * pData, if (pContext) nHighSurrogate - = ((ImplUnicodeToTextContext *) pContext)->m_nHighSurrogate; + = static_cast<ImplUnicodeToTextContext *>(pContext)->m_nHighSurrogate; for (; nConverted < nSrcChars; ++nConverted) { @@ -431,7 +431,7 @@ sal_Size ImplConvertUnicodeToEucTw(void const * pData, } if (pContext) - ((ImplUnicodeToTextContext *) pContext)->m_nHighSurrogate + static_cast<ImplUnicodeToTextContext *>(pContext)->m_nHighSurrogate = nHighSurrogate; if (pInfo) *pInfo = nInfo; diff --git a/sal/textenc/convertgb18030.cxx b/sal/textenc/convertgb18030.cxx index 758db82a8b8b..87ede87a0830 100644 --- a/sal/textenc/convertgb18030.cxx +++ b/sal/textenc/convertgb18030.cxx @@ -304,7 +304,7 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData, if (pContext) nHighSurrogate - = ((ImplUnicodeToTextContext *) pContext)->m_nHighSurrogate; + = static_cast<ImplUnicodeToTextContext *>(pContext)->m_nHighSurrogate; for (; nConverted < nSrcChars; ++nConverted) { @@ -446,7 +446,7 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData, } if (pContext) - ((ImplUnicodeToTextContext *) pContext)->m_nHighSurrogate + static_cast<ImplUnicodeToTextContext *>(pContext)->m_nHighSurrogate = nHighSurrogate; if (pInfo) *pInfo = nInfo; diff --git a/sal/textenc/convertsimple.cxx b/sal/textenc/convertsimple.cxx index 076641638982..b5c7f0e1bb63 100644 --- a/sal/textenc/convertsimple.cxx +++ b/sal/textenc/convertsimple.cxx @@ -518,7 +518,7 @@ sal_Size sal::detail::textenc::convertCharToUnicode( sal_uInt32 nFlags, sal_uInt32 * pInfo, sal_Size * pSrcCvtBytes) { sal_Unicode cConv; - const ImplByteConvertData* pConvertData = (const ImplByteConvertData*)pData; + const ImplByteConvertData* pConvertData = static_cast<const ImplByteConvertData*>(pData); sal_Unicode* pEndDestBuf; const char* pEndSrcBuf; @@ -578,7 +578,7 @@ sal_Size sal::detail::textenc::convertUnicodeToChar( sal_Size * pSrcCvtChars) { sal_Unicode c; - const ImplByteConvertData* pConvertData = (const ImplByteConvertData*)pData; + const ImplByteConvertData* pConvertData = static_cast<const ImplByteConvertData*>(pData); char* pEndDestBuf; const sal_Unicode* pEndSrcBuf; int i; diff --git a/sal/textenc/tcvtbyte.cxx b/sal/textenc/tcvtbyte.cxx index 0248e01570b8..834e91a44959 100644 --- a/sal/textenc/tcvtbyte.cxx +++ b/sal/textenc/tcvtbyte.cxx @@ -127,7 +127,7 @@ sal_Size ImplUpperCharToUnicode( const void* pData, sal_Size* pSrcCvtBytes ) { sal_Unicode cConv; - const ImplByteConvertData* pConvertData = (const ImplByteConvertData*)pData; + const ImplByteConvertData* pConvertData = static_cast<const ImplByteConvertData*>(pData); sal_Unicode* pEndDestBuf; const char* pEndSrcBuf; diff --git a/sal/textenc/tcvtmb.cxx b/sal/textenc/tcvtmb.cxx index 80c49554ba47..acf02cc44401 100644 --- a/sal/textenc/tcvtmb.cxx +++ b/sal/textenc/tcvtmb.cxx @@ -44,7 +44,7 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*, unsigned char cTrail; sal_Unicode cConv; const ImplDBCSToUniLeadTab* pLeadEntry; - const ImplDBCSConvertData* pConvertData = (const ImplDBCSConvertData*)pData; + const ImplDBCSConvertData* pConvertData = static_cast<const ImplDBCSConvertData*>(pData); const ImplDBCSToUniLeadTab* pLeadTab = pConvertData->mpToUniLeadTab; sal_Unicode* pEndDestBuf; const char* pEndSrcBuf; @@ -222,7 +222,7 @@ sal_Size ImplUnicodeToDBCS( const void* pData, SAL_UNUSED_PARAMETER void*, sal_uInt16 cConv; sal_Unicode c; const ImplUniToDBCSHighTab* pHighEntry; - const ImplDBCSConvertData* pConvertData = (const ImplDBCSConvertData*)pData; + const ImplDBCSConvertData* pConvertData = static_cast<const ImplDBCSConvertData*>(pData); const ImplUniToDBCSHighTab* pHighTab = pConvertData->mpToDBCSHighTab; char* pEndDestBuf; const sal_Unicode* pEndSrcBuf; @@ -385,7 +385,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData, sal_Unicode cConv; const ImplDBCSToUniLeadTab* pLeadEntry; const ImplDBCSToUniLeadTab* pLeadTab; - const ImplEUCJPConvertData* pConvertData = (const ImplEUCJPConvertData*)pData; + const ImplEUCJPConvertData* pConvertData = static_cast<const ImplEUCJPConvertData*>(pData); sal_Unicode* pEndDestBuf; const char* pEndSrcBuf; @@ -547,7 +547,7 @@ sal_Size ImplUnicodeToEUCJP( const void* pData, unsigned char nLowChar; const ImplUniToDBCSHighTab* pHighEntry; const ImplUniToDBCSHighTab* pHighTab; - const ImplEUCJPConvertData* pConvertData = (const ImplEUCJPConvertData*)pData; + const ImplEUCJPConvertData* pConvertData = static_cast<const ImplEUCJPConvertData*>(pData); char* pEndDestBuf; const sal_Unicode* pEndSrcBuf; diff --git a/sal/textenc/tcvtutf7.cxx b/sal/textenc/tcvtutf7.cxx index 367a7c85439f..2a4f9952a168 100644 --- a/sal/textenc/tcvtutf7.cxx +++ b/sal/textenc/tcvtutf7.cxx @@ -124,7 +124,7 @@ void ImplUTF7DestroyTextToUnicodeContext( void* pContext ) void ImplUTF7ResetTextToUnicodeContext( void* pContext ) { - ImplUTF7ToUCContextData* pContextData = (ImplUTF7ToUCContextData*)pContext; + ImplUTF7ToUCContextData* pContextData = static_cast<ImplUTF7ToUCContextData*>(pContext); pContextData->mbShifted = sal_False; pContextData->mbFirst = sal_False; pContextData->mbWroteOne = sal_False; @@ -140,7 +140,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, sal_uInt32 nFlags, sal_uInt32* pInfo, sal_Size* pSrcCvtBytes ) { - ImplUTF7ToUCContextData* pContextData = (ImplUTF7ToUCContextData*)pContext; + ImplUTF7ToUCContextData* pContextData = static_cast<ImplUTF7ToUCContextData*>(pContext); unsigned char c ='\0'; unsigned char nBase64Value = 0; int bEnd = sal_False; @@ -419,7 +419,7 @@ void ImplUTF7DestroyUnicodeToTextContext( void* pContext ) void ImplUTF7ResetUnicodeToTextContext( void* pContext ) { - ImplUTF7FromUCContextData* pContextData = (ImplUTF7FromUCContextData*)pContext; + ImplUTF7FromUCContextData* pContextData = static_cast<ImplUTF7FromUCContextData*>(pContext); pContextData->mbShifted = sal_False; pContextData->mnBitBuffer = 0; pContextData->mnBufferBits = 0; @@ -433,7 +433,7 @@ sal_Size ImplUnicodeToUTF7( SAL_UNUSED_PARAMETER const void*, void* pContext, SAL_UNUSED_PARAMETER sal_uInt32, sal_uInt32* pInfo, sal_Size* pSrcCvtChars ) { - ImplUTF7FromUCContextData* pContextData = (ImplUTF7FromUCContextData*)pContext; + ImplUTF7FromUCContextData* pContextData = static_cast<ImplUTF7FromUCContextData*>(pContext); sal_Unicode c = '\0'; int bEnd = sal_False; int bShifted; diff --git a/sal/textenc/textcvt.cxx b/sal/textenc/textcvt.cxx index cda7faa56464..a11483f0a54f 100644 --- a/sal/textenc/textcvt.cxx +++ b/sal/textenc/textcvt.cxx @@ -121,7 +121,7 @@ void SAL_CALL rtl_destroyTextToUnicodeConverter( rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); if ( !pConverter ) return 0; else if ( pConverter->mpCreateTextToUnicodeContext ) @@ -135,7 +135,7 @@ rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnic void SAL_CALL rtl_destroyTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); if ( pConverter && hContext && pConverter->mpDestroyTextToUnicodeContext ) pConverter->mpDestroyTextToUnicodeContext( hContext ); } @@ -145,7 +145,7 @@ void SAL_CALL rtl_destroyTextToUnicodeContext( rtl_TextToUnicodeConverter hConve void SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); if ( pConverter && hContext && pConverter->mpResetTextToUnicodeContext ) pConverter->mpResetTextToUnicodeContext( hContext ); } @@ -159,7 +159,7 @@ sal_Size SAL_CALL rtl_convertTextToUnicode( rtl_TextToUnicodeConverter hConverte sal_uInt32 nFlags, sal_uInt32* pInfo, sal_Size* pSrcCvtBytes ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); /* Only temporary, because we don't want die, if we don't have a converter, because not all converters are implemented yet */ @@ -199,7 +199,7 @@ void SAL_CALL rtl_destroyUnicodeToTextConverter( rtl_UnicodeToTextContext SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); if ( !pConverter ) return 0; else if ( pConverter->mpCreateUnicodeToTextContext ) @@ -213,7 +213,7 @@ rtl_UnicodeToTextContext SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToT void SAL_CALL rtl_destroyUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); if ( pConverter && hContext && pConverter->mpDestroyUnicodeToTextContext ) pConverter->mpDestroyUnicodeToTextContext( hContext ); } @@ -223,7 +223,7 @@ void SAL_CALL rtl_destroyUnicodeToTextContext( rtl_UnicodeToTextConverter hConve void SAL_CALL rtl_resetUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); if ( pConverter && hContext && pConverter->mpResetUnicodeToTextContext ) pConverter->mpResetUnicodeToTextContext( hContext ); } @@ -237,7 +237,7 @@ sal_Size SAL_CALL rtl_convertUnicodeToText( rtl_UnicodeToTextConverter hConverte sal_uInt32 nFlags, sal_uInt32* pInfo, sal_Size* pSrcCvtChars ) { - const ImplTextConverter* pConverter = (const ImplTextConverter*)hConverter; + const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter); /* Only temporary, because we don't want die, if we don't have a converter, because not all converters are implemented yet */ |