diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 16:19:35 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 16:20:37 +0100 |
commit | 342866e66dea7cd0ff7c67f399553eee7e797ce2 (patch) | |
tree | ca6c568503192feb6ea2d900e3f8ef83ea92dce6 | |
parent | 671f69abf010a011554ef5363f691f73d5c3fba6 (diff) |
loplugin:nullptr (automatic rewrite; Mac-specific code)
Change-Id: I4e6979a5c59ee8a6ad1d55484c0c3ad3c32adce6
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/file_volume.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/nlsupport.cxx | 14 | ||||
-rw-r--r-- | sal/osl/unx/osxlocale.cxx | 6 | ||||
-rw-r--r-- | sal/osl/unx/process_impl.cxx | 4 | ||||
-rw-r--r-- | sal/osl/unx/signal.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/system.cxx | 32 |
7 files changed, 31 insertions, 31 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 5bc76e472696..c78e7753e0be 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -312,7 +312,7 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirect // convert decomposed filename to precomposed unicode char composed_name[BUFSIZ]; - CFMutableStringRef strRef = CFStringCreateMutable (NULL, 0 ); + CFMutableStringRef strRef = CFStringCreateMutable (nullptr, 0 ); CFStringAppendCString( strRef, pEntry->d_name, kCFStringEncodingUTF8 ); //UTF8 is default on Mac OSX CFStringNormalize( strRef, kCFStringNormalizationFormC ); CFStringGetCString( strRef, composed_name, BUFSIZ, kCFStringEncodingUTF8 ); diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 37d0025d66bd..7a869de244c0 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -297,7 +297,7 @@ static oslFileError osl_psz_getVolumeInformation ( rtl_str_getLength(__OSL_STATFS_TYPENAME(sfs)), osl_getThreadTextEncoding(), OUSTRING_TO_OSTRING_CVTFLAGS); - OSL_ASSERT(pInfo->ustrFileSystemName != 0); + OSL_ASSERT(pInfo->ustrFileSystemName != nullptr); pInfo->uValidFields |= osl_VolumeInfo_Mask_FileSystemName; } diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx index 74bce30b6b3d..c5e073c538fa 100644 --- a/sal/osl/unx/nlsupport.cxx +++ b/sal/osl/unx/nlsupport.cxx @@ -787,11 +787,11 @@ const _pair _iso_language_list[] = { rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) { - const _pair *language = 0; + const _pair *language = nullptr; char locale_buf[64] = ""; /* default to process locale if pLocale == NULL */ - if( NULL == pLocale ) + if( nullptr == pLocale ) osl_getProcessLocale( &pLocale ); /* convert rtl_Locale to locale string */ @@ -800,7 +800,7 @@ rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) /* check special handling list (EUC) first */ language = _pair_search( locale_buf, _full_locale_list, SAL_N_ELEMENTS( _full_locale_list ) ); - if( NULL == language ) + if( nullptr == language ) { /* * check if there is a charset qualifier at the end of the given locale string @@ -809,14 +809,14 @@ rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) */ char* cp = strrchr( locale_buf, '.' ); - if( NULL != cp ) + if( nullptr != cp ) { language = _pair_search( cp + 1, _locale_extension_list, SAL_N_ELEMENTS( _locale_extension_list ) ); } } /* use iso language code to determine the charset */ - if( NULL == language ) + if( nullptr == language ) { /* iso lang codes have 2 charaters */ locale_buf[2] = '\0'; @@ -827,7 +827,7 @@ rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) /* a matching item in our list provides a mapping from codeset to * rtl-codeset */ - if ( language != NULL ) + if ( language != nullptr ) return language->value; return RTL_TEXTENCODING_DONTKNOW; @@ -920,7 +920,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) char locale_buf[64]; /* convert rtl_Locale to locale string */ - if( NULL != _compose_locale( pLocale, locale_buf, 64 ) ) + if( nullptr != _compose_locale( pLocale, locale_buf, 64 ) ) { /* only change env vars that exist already */ if( getenv( "LC_ALL" ) ) diff --git a/sal/osl/unx/osxlocale.cxx b/sal/osl/unx/osxlocale.cxx index f8b0054aef8f..fecb2dc1e67e 100644 --- a/sal/osl/unx/osxlocale.cxx +++ b/sal/osl/unx/osxlocale.cxx @@ -54,7 +54,7 @@ namespace CFPropertyListRef pref = CFPreferencesCopyAppValue(CFSTR("AppleLanguages"), kCFPreferencesCurrentApplication); CFPropertyListGuard proplGuard(pref); - if (pref == NULL) // return fallback value 'en_US' + if (pref == nullptr) // return fallback value 'en_US' return CFStringCreateWithCString(kCFAllocatorDefault, "en_US", kCFStringEncodingASCII); CFStringRef sref = (CFGetTypeID(pref) == CFArrayGetTypeID()) ? static_cast<CFStringRef>(CFArrayGetValueAtIndex(static_cast<CFArrayRef>(pref), 0)) : static_cast<CFStringRef>(pref); @@ -76,11 +76,11 @@ rtl::OUString macosx_getLocale() CFStringRef sref = getProcessLocale(); CFStringGuard sGuard(sref); - assert(sref != NULL && "osxlocale.cxx: getProcessLocale must return a non-NULL value"); + assert(sref != nullptr && "osxlocale.cxx: getProcessLocale must return a non-NULL value"); // split the string into substrings; the first two (if there are two) substrings // are language and country - CFArrayRef subs = CFStringCreateArrayBySeparatingStrings(NULL, sref, CFSTR("-")); + CFArrayRef subs = CFStringCreateArrayBySeparatingStrings(nullptr, sref, CFSTR("-")); CFArrayGuard arrGuard(subs); rtl::OUStringBuffer buf; diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index f5d81dbb9cbf..d29ffb893939 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -57,10 +57,10 @@ oslProcessError SAL_CALL bootstrap_getExecutableFile(rtl_uString ** ppFileURL) { /* Determine absolute path. */ char abspath[PATH_MAX]; - if (realpath (buffer, abspath) != 0) + if (realpath (buffer, abspath) != nullptr) { /* Convert from utf8 to unicode. */ - rtl_uString * pAbsPath = 0; + rtl_uString * pAbsPath = nullptr; rtl_string2UString ( &(pAbsPath), abspath, rtl_str_getLength (abspath), diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx index 4701e7bfbbb3..fb5da33521b5 100644 --- a/sal/osl/unx/signal.cxx +++ b/sal/osl/unx/signal.cxx @@ -96,7 +96,7 @@ static struct SignalAction #endif { SIGABRT, ACT_ABORT, nullptr }, /* used by abort, replace SIGIOT in the future */ #ifdef SIGEMT - { SIGEMT, ACT_SYSTEM, NULL }, /* EMT instruction */ + { SIGEMT, ACT_SYSTEM, nullptr }, /* EMT instruction */ /* changed from ACT_ABORT to ACT_SYSTEM to remove handler*/ /* SIGEMT may also be used by the profiler - so it is probably not a good plan to have the new handler use this signal*/ diff --git a/sal/osl/unx/system.cxx b/sal/osl/unx/system.cxx index 847a575a0e3c..94e357a67c3e 100644 --- a/sal/osl/unx/system.cxx +++ b/sal/osl/unx/system.cxx @@ -78,12 +78,12 @@ struct hostent *gethostbyname_r(const char *name, struct hostent *result, naliases = naddr_list = naliasesdata = 0; - for ( p = res->h_aliases; *p != NULL; p++) { + for ( p = res->h_aliases; *p != nullptr; p++) { naliases++; naliasesdata += strlen(*p)+1; } - for ( p = res->h_addr_list; *p != NULL; p++) + for ( p = res->h_addr_list; *p != nullptr; p++) naddr_list++; if ( nname @@ -100,30 +100,30 @@ struct hostent *gethostbyname_r(const char *name, struct hostent *result, parray = reinterpret_cast<char**>(buffer); result->h_aliases = parray; data = buffer + (naliases+1)*sizeof(char*); - for ( p = res->h_aliases; *p != NULL; p++) { + for ( p = res->h_aliases; *p != nullptr; p++) { int n = strlen(*p)+1; *parray++ = data; memcpy(data, *p, n); data += n; } - *parray = NULL; + *parray = nullptr; buffer = data; parray = reinterpret_cast<char**>(buffer); result->h_addr_list = parray; data = buffer + (naddr_list+1)*sizeof(char*); - for ( p = res->h_addr_list; *p != NULL; p++) { + for ( p = res->h_addr_list; *p != nullptr; p++) { *parray++ = data; memcpy(data, *p, res->h_length); data += res->h_length; } - *parray = NULL; + *parray = nullptr; res = result; } else { errno = ERANGE; - res = NULL; + res = nullptr; } } else @@ -174,14 +174,14 @@ int macxp_resolveAlias(char *path, int buflen) if ( unprocessedPath ) *unprocessedPath = '\0'; - cfpath = CFStringCreateWithCString( NULL, path, kCFStringEncodingUTF8 ); - cfurl = CFURLCreateWithFileSystemPath( NULL, cfpath, kCFURLPOSIXPathStyle, false ); + cfpath = CFStringCreateWithCString( nullptr, path, kCFStringEncodingUTF8 ); + cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, kCFURLPOSIXPathStyle, false ); CFRelease( cfpath ); - cferror = NULL; - cfbookmark = CFURLCreateBookmarkDataFromFile( NULL, cfurl, &cferror ); + cferror = nullptr; + cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl, &cferror ); CFRelease( cfurl ); - if ( cfbookmark == NULL ) + if ( cfbookmark == nullptr ) { if(cferror) { @@ -191,10 +191,10 @@ int macxp_resolveAlias(char *path, int buflen) else { Boolean isStale; - cfurl = CFURLCreateByResolvingBookmarkData( NULL, cfbookmark, kCFBookmarkResolutionWithoutUIMask, - NULL, NULL, &isStale, &cferror ); + cfurl = CFURLCreateByResolvingBookmarkData( nullptr, cfbookmark, kCFBookmarkResolutionWithoutUIMask, + nullptr, nullptr, &isStale, &cferror ); CFRelease( cfbookmark ); - if ( cfurl == NULL ) + if ( cfurl == nullptr ) { CFRelease( cferror ); } @@ -202,7 +202,7 @@ int macxp_resolveAlias(char *path, int buflen) { cfpath = CFURLCopyFileSystemPath( cfurl, kCFURLPOSIXPathStyle ); CFRelease( cfurl ); - if ( cfpath != NULL ) + if ( cfpath != nullptr ) { char tmpPath[ PATH_MAX ]; if ( CFStringGetCString( cfpath, tmpPath, PATH_MAX, kCFStringEncodingUTF8 ) ) |