diff options
Diffstat (limited to 'sal/osl/w32/profile.cxx')
-rw-r--r-- | sal/osl/w32/profile.cxx | 574 |
1 files changed, 287 insertions, 287 deletions
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index 9218976934ca..d563a0eadb70 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -76,12 +76,12 @@ static inline void copy_ustr_n( void *dest, const void *source, size_t length ) typedef FILETIME osl_TStamp; -typedef enum _osl_TLockMode +enum osl_TLockMode { un_lock, read_lock, write_lock -} osl_TLockMode; +}; -typedef struct _osl_TFile +struct osl_TFile { HANDLE m_Handle; sal_Char* m_pReadPtr; @@ -89,16 +89,16 @@ typedef struct _osl_TFile sal_Char* m_pWriteBuf; sal_uInt32 m_nWriteBufLen; sal_uInt32 m_nWriteBufFree; -} osl_TFile; +}; -typedef struct _osl_TProfileEntry +struct osl_TProfileEntry { sal_uInt32 m_Line; sal_uInt32 m_Offset; sal_uInt32 m_Len; -} osl_TProfileEntry; +}; -typedef struct _osl_TProfileSection +struct osl_TProfileSection { sal_uInt32 m_Line; sal_uInt32 m_Offset; @@ -106,12 +106,12 @@ typedef struct _osl_TProfileSection sal_uInt32 m_NoEntries; sal_uInt32 m_MaxEntries; osl_TProfileEntry* m_Entries; -} osl_TProfileSection; +}; /* Profile-data structure hidden behind oslProfile: */ -typedef struct _osl_TProfileImpl +struct osl_TProfileImpl { sal_uInt32 m_Flags; osl_TFile* m_pFile; @@ -123,7 +123,7 @@ typedef struct _osl_TProfileImpl sal_Char** m_Lines; rtl_uString *m_strFileName; osl_TProfileSection* m_Sections; -} osl_TProfileImpl; +}; /*****************************************************************************/ /* Static Module Function Declarations */ @@ -131,12 +131,12 @@ typedef struct _osl_TProfileImpl static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption ProfileFlags ); static osl_TStamp closeFileImpl(osl_TFile* pFile); -static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode); -static sal_Bool rewindFile(osl_TFile* pFile, sal_Bool bTruncate); +static bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode); +static bool rewindFile(osl_TFile* pFile, bool bTruncate); static osl_TStamp getFileStamp(osl_TFile* pFile); -static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen); -static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine); +static bool getLine(osl_TFile* pFile, sal_Char *pszLine, int MaxLen); +static bool putLine(osl_TFile* pFile, const sal_Char *pszLine); static const sal_Char* stripBlanks(const sal_Char* String, sal_uInt32* pLen); static const sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line); static const sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Line, sal_uInt32 LineNo); @@ -144,25 +144,25 @@ static void removeLine(osl_TProfileImpl* pProfile, sal_uInt32 Li static void setEntry(osl_TProfileImpl* pProfile, osl_TProfileSection* pSection, sal_uInt32 NoEntry, sal_uInt32 Line, const sal_Char* Entry, sal_uInt32 Len); -static sal_Bool addEntry(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection, +static bool addEntry(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection, int Line, const sal_Char* Entry, sal_uInt32 Len); static void removeEntry(osl_TProfileSection *pSection, sal_uInt32 NoEntry); -static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Section, sal_uInt32 Len); +static bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Section, sal_uInt32 Len); static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection); static osl_TProfileSection* findEntry(osl_TProfileImpl* pProfile, const sal_Char* Section, const sal_Char* Entry, sal_uInt32 *pNoEntry); -static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile); -static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup); -static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable); -static sal_Bool releaseProfile(osl_TProfileImpl* pProfile); -static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile, sal_Unicode *strProfile); +static bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile); +static bool storeProfile(osl_TProfileImpl* pProfile, bool bCleanup); +static osl_TProfileImpl* acquireProfile(oslProfile Profile, bool bWriteable); +static bool releaseProfile(osl_TProfileImpl* pProfile); +static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile, sal_Unicode *strProfile); -static sal_Bool writeProfileImpl (osl_TFile* pFile); +static bool writeProfileImpl (osl_TFile* pFile); static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl*); -static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl*); +static bool osl_ProfileSwapProfileNames(osl_TProfileImpl*); static rtl_uString* osl_ProfileGenerateExtension(rtl_uString* ustrFileName, rtl_uString* ustrExtension); -static sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName); +static bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName); /*****************************************************************************/ /* Exported Module Functions */ @@ -170,9 +170,9 @@ static sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* s oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, sal_uInt32 Flags) { - osl_TFile* pFile = NULL; + osl_TFile* pFile = nullptr; osl_TProfileImpl* pProfile; - rtl_uString *FileName=NULL; + rtl_uString *FileName=nullptr; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_openProfile"); @@ -181,7 +181,7 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, sal_uInt32 Flag if (rtl_uString_getLength(strProfileName) == 0 ) { - OSL_VERIFY(osl_getProfileName(NULL, NULL, &FileName)); + OSL_VERIFY(osl_getProfileName(nullptr, nullptr, &FileName)); } else { @@ -215,7 +215,7 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, sal_uInt32 Flag } #endif - if ( (! (Flags & osl_Profile_SYSTEM)) && ( (pFile = openFileImpl(FileName, Flags) ) == NULL ) ) + if ( (! (Flags & osl_Profile_SYSTEM)) && ( (pFile = openFileImpl(FileName, Flags) ) == nullptr ) ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_openProfile [not opened]"); @@ -223,10 +223,10 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, sal_uInt32 Flag if( FileName) rtl_uString_release( FileName); - return NULL; + return nullptr; } - pProfile = (osl_TProfileImpl*)calloc(1, sizeof(osl_TProfileImpl)); + pProfile = static_cast<osl_TProfileImpl*>(calloc(1, sizeof(osl_TProfileImpl))); pProfile->m_Flags = Flags & FLG_USER; osl_getSystemPathFromFileURL(strProfileName, &pProfile->m_strFileName); @@ -238,7 +238,7 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, sal_uInt32 Flag loadProfile(pFile, pProfile); - if (pProfile->m_pFile == NULL) + if (pProfile->m_pFile == nullptr) closeFileImpl(pFile); #ifdef TRACE_OSL_PROFILE @@ -252,72 +252,72 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, sal_uInt32 Flag sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) { - osl_TProfileImpl* pProfile = (osl_TProfileImpl*)Profile; + osl_TProfileImpl* pProfile = static_cast<osl_TProfileImpl*>(Profile); #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_closeProfile"); #endif - if ( Profile == 0 ) + if ( Profile == nullptr ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_closeProfile [profile==0]"); #endif - return sal_False; + return false; } if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) { - pProfile = acquireProfile(Profile,sal_True); + pProfile = acquireProfile(Profile,true); - if ( pProfile != 0 ) + if ( pProfile != nullptr ) { if ( !( pProfile->m_Flags & osl_Profile_READLOCK ) && ( pProfile->m_Flags & FLG_MODIFIED ) ) { - storeProfile(pProfile, sal_False); + storeProfile(pProfile, false); } } else { - pProfile = acquireProfile(Profile,sal_False); + pProfile = acquireProfile(Profile,false); } - if ( pProfile == 0 ) + if ( pProfile == nullptr ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_closeProfile [pProfile==0]"); #endif - return sal_False; + return false; } - if (pProfile->m_pFile != NULL) + if (pProfile->m_pFile != nullptr) closeFileImpl(pProfile->m_pFile); } - pProfile->m_pFile = NULL; + pProfile->m_pFile = nullptr; rtl_uString_release(pProfile->m_strFileName); - pProfile->m_strFileName = NULL; + pProfile->m_strFileName = nullptr; /* release whole profile data types memory */ if ( pProfile->m_NoLines > 0) { unsigned int index=0; - if ( pProfile->m_Lines != 0 ) + if ( pProfile->m_Lines != nullptr ) { for ( index = 0 ; index < pProfile->m_NoLines ; ++index) { - if ( pProfile->m_Lines[index] != 0 ) + if ( pProfile->m_Lines[index] != nullptr ) { free(pProfile->m_Lines[index]); } } free(pProfile->m_Lines); } - if ( pProfile->m_Sections != 0 ) + if ( pProfile->m_Sections != nullptr ) { for ( index = 0 ; index < pProfile->m_NoSections ; ++index ) { - if ( pProfile->m_Sections[index].m_Entries != 0 ) + if ( pProfile->m_Sections[index].m_Entries != nullptr ) free(pProfile->m_Sections[index].m_Entries); } free(pProfile->m_Sections); @@ -329,34 +329,34 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_closeProfile [ok]"); #endif - return sal_True; + return true; } 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; - sal_Bool bRet = sal_False; + bool bRet = false; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_flushProfile()"); #endif - if ( pProfile == 0 ) + if ( pProfile == nullptr ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_flushProfile() [pProfile == 0]"); #endif - return sal_False; + return false; } pFile = pProfile->m_pFile; - if ( pFile == 0 || pFile->m_Handle == INVALID_HANDLE_VALUE ) + if ( pFile == nullptr || pFile->m_Handle == INVALID_HANDLE_VALUE ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_flushProfile() [invalid file]"); #endif - return sal_False; + return false; } if ( pProfile->m_Flags & FLG_MODIFIED ) @@ -364,7 +364,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) #ifdef DEBUG_OSL_PROFILE OSL_TRACE("swapping to storeprofile"); #endif - bRet = storeProfile(pProfile,sal_False); + bRet = storeProfile(pProfile,false); } #ifdef TRACE_OSL_PROFILE @@ -373,7 +373,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) return bRet; } -static sal_Bool writeProfileImpl(osl_TFile* pFile) +static bool writeProfileImpl(osl_TFile* pFile) { DWORD BytesWritten=0; BOOL bRet; @@ -382,33 +382,33 @@ static sal_Bool writeProfileImpl(osl_TFile* pFile) OSL_TRACE("In osl_writeProfileImpl()"); #endif - if ( !( pFile != 0 && pFile->m_Handle != INVALID_HANDLE_VALUE ) || ( pFile->m_pWriteBuf == 0 ) ) + if ( !( pFile != nullptr && pFile->m_Handle != INVALID_HANDLE_VALUE ) || ( pFile->m_pWriteBuf == nullptr ) ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileImpl() [invalid args]"); #endif - return sal_False; + return false; } - bRet=WriteFile(pFile->m_Handle, pFile->m_pWriteBuf, pFile->m_nWriteBufLen - pFile->m_nWriteBufFree,&BytesWritten,NULL); + bRet=WriteFile(pFile->m_Handle, pFile->m_pWriteBuf, pFile->m_nWriteBufLen - pFile->m_nWriteBufFree,&BytesWritten,nullptr); if ( bRet == 0 || BytesWritten == 0 ) { OSL_ENSURE(bRet,"WriteFile failed!!!"); OSL_TRACE("write failed '%s'",strerror(errno)); - return sal_False; + return false; } free(pFile->m_pWriteBuf); - pFile->m_pWriteBuf=0; + pFile->m_pWriteBuf=nullptr; pFile->m_nWriteBufLen=0; pFile->m_nWriteBufFree=0; #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileImpl() [ok]"); #endif - return sal_True; + return true; } sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, @@ -417,38 +417,38 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, const sal_Char* pszDefault) { sal_uInt32 NoEntry; - const sal_Char* pStr = 0; - osl_TProfileImpl* pProfile = 0; + const sal_Char* pStr = nullptr; + osl_TProfileImpl* pProfile = nullptr; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_readProfileString"); #endif - pProfile = acquireProfile(Profile, sal_False); + pProfile = acquireProfile(Profile, false); - if (pProfile == NULL) + if (pProfile == nullptr) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_readProfileString [pProfile==0]"); #endif - return sal_False; + return false; } if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) { osl_TProfileSection* pSec; - if (((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) != NULL) && + if (((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) != nullptr) && (NoEntry < pSec->m_NoEntries) && ((pStr = strchr(pProfile->m_Lines[pSec->m_Entries[NoEntry].m_Line], - '=')) != NULL)) + '=')) != nullptr)) pStr++; else pStr = pszDefault; - if ( pStr != 0 ) + if ( pStr != nullptr ) { - pStr = stripBlanks(pStr, NULL); + pStr = stripBlanks(pStr, nullptr); MaxLen = (MaxLen - 1 < strlen(pStr)) ? (MaxLen - 1) : strlen(pStr); pStr = stripBlanks(pStr, &MaxLen); strncpy(pszString, pStr, MaxLen); @@ -459,26 +459,26 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), nullptr, nullptr); GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, aFileName); } releaseProfile(pProfile); - if ( pStr == 0 ) + if ( pStr == nullptr ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_readProfileString [pStr==0]"); #endif - return sal_False; + return false; } #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_readProfileString [ok]"); #endif - return sal_True; + return true; } sal_Bool SAL_CALL osl_readProfileBool(oslProfile Profile, @@ -496,12 +496,12 @@ sal_Bool SAL_CALL osl_readProfileBool(oslProfile Profile, if ((stricmp(Line, STR_INI_BOOLYES) == 0) || (stricmp(Line, STR_INI_BOOLON) == 0) || (stricmp(Line, STR_INI_BOOLONE) == 0)) - Default = sal_True; + Default = true; else if ((stricmp(Line, STR_INI_BOOLNO) == 0) || (stricmp(Line, STR_INI_BOOLOFF) == 0) || (stricmp(Line, STR_INI_BOOLZERO) == 0)) - Default = sal_False; + Default = false; } #ifdef TRACE_OSL_PROFILE @@ -526,7 +526,7 @@ sal_uInt32 SAL_CALL osl_readProfileIdent(oslProfile Profile, if (osl_readProfileString(Profile, pszSection, pszEntry, Line, sizeof(Line), "")) { i = 0; - while (Strings[i] != NULL) + while (Strings[i] != nullptr) { if (stricmp(Line, Strings[i]) == 0) { @@ -548,30 +548,30 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, const sal_Char* pszString) { sal_uInt32 i; - sal_Bool bRet = sal_False; + bool bRet = false; sal_uInt32 NoEntry; const sal_Char* pStr; sal_Char Line[4096]; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; + osl_TProfileImpl* pProfile = nullptr; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_writeProfileString"); #endif - pProfile = acquireProfile(Profile, sal_True); + pProfile = acquireProfile(Profile, true); - if (pProfile == NULL) + if (pProfile == nullptr) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileString [pProfile==0]"); #endif - return sal_False; + return false; } if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) { - if ((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) == NULL) + if ((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) == nullptr) { Line[0] = '\0'; addLine(pProfile, Line); @@ -581,14 +581,14 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, Line[1 + strlen(pszSection)] = ']'; Line[2 + strlen(pszSection)] = '\0'; - if (((pStr = addLine(pProfile, Line)) == NULL) || + if (((pStr = addLine(pProfile, Line)) == nullptr) || (! addSection(pProfile, pProfile->m_NoLines - 1, &pStr[1], strlen(pszSection)))) { releaseProfile(pProfile); #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileString [not added]"); #endif - return sal_False; + return false; } pSec = &pProfile->m_Sections[pProfile->m_NoSections - 1]; @@ -607,14 +607,14 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, else i = pSec->m_Line + 1; - if (((pStr = insertLine(pProfile, Line, i)) == NULL) || + if (((pStr = insertLine(pProfile, Line, i)) == nullptr) || (! addEntry(pProfile, pSec, i, pStr, strlen(pszEntry)))) { releaseProfile(pProfile); #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileString [not inserted]"); #endif - return sal_False; + return false; } pProfile->m_Flags |= FLG_MODIFIED; @@ -633,7 +633,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), nullptr, nullptr); WritePrivateProfileString(pszSection, pszEntry, pszString, aFileName); } @@ -648,7 +648,7 @@ sal_Bool SAL_CALL osl_writeProfileBool(oslProfile Profile, const sal_Char* pszSection, const sal_Char* pszEntry, sal_Bool Value) { - sal_Bool bRet = sal_False; + bool bRet = false; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_writeProfileBool"); @@ -672,16 +672,16 @@ sal_Bool SAL_CALL osl_writeProfileIdent(oslProfile Profile, sal_uInt32 Value) { int i, n; - sal_Bool bRet = sal_False; + bool bRet = false; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_writeProfileIdent"); #endif - for (n = 0; Strings[n] != NULL; n++); + for (n = 0; Strings[n] != nullptr; n++); if ((i = Value - FirstId) >= n) - bRet=sal_False; + bRet=false; else bRet=osl_writeProfileString(Profile, pszSection, pszEntry, Strings[i]); @@ -695,28 +695,28 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, const sal_Char *pszSection, const sal_Char *pszEntry) { sal_uInt32 NoEntry; - osl_TProfileImpl* pProfile = 0; - sal_Bool bRet = sal_False; + osl_TProfileImpl* pProfile = nullptr; + bool bRet = false; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_removeProfileEntry"); #endif - pProfile = acquireProfile(Profile, sal_True); + pProfile = acquireProfile(Profile, true); - if (pProfile == NULL) + if (pProfile == nullptr) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_removeProfileEntry [pProfile==0]"); #endif - return sal_False; + return false; } if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) { osl_TProfileSection* pSec; - if (((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) != NULL) && + if (((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) != nullptr) && (NoEntry < pSec->m_NoEntries)) { removeLine(pProfile, pSec->m_Entries[NoEntry].m_Line); @@ -739,8 +739,8 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); - WritePrivateProfileString(pszSection, pszEntry, NULL, aFileName); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), nullptr, nullptr); + WritePrivateProfileString(pszSection, pszEntry, nullptr, aFileName); } bRet = releaseProfile(pProfile); @@ -755,15 +755,15 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C { sal_uInt32 i, n = 0; sal_uInt32 NoEntry; - osl_TProfileImpl* pProfile = 0; + osl_TProfileImpl* pProfile = nullptr; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_getProfileSectionEntries"); #endif - pProfile = acquireProfile(Profile, sal_False); + pProfile = acquireProfile(Profile, false); - if (pProfile == NULL) + if (pProfile == nullptr) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_getProfileSectionEntries [pProfile=0]"); @@ -775,7 +775,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) { osl_TProfileSection* pSec; - if ((pSec = findEntry(pProfile, pszSection, "", &NoEntry)) != NULL) + if ((pSec = findEntry(pProfile, pszSection, "", &NoEntry)) != nullptr) { if (MaxLen != 0) { @@ -810,8 +810,8 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); - n = GetPrivateProfileString(pszSection, NULL, NULL, pszBuffer, MaxLen, aFileName); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), nullptr, nullptr); + n = GetPrivateProfileString(pszSection, nullptr, nullptr, pszBuffer, MaxLen, aFileName); } releaseProfile(pProfile); @@ -823,22 +823,22 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C return n; } -sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName) +bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName) { - sal_Bool bFailed; + bool bFailed; ::osl::LongPathBuffer< sal_Unicode > aFile( MAX_LONG_PATH ); ::osl::LongPathBuffer< sal_Unicode > aPath( MAX_LONG_PATH ); sal_uInt32 nFileLen = 0; sal_uInt32 nPathLen = 0; - rtl_uString * strTmp = NULL; + rtl_uString * strTmp = nullptr; oslFileError nError; /* build file name */ if (strName && strName->length) { if( ::sal::static_int_cast< sal_uInt32 >( strName->length ) >= aFile.getBufSizeInSymbols() ) - return sal_False; + return false; copy_ustr_n( aFile, strName->buffer, strName->length+1); nFileLen = strName->length; @@ -846,7 +846,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if (rtl_ustr_indexOfChar( aFile, L'.' ) == -1) { if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols()) - return sal_False; + return false; /* add default extension */ copy_ustr_n( aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1 ); @@ -855,14 +855,14 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, } else { - rtl_uString *strProgName = NULL; + rtl_uString *strProgName = nullptr; sal_Unicode *pProgName; sal_Int32 nOffset = 0; sal_Int32 nLen; sal_Int32 nPos; if (osl_getExecutableFile(&strProgName) != osl_Process_E_None) - return sal_False; + return false; /* remove path and extension from filename */ pProgName = strProgName->buffer; @@ -877,12 +877,12 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, nLen -= 4; if ((nFileLen = nLen - nOffset) >= aFile.getBufSizeInSymbols()) - return sal_False; + return false; copy_ustr_n(aFile, pProgName + nOffset, nFileLen); if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols()) - return sal_False; + return false; /* add default extension */ copy_ustr_n(aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1); @@ -892,7 +892,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, } if (aFile[0] == 0) - return sal_False; + return false; /* build directory path */ if (strPath && strPath->length) @@ -903,16 +903,16 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METAHOME) , STR_INI_METAHOME) == 0) && ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METAHOME)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAHOME)] == '/'))) { - rtl_uString * strHome = NULL; + rtl_uString * strHome = nullptr; oslSecurity security = osl_getCurrentSecurity(); bFailed = ! osl_getHomeDir(security, &strHome); osl_freeSecurityHandle(security); - if (bFailed) return sal_False; + if (bFailed) return false; if ( ::sal::static_int_cast< sal_uInt32 >( strHome->length ) >= aPath.getBufSizeInSymbols()) - return sal_False; + return false; copy_ustr_n( aPath, strHome->buffer, strHome->length+1); nPathLen = strHome->length; @@ -923,7 +923,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METAHOME); if (nLen + nPathLen >= aPath.getBufSizeInSymbols()) - return sal_False; + return false; copy_ustr_n(aPath + nPathLen, pPath, nLen+1); nPathLen += nLen; @@ -935,16 +935,16 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METACFG), STR_INI_METACFG) == 0) && ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METACFG)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METACFG)] == '/'))) { - rtl_uString * strConfig = NULL; + rtl_uString * strConfig = nullptr; oslSecurity security = osl_getCurrentSecurity(); bFailed = ! osl_getConfigDir(security, &strConfig); osl_freeSecurityHandle(security); - if (bFailed) return sal_False; + if (bFailed) return false; if ( ::sal::static_int_cast< sal_uInt32 >( strConfig->length ) >= aPath.getBufSizeInSymbols()) - return sal_False; + return false; copy_ustr_n( aPath, strConfig->buffer, strConfig->length+1 ); nPathLen = strConfig->length; @@ -955,7 +955,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METACFG); if (nLen + nPathLen >= aPath.getBufSizeInSymbols()) - return sal_False; + return false; copy_ustr_n(aPath + nPathLen, pPath, nLen+1); nPathLen += nLen; @@ -968,7 +968,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METASYS)] == '/'))) { if (((nPathLen = GetWindowsDirectoryW(::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols())) - return sal_False; + return false; if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) { @@ -976,7 +976,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METASYS); if (nLen + nPathLen >= aPath.getBufSizeInSymbols()) - return sal_False; + return false; copy_ustr_n(aPath + nPathLen, pPath, nLen+1); nPathLen += nLen; @@ -988,7 +988,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '"') ) ) { if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), aFile, aPath)) - return sal_False; + return false; nPathLen = rtl_ustr_getLength(aPath); } @@ -999,19 +999,19 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, nPathLen = rtl_ustr_getLength(aPath); } else - return sal_False; + return false; } else { - rtl_uString * strConfigDir = NULL; + rtl_uString * strConfigDir = nullptr; oslSecurity security = osl_getCurrentSecurity(); bFailed = ! osl_getConfigDir(security, &strConfigDir); osl_freeSecurityHandle(security); - if (bFailed) return sal_False; + if (bFailed) return false; if ( ::sal::static_int_cast< sal_uInt32 >( strConfigDir->length ) >= aPath.getBufSizeInSymbols() ) - return sal_False; + return false; copy_ustr_n(aPath, strConfigDir->buffer, strConfigDir->length+1); nPathLen = strConfigDir->length; @@ -1024,7 +1024,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, } if (nPathLen + nFileLen >= aPath.getBufSizeInSymbols()) - return sal_False; + return false; /* append file name */ copy_ustr_n(aPath + nPathLen, aFile, nFileLen+1); @@ -1035,15 +1035,15 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, nError = osl_getFileURLFromSystemPath(strTmp, strProfileName); rtl_uString_release(strTmp); - return (sal_Bool) (nError == osl_File_E_None); + return nError == osl_File_E_None; } sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuffer, sal_uInt32 MaxLen) { sal_uInt32 i, n = 0; - osl_TProfileImpl* pProfile = acquireProfile(Profile, sal_False); + osl_TProfileImpl* pProfile = acquireProfile(Profile, false); - if (pProfile == NULL) + if (pProfile == nullptr) return 0; if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) @@ -1079,7 +1079,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), nullptr, nullptr); n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, aFileName); } @@ -1097,36 +1097,36 @@ static osl_TStamp getFileStamp(osl_TFile* pFile) FILETIME FileTime; if ((pFile->m_Handle == INVALID_HANDLE_VALUE) || - (! GetFileTime(pFile->m_Handle, NULL, NULL, &FileTime))) + (! GetFileTime(pFile->m_Handle, nullptr, nullptr, &FileTime))) memset(&FileTime, 0, sizeof(FileTime)); return FileTime; } -static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode) +static bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode) { - sal_Bool status = sal_False; + bool status = false; OVERLAPPED Overlapped; if (pFile->m_Handle == INVALID_HANDLE_VALUE) - return sal_False; + return false; memset(&Overlapped, 0, sizeof(Overlapped)); switch (eMode) { case un_lock: - status = (sal_Bool) UnlockFileEx( + status = UnlockFileEx( pFile->m_Handle, 0, 0xFFFFFFFF, 0, &Overlapped); break; case read_lock: - status = (sal_Bool) LockFileEx( + status = LockFileEx( pFile->m_Handle, 0, 0, 0xFFFFFFFF, 0, &Overlapped); break; case write_lock: - status = (sal_Bool) LockFileEx( + status = LockFileEx( pFile->m_Handle, LOCKFILE_EXCLUSIVE_LOCK, 0, 0xFFFFFFFF, 0, &Overlapped); break; @@ -1137,22 +1137,22 @@ static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode) static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption ProfileFlags ) { - osl_TFile* pFile = reinterpret_cast< osl_TFile*>( calloc( 1, sizeof(osl_TFile) ) ); - sal_Bool bWriteable = sal_False; + osl_TFile* pFile = static_cast< osl_TFile*>( calloc( 1, sizeof(osl_TFile) ) ); + bool bWriteable = false; if ( ProfileFlags & ( osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE ) ) { #ifdef DEBUG_OSL_PROFILE OSL_TRACE("setting bWriteable to TRUE"); #endif - bWriteable=sal_True; + bWriteable=true; } if (! bWriteable) { pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); /* mfe: argghh!!! do not check if the file could be openend */ /* default mode expects it that way!!! */ @@ -1164,16 +1164,16 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi #endif if ((pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, + OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)) == INVALID_HANDLE_VALUE) { free(pFile); - return NULL; + return nullptr; } } - pFile->m_pWriteBuf=0; + pFile->m_pWriteBuf=nullptr; pFile->m_nWriteBufFree=0; pFile->m_nWriteBufLen=0; @@ -1193,7 +1193,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile) { osl_TStamp stamp = {0, 0}; - if ( pFile == 0 ) + if ( pFile == nullptr ) { return stamp; } @@ -1208,7 +1208,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile) pFile->m_Handle = INVALID_HANDLE_VALUE; } - if ( pFile->m_pWriteBuf != 0 ) + if ( pFile->m_pWriteBuf != nullptr ) { free(pFile->m_pWriteBuf); } @@ -1218,30 +1218,30 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile) return stamp; } -static sal_Bool rewindFile(osl_TFile* pFile, sal_Bool bTruncate) +static bool rewindFile(osl_TFile* pFile, bool bTruncate) { if (pFile->m_Handle != INVALID_HANDLE_VALUE) { pFile->m_pReadPtr = pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf); - SetFilePointer(pFile->m_Handle, 0, NULL, FILE_BEGIN); + SetFilePointer(pFile->m_Handle, 0, nullptr, FILE_BEGIN); if (bTruncate) SetEndOfFile(pFile->m_Handle); } - return sal_True; + return true; } -static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen) +static bool getLine(osl_TFile* pFile, sal_Char *pszLine, int MaxLen) { DWORD Max; size_t Free; sal_Char* pChr; - sal_Char* pLine = (sal_Char *)pszLine; + sal_Char* pLine = pszLine; if (pFile->m_Handle == INVALID_HANDLE_VALUE) - return sal_False; + return false; MaxLen -= 1; @@ -1257,10 +1257,10 @@ static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen) Free = sizeof(pFile->m_ReadBuf) - Bytes; - if (! ReadFile(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free, &Max, NULL)) + if (! ReadFile(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free, &Max, nullptr)) { *pLine = '\0'; - return sal_False; + return false; } if (Max < Free) @@ -1268,7 +1268,7 @@ static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen) if ((Max == 0) && (pLine == pszLine)) { *pLine = '\0'; - return sal_False; + return false; } pFile->m_ReadBuf[Bytes + Max] = '\0'; @@ -1309,21 +1309,21 @@ static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen) } while (MaxLen > 0); - return sal_True; + return true; } -static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) +static bool putLine(osl_TFile* pFile, const sal_Char *pszLine) { unsigned int Len = strlen(pszLine); - if ( pFile == 0 || pFile->m_Handle == INVALID_HANDLE_VALUE ) + if ( pFile == nullptr || pFile->m_Handle == INVALID_HANDLE_VALUE ) { - return sal_False; + return false; } - if ( pFile->m_pWriteBuf == 0 ) + if ( pFile->m_pWriteBuf == nullptr ) { - 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; } @@ -1333,10 +1333,10 @@ static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) { sal_Char* pTmp; - pTmp=(sal_Char*) realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) ); - if ( pTmp == 0 ) + pTmp=static_cast<sal_Char*>(realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) )); + if ( pTmp == nullptr ) { - return sal_False; + return false; } pFile->m_pWriteBuf = pTmp; pFile->m_nWriteBufFree = pFile->m_nWriteBufFree + pFile->m_nWriteBufLen + ( 2 * Len ); @@ -1353,14 +1353,14 @@ static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) pFile->m_nWriteBufFree-=Len+2; - return sal_True; + return true; } /* platform specific end */ static const sal_Char* stripBlanks(const sal_Char* String, sal_uInt32* pLen) { - if ( (pLen != NULL) && ( *pLen != 0 ) ) + if ( (pLen != nullptr) && ( *pLen != 0 ) ) { while ((String[*pLen - 1] == ' ') || (String[*pLen - 1] == '\t')) (*pLen)--; @@ -1382,7 +1382,7 @@ static const sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) { if (pProfile->m_NoLines >= pProfile->m_MaxLines) { - if (pProfile->m_Lines == NULL) + if (pProfile->m_Lines == nullptr) { pProfile->m_MaxLines = LINES_INI; pProfile->m_Lines = static_cast<sal_Char **>(calloc(pProfile->m_MaxLines, sizeof(sal_Char *))); @@ -1397,20 +1397,20 @@ static const sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) for ( index = oldmax ; index < pProfile->m_MaxLines ; ++index ) { - pProfile->m_Lines[index]=0; + pProfile->m_Lines[index]=nullptr; } } - if (pProfile->m_Lines == NULL) + if (pProfile->m_Lines == nullptr) { pProfile->m_NoLines = 0; pProfile->m_MaxLines = 0; - return NULL; + return nullptr; } } - if ( pProfile->m_Lines != 0 && pProfile->m_Lines[pProfile->m_NoLines] != 0 ) + if ( pProfile->m_Lines != nullptr && pProfile->m_Lines[pProfile->m_NoLines] != nullptr ) { free(pProfile->m_Lines[pProfile->m_NoLines]); } @@ -1423,7 +1423,7 @@ static const sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Li { if (pProfile->m_NoLines >= pProfile->m_MaxLines) { - if (pProfile->m_Lines == NULL) + if (pProfile->m_Lines == nullptr) { pProfile->m_MaxLines = LINES_INI; pProfile->m_Lines = static_cast<sal_Char **>(calloc(pProfile->m_MaxLines, sizeof(sal_Char *))); @@ -1439,11 +1439,11 @@ static const sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Li (pProfile->m_MaxLines - pProfile->m_NoLines - 1) * sizeof(sal_Char*)); } - if (pProfile->m_Lines == NULL) + if (pProfile->m_Lines == nullptr) { pProfile->m_NoLines = 0; pProfile->m_MaxLines = 0; - return NULL; + return nullptr; } } @@ -1482,7 +1482,7 @@ static void removeLine(osl_TProfileImpl* pProfile, sal_uInt32 LineNo) if (LineNo < pProfile->m_NoLines) { free(pProfile->m_Lines[LineNo]); - pProfile->m_Lines[LineNo]=0; + pProfile->m_Lines[LineNo]=nullptr; if (pProfile->m_NoLines - LineNo > 1) { sal_uInt32 i, n; @@ -1509,7 +1509,7 @@ static void removeLine(osl_TProfileImpl* pProfile, sal_uInt32 LineNo) } else { - pProfile->m_Lines[LineNo] = 0; + pProfile->m_Lines[LineNo] = nullptr; } pProfile->m_NoLines--; @@ -1530,31 +1530,31 @@ static void setEntry(osl_TProfileImpl* pProfile, osl_TProfileSection* pSection, return; } -static sal_Bool addEntry(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection, +static bool addEntry(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection, int Line, const sal_Char* Entry, sal_uInt32 Len) { - if (pSection != NULL) + if (pSection != nullptr) { if (pSection->m_NoEntries >= pSection->m_MaxEntries) { - if (pSection->m_Entries == NULL) + if (pSection->m_Entries == nullptr) { 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) + if (pSection->m_Entries == nullptr) { pSection->m_NoEntries = 0; pSection->m_MaxEntries = 0; - return sal_False; + return false; } } @@ -1564,10 +1564,10 @@ static sal_Bool addEntry(osl_TProfileImpl* pProfile, osl_TProfileSection *pSecti setEntry(pProfile, pSection, pSection->m_NoEntries - 1, Line, Entry, Len); - return sal_True; + return true; } - return sal_False; + return false; } static void removeEntry(osl_TProfileSection *pSection, sal_uInt32 NoEntry) @@ -1590,11 +1590,11 @@ static void removeEntry(osl_TProfileSection *pSection, sal_uInt32 NoEntry) return; } -static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Section, sal_uInt32 Len) +static bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Section, sal_uInt32 Len) { if (pProfile->m_NoSections >= pProfile->m_MaxSections) { - if (pProfile->m_Sections == NULL) + if (pProfile->m_Sections == nullptr) { pProfile->m_MaxSections = SECTIONS_INI; pProfile->m_Sections = static_cast<osl_TProfileSection*>(calloc(pProfile->m_MaxSections, sizeof(osl_TProfileSection))); @@ -1609,34 +1609,34 @@ static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* pProfile->m_MaxSections * sizeof(osl_TProfileSection))); for ( index = oldmax ; index < pProfile->m_MaxSections ; ++index ) { - pProfile->m_Sections[index].m_Entries=0; + pProfile->m_Sections[index].m_Entries=nullptr; } } - if (pProfile->m_Sections == NULL) + if (pProfile->m_Sections == nullptr) { pProfile->m_NoSections = 0; pProfile->m_MaxSections = 0; - return sal_False; + return false; } } pProfile->m_NoSections++; - if ( pProfile->m_Sections[(pProfile->m_NoSections) - 1].m_Entries != 0 ) + if ( pProfile->m_Sections[(pProfile->m_NoSections) - 1].m_Entries != nullptr ) { free(pProfile->m_Sections[(pProfile->m_NoSections) - 1].m_Entries); } - pProfile->m_Sections[pProfile->m_NoSections - 1].m_Entries = NULL; + pProfile->m_Sections[pProfile->m_NoSections - 1].m_Entries = nullptr; pProfile->m_Sections[pProfile->m_NoSections - 1].m_NoEntries = 0; pProfile->m_Sections[pProfile->m_NoSections - 1].m_MaxEntries = 0; - Section = (sal_Char *)stripBlanks(Section, &Len); + Section = stripBlanks(Section, &Len); pProfile->m_Sections[pProfile->m_NoSections - 1].m_Line = Line; pProfile->m_Sections[pProfile->m_NoSections - 1].m_Offset = Section - pProfile->m_Lines[Line]; pProfile->m_Sections[pProfile->m_NoSections - 1].m_Len = Len; - return sal_True; + return true; } static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection) @@ -1646,7 +1646,7 @@ static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSect if ((Section = pSection - pProfile->m_Sections) < pProfile->m_NoSections) { free (pSection->m_Entries); - pSection->m_Entries=0; + pSection->m_Entries=nullptr; if (pProfile->m_NoSections - Section > 1) { memmove(&pProfile->m_Sections[Section], &pProfile->m_Sections[Section + 1], @@ -1655,11 +1655,11 @@ static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSect memset(&pProfile->m_Sections[pProfile->m_NoSections - 1], 0, (pProfile->m_MaxSections - pProfile->m_NoSections) * sizeof(osl_TProfileSection)); - pProfile->m_Sections[pProfile->m_NoSections - 1].m_Entries = 0; + pProfile->m_Sections[pProfile->m_NoSections - 1].m_Entries = nullptr; } else { - pSection->m_Entries = 0; + pSection->m_Entries = nullptr; } pProfile->m_NoSections--; @@ -1674,10 +1674,10 @@ static osl_TProfileSection* findEntry(osl_TProfileImpl* pProfile, const sal_Char static sal_uInt32 Sect = 0; sal_uInt32 i, n; sal_uInt32 Len; - osl_TProfileSection* pSec = NULL; + osl_TProfileSection* pSec = nullptr; Len = strlen(Section); - Section = (sal_Char *)stripBlanks(Section, &Len); + Section = stripBlanks(Section, &Len); n = Sect; @@ -1715,37 +1715,37 @@ static sal_uInt32 Sect = 0; } } else - pSec = NULL; + pSec = nullptr; return pSec; } -static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile) +static bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile) { sal_uInt32 i; - sal_Char* pStr; - sal_Char* pChar; + sal_Char const * pStr; + sal_Char const * pChar; sal_Char Line[4096]; pProfile->m_NoLines = 0; pProfile->m_NoSections = 0; - OSL_VERIFY(rewindFile(pFile, sal_False)); + OSL_VERIFY(rewindFile(pFile, false)); while (getLine(pFile, Line, sizeof(Line))) { if (! addLine(pProfile, Line)) - return sal_False; + return false; } for (i = 0; i < pProfile->m_NoLines; i++) { - pStr = (sal_Char *)stripBlanks(pProfile->m_Lines[i], NULL); + pStr = stripBlanks(pProfile->m_Lines[i], nullptr); if ((*pStr == '\0') || (*pStr == ';')) continue; - if ((*pStr != '[') || ((pChar = strrchr(pStr, ']')) == NULL) || + if ((*pStr != '[') || ((pChar = strrchr(pStr, ']')) == nullptr) || ((pChar - pStr) <= 2)) { /* insert entry */ @@ -1753,31 +1753,31 @@ static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile) if (pProfile->m_NoSections < 1) continue; - if ((pChar = strchr(pStr, '=')) == NULL) + if ((pChar = strchr(pStr, '=')) == nullptr) pChar = pStr + strlen(pStr); if (! addEntry(pProfile, &pProfile->m_Sections[pProfile->m_NoSections - 1], i, pStr, pChar - pStr)) - return sal_False; + return false; } else { /* new section */ if (! addSection(pProfile, i, pStr + 1, pChar - pStr - 1)) - return sal_False; + return false; } } - return sal_True; + return true; } -static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) +static bool storeProfile(osl_TProfileImpl* pProfile, bool bCleanup) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("In storeProfile"); #endif - if (pProfile->m_Lines != NULL) + if (pProfile->m_Lines != nullptr) { if (pProfile->m_Flags & FLG_MODIFIED) { @@ -1785,12 +1785,12 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) osl_TFile* pTmpFile = osl_openTmpProfileImpl(pProfile); - if ( pTmpFile == 0 ) + if ( pTmpFile == nullptr ) { - return sal_False; + return false; } - OSL_VERIFY(rewindFile(pTmpFile, sal_True)); + OSL_VERIFY(rewindFile(pTmpFile, true)); for (i = 0; i < pProfile->m_NoLines; i++) { @@ -1799,12 +1799,12 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) if ( ! writeProfileImpl(pTmpFile) ) { - if ( pTmpFile->m_pWriteBuf != 0 ) + if ( pTmpFile->m_pWriteBuf != nullptr ) { free(pTmpFile->m_pWriteBuf); } - pTmpFile->m_pWriteBuf=0; + pTmpFile->m_pWriteBuf=nullptr; pTmpFile->m_nWriteBufLen=0; pTmpFile->m_nWriteBufFree=0; @@ -1813,7 +1813,7 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) #endif closeFileImpl(pTmpFile); - return sal_False; + return false; } pProfile->m_Flags &= ~FLG_MODIFIED; @@ -1833,14 +1833,14 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) removeLine(pProfile, pProfile->m_NoLines - 1); free(pProfile->m_Lines); - pProfile->m_Lines = NULL; + pProfile->m_Lines = nullptr; pProfile->m_MaxLines = 0; while (pProfile->m_NoSections > 0) removeSection(pProfile, &pProfile->m_Sections[pProfile->m_NoSections - 1]); free(pProfile->m_Sections); - pProfile->m_Sections = NULL; + pProfile->m_Sections = nullptr; pProfile->m_MaxSections = 0; } } @@ -1848,14 +1848,14 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out storeProfile [ok]"); #endif - return sal_True; + return true; } static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile) { - osl_TFile* pFile=0; - rtl_uString* ustrExtension=0; - rtl_uString* ustrTmpName=0; + osl_TFile* pFile=nullptr; + rtl_uString* ustrExtension=nullptr; + rtl_uString* ustrTmpName=nullptr; oslProfileOption PFlags=0; rtl_uString_newFromAscii(&ustrExtension,"tmp"); @@ -1864,9 +1864,9 @@ static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile) ustrTmpName=osl_ProfileGenerateExtension(pProfile->m_strFileName,ustrExtension); rtl_uString_release(ustrExtension); - if ( ustrTmpName == 0 ) + if ( ustrTmpName == nullptr ) { - return 0; + return nullptr; } if ( ! ( pProfile->m_Flags & osl_Profile_READLOCK ) ) @@ -1881,32 +1881,32 @@ static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile) return pFile; } -static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) +static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) { - sal_Bool bRet = sal_False; + bool bRet = false; - rtl_uString* ustrBakFile=0; - rtl_uString* ustrTmpFile=0; - rtl_uString* ustrIniFile=0; - rtl_uString* ustrExtension=0; + rtl_uString* ustrBakFile=nullptr; + rtl_uString* ustrTmpFile=nullptr; + rtl_uString* ustrIniFile=nullptr; + rtl_uString* ustrExtension=nullptr; rtl_uString_newFromAscii(&ustrExtension,"bak"); ustrBakFile=osl_ProfileGenerateExtension(pProfile->m_strFileName,ustrExtension); rtl_uString_release(ustrExtension); - ustrExtension=0; + ustrExtension=nullptr; rtl_uString_newFromAscii(&ustrExtension,"ini"); ustrIniFile=osl_ProfileGenerateExtension(pProfile->m_strFileName,ustrExtension); rtl_uString_release(ustrExtension); - ustrExtension=0; + ustrExtension=nullptr; rtl_uString_newFromAscii(&ustrExtension,"tmp"); ustrTmpFile=osl_ProfileGenerateExtension(pProfile->m_strFileName,ustrExtension); rtl_uString_release(ustrExtension); - ustrExtension=0; + ustrExtension=nullptr; /* unlink bak */ DeleteFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )) ); @@ -1922,8 +1922,8 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) static rtl_uString* osl_ProfileGenerateExtension(rtl_uString* ustrFileName, rtl_uString* ustrExtension) { - rtl_uString* ustrNewFileName = 0; - rtl_uString* ustrOldExtension = 0; + rtl_uString* ustrNewFileName = nullptr; + rtl_uString* ustrOldExtension = nullptr; sal_Unicode* pFileNameBuf = rtl_uString_getStr(ustrFileName); @@ -1942,9 +1942,9 @@ static rtl_uString* osl_ProfileGenerateExtension(rtl_uString* ustrFileName, rtl_ return ustrNewFileName; } -static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable) +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 ) @@ -1956,13 +1956,13 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable) PFlags = osl_Profile_DEFAULT; } - if (pProfile == NULL) + if (pProfile == nullptr) { #ifdef DEBUG_OSL_PROFILE OSL_TRACE("AUTOOPEN MODE"); #endif - if ( ( pProfile = (osl_TProfileImpl*)osl_openProfile( NULL, PFlags ) ) != NULL ) + if ( ( pProfile = static_cast<osl_TProfileImpl*>(osl_openProfile( nullptr, PFlags )) ) != nullptr ) { pProfile->m_Flags |= FLG_AUTOOPEN; } @@ -1985,7 +1985,7 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable) pProfile->m_pFile = openFileImpl( pProfile->m_strFileName, pProfile->m_Flags | PFlags); if (!pProfile->m_pFile) - return NULL; + return nullptr; Stamp = getFileStamp(pProfile->m_pFile); @@ -2005,7 +2005,7 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable) /* A readlock file could not be written */ if ((pProfile->m_Flags & osl_Profile_READLOCK) && bWriteable) { - return NULL; + return nullptr; } } } @@ -2014,18 +2014,18 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable) return pProfile; } -static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) +static bool releaseProfile(osl_TProfileImpl* pProfile) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("In releaseProfile"); #endif - if ( pProfile == 0 ) + if ( pProfile == nullptr ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out releaseProfile [profile==0]"); #endif - return sal_False; + return false; } if (! (pProfile->m_Flags & osl_Profile_SYSTEM)) @@ -2035,7 +2035,7 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out releaseProfile [AUTOOPEN]"); #endif - return osl_closeProfile((oslProfile)pProfile); + return osl_closeProfile(static_cast<oslProfile>(pProfile)); } else { @@ -2046,10 +2046,10 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE))) { if (pProfile->m_Flags & FLG_MODIFIED) - storeProfile(pProfile, sal_False); + storeProfile(pProfile, false); closeFileImpl(pProfile->m_pFile); - pProfile->m_pFile = NULL; + pProfile->m_pFile = nullptr; } } } @@ -2057,10 +2057,10 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out releaseProfile [ok]"); #endif - return sal_True; + return true; } -static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile, sal_Unicode *strProfile) +static bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *strFile, sal_Unicode *strProfile) { sal_Char *pChr; sal_Char Buffer[4096] = ""; @@ -2079,7 +2079,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str while ((strPath[i] != L'"') && (strPath[i] != L'\0')) i++; - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strPath), i, Product, sizeof(Product), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strPath), i, Product, sizeof(Product), nullptr, nullptr); Product[i] = '\0'; strPath += i; @@ -2097,10 +2097,10 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str /* if we have not product identfication, do a special handling for soffice.ini */ if (rtl_ustr_ascii_compare(strFile, SVERSION_PROFILE) == 0) { - rtl_uString * strSVProfile = NULL; - rtl_uString * strSVFallback = NULL; - rtl_uString * strSVLocation = NULL; - rtl_uString * strSVName = NULL; + rtl_uString * strSVProfile = nullptr; + rtl_uString * strSVFallback = nullptr; + rtl_uString * strSVLocation = nullptr; + rtl_uString * strSVName = nullptr; ::osl::LongPathBuffer< sal_Char > aDir( MAX_LONG_PATH ); oslProfile hProfile; @@ -2139,7 +2139,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str osl_closeProfile(hProfile); } rtl_uString_release(strSVProfile); - strSVProfile = NULL; + strSVProfile = nullptr; } /* open sversion.ini in the users directory, and try to locate the entry @@ -2180,7 +2180,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str rtl_uString_release(strSVName); /* remove any trailing build number */ - if ((pChr = strrchr(Product, '/')) != NULL) + if ((pChr = strrchr(Product, '/')) != nullptr) *pChr = '\0'; } } @@ -2192,7 +2192,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str for (n = 0; n < nArgs; n++) { - rtl_uString * strCommandArg = NULL; + rtl_uString * strCommandArg = nullptr; osl_getCommandArg( n, &strCommandArg ); if (((strCommandArg->buffer[0] == L'-') || (strCommandArg->buffer[0] == L'+')) && (rtl_ustr_ascii_compare_WithLength(strCommandArg->buffer, RTL_CONSTASCII_LENGTH(SVERSION_OPTION), SVERSION_OPTION))) @@ -2223,7 +2223,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH ); int nLen = 0; - if ((nLen = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0) + if ((nLen = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr)) > 0) { strcpy(aTmpPath + nLen, SVERSION_USER); if (access(aTmpPath, 0) >= 0) @@ -2241,19 +2241,19 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str if (dwPathLen == 0) { - rtl_uString * strExecutable = NULL; - rtl_uString * strTmp = NULL; + rtl_uString * strExecutable = nullptr; + rtl_uString * strTmp = nullptr; sal_Int32 nPos; /* try to find the file in the directory of the executable */ if (osl_getExecutableFile(&strTmp) != osl_Process_E_None) - return sal_False; + return false; /* convert to native path */ if (osl_getSystemPathFromFileURL(strTmp, &strExecutable) != osl_File_E_None) { rtl_uString_release(strTmp); - return sal_False; + return false; } rtl_uString_release(strTmp); @@ -2263,7 +2263,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str { if ((nPos = rtl_ustr_lastIndexOfChar(strExecutable->buffer, L':')) == -1) { - return sal_False; + return false; } else { @@ -2282,10 +2282,10 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str /* if we have no product identification use the executable file name */ if (*Product == 0) { - WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), nullptr, nullptr); /* remove extension */ - if ((pChr = strrchr(Product, '.')) != NULL) + if ((pChr = strrchr(Product, '.')) != nullptr) *pChr = '\0'; } @@ -2305,7 +2305,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str { ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr); /* if file not exists, remove any specified subdirectories like "bin" or "program" */ @@ -2354,14 +2354,14 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str { ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), nullptr, nullptr); if ((access(aTmpPath, 0) < 0) && (Product[0] != '\0')) { - rtl_uString * strSVFallback = NULL; - rtl_uString * strSVProfile = NULL; - rtl_uString * strSVLocation = NULL; - rtl_uString * strSVName = NULL; + rtl_uString * strSVFallback = nullptr; + rtl_uString * strSVProfile = nullptr; + rtl_uString * strSVLocation = nullptr; + rtl_uString * strSVName = nullptr; oslProfile hProfile; rtl_uString_newFromAscii(&strSVFallback, SVERSION_FALLBACK); @@ -2425,7 +2425,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str if ((n = WideCharToMultiByte( CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath2, - aTmpPath2.getBufSizeInSymbols(), NULL, NULL)) + aTmpPath2.getBufSizeInSymbols(), nullptr, nullptr)) > 0) { strcpy(aTmpPath2 + n, SVERSION_USER); @@ -2456,7 +2456,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str /* copy filename */ copy_ustr_n(strProfile, aPath, dwPathLen+1); - return sal_True; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |