From 8980565881fcc484bb506b3135223b6a42aefbf0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:18:19 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: I9dfcec9488b2a25e32d3934766d6d4b208a8c2dc --- jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx | 4 ++-- jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx | 2 +- .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 18 +++++++-------- jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx | 2 +- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 26 +++++++++++----------- jvmfwk/plugins/sunmajor/pluginlib/vendorlist.hxx | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) (limited to 'jvmfwk/plugins') diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx index d4d67f6e58bb..f824e0cc82fc 100644 --- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx +++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx @@ -64,7 +64,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return -1; } - JavaInfo * pInfo = NULL; + JavaInfo * pInfo = nullptr; errcode = jfw_getSelectedJRE( & pInfo); if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS) @@ -73,7 +73,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return -1; } - if (pInfo == NULL) + if (pInfo == nullptr) { if (!findAndSelect(&pInfo)) return -1; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx index 9abc9787669b..9c431146c777 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx @@ -88,7 +88,7 @@ char const* const* GnuInfo::getRuntimePaths(int * size) char const* const* GnuInfo::getLibraryPaths(int* /*size*/) { - return NULL; + return nullptr; } bool GnuInfo::initialize(vector > props) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 6cd5c19267ec..52d1a3c36660 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -147,8 +147,8 @@ OString getPluginJarPath( JavaInfo* createJavaInfo(const rtl::Reference & info) { JavaInfo* pInfo = static_cast(rtl_allocateMemory(sizeof(JavaInfo))); - if (pInfo == NULL) - return NULL; + if (pInfo == nullptr) + return nullptr; OUString sVendor = info->getVendor(); pInfo->sVendor = sVendor.pData; rtl_uString_acquire(sVendor.pData); @@ -317,15 +317,15 @@ javaPluginError jfw_plugin_getAllJavaInfos( //nLenlist contains the number of elements in arExcludeList. //If no exclude list is provided then nLenList must be 0 - OSL_ASSERT( ! (arExcludeList == NULL && nLenList > 0)); - if (arExcludeList == NULL && nLenList > 0) + OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0)); + if (arExcludeList == nullptr && nLenList > 0) return JFW_PLUGIN_E_INVALID_ARG; OSL_ASSERT(!sVendor.isEmpty()); if (sVendor.isEmpty()) return JFW_PLUGIN_E_INVALID_ARG; - JavaInfo** arInfo = NULL; + JavaInfo** arInfo = nullptr; //Find all JREs vector > vecInfos = @@ -383,8 +383,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath( //nLenlist contains the number of elements in arExcludeList. //If no exclude list is provided then nLenList must be 0 - OSL_ASSERT( ! (arExcludeList == NULL && nLenList > 0)); - if (arExcludeList == NULL && nLenList > 0) + OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0)); + if (arExcludeList == nullptr && nLenList > 0) return JFW_PLUGIN_E_INVALID_ARG; OSL_ASSERT(!sVendor.isEmpty()); @@ -654,7 +654,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( // unless errorcode is volatile the following warning occurs on gcc: // warning: variable 'errorcode' might be clobbered by `longjmp' or `vfork' volatile javaPluginError errorcode = JFW_PLUGIN_E_NONE; - if ( pInfo == NULL || ppVm == NULL || ppEnv == NULL) + if ( pInfo == nullptr || ppVm == nullptr || ppEnv == nullptr) return JFW_PLUGIN_E_INVALID_ARG; //Check if the Vendor (pInfo->sVendor) is supported by this plugin if ( ! isVendorSupported(pInfo->sVendor)) @@ -827,7 +827,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( */ g_bInGetJavaVM = 1; jint err; - JavaVM * pJavaVM = 0; + JavaVM * pJavaVM = nullptr; memset( jmp_jvm_abort, 0, sizeof(jmp_jvm_abort)); int jmpval= setjmp( jmp_jvm_abort ); /* If jmpval is not "0" then this point was reached by a longjmp in the diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx index 667440c86ac9..47874405b731 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx @@ -205,7 +205,7 @@ bool SunVersion::init(const char *szVersion) SunVersion::PreRelease SunVersion::getPreRelease(const char *szRelease) { - if (szRelease == NULL) + if (szRelease == nullptr) return Rel_NONE; if( ! strcmp(szRelease,"internal")) return Rel_INTERNAL; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 1423c49578e8..b9ec44367588 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -235,7 +235,7 @@ private: inline FileHandleGuard::~FileHandleGuard() { - if (m_rHandle != 0) + if (m_rHandle != nullptr) { if (osl_closeFile(m_rHandle) != osl_File_E_None) { @@ -471,9 +471,9 @@ bool getJavaProps(const OUString & exePath, cArgs = 4; } - oslProcess javaProcess= 0; - oslFileHandle fileOut= 0; - oslFileHandle fileErr= 0; + oslProcess javaProcess= nullptr; + oslFileHandle fileOut= nullptr; + oslFileHandle fileErr= nullptr; FileHandleReader stdoutReader(fileOut); rtl::Reference< AsynchReader > stderrReader(new AsynchReader(fileErr)); @@ -484,12 +484,12 @@ bool getJavaProps(const OUString & exePath, args, cArgs, //sal_uInt32 nArguments, osl_Process_HIDDEN, //oslProcessOption Options, - NULL, //oslSecurity Security, + nullptr, //oslSecurity Security, usStartDir.pData,//usStartDir.pData,//usWorkDir.pData, //rtl_uString *strWorkDir, - NULL, //rtl_uString *strEnvironment[], + nullptr, //rtl_uString *strEnvironment[], 0, // sal_uInt32 nEnvironmentVars, &javaProcess, //oslProcess *pProcess, - NULL,//oslFileHandle *pChildInputWrite, + nullptr,//oslFileHandle *pChildInputWrite, &fileOut,//oslFileHandle *pChildOutputRead, &fileErr);//oslFileHandle *pChildErrorRead); @@ -564,7 +564,7 @@ bool getJavaProps(const OUString & exePath, */ bool decodeOutput(const OString& s, OUString* out) { - OSL_ASSERT(out != 0); + OSL_ASSERT(out != nullptr); OUStringBuffer buff(512); sal_Int32 nIndex = 0; do @@ -761,7 +761,7 @@ void addJREInfoFromBinPath( //map: jre/bin/java.exe for ( sal_Int32 pos = 0; - gVendorMap[pos].sVendorName != NULL; ++pos ) + gVendorMap[pos].sVendorName != nullptr; ++pos ) { vector vecPaths; getJavaExePaths_func pFunc = gVendorMap[pos].getJavaFunc; @@ -910,7 +910,7 @@ rtl::Reference getJREInfoByPath( // If this path is invalid then there is no chance to find a JRE here if (sResolvedDir.isEmpty()) { - return 0; + return nullptr; } //check if the directory path is good, that is a JRE was already recognized. @@ -927,7 +927,7 @@ rtl::Reference getJREInfoByPath( } for ( sal_Int32 pos = 0; - gVendorMap[pos].sVendorName != NULL; ++pos ) + gVendorMap[pos].sVendorName != nullptr; ++pos ) { vector vecPaths; getJavaExePaths_func pFunc = gVendorMap[pos].getJavaFunc; @@ -1053,7 +1053,7 @@ rtl::Reference getJREInfoByPath( { //find the creator func for the respective vendor name for ( sal_Int32 c = 0; - gVendorMap[c].sVendorName != NULL; ++c ) + gVendorMap[c].sVendorName != nullptr; ++c ) { OUString sNameMap(gVendorMap[c].sVendorName, strlen(gVendorMap[c].sVendorName), RTL_TEXTENCODING_ASCII_US); @@ -1087,7 +1087,7 @@ Reference createInstance(createInstance_func pFunc, if (aBase.is()) { if (!aBase->initialize(properties)) - aBase = 0; + aBase = nullptr; } return aBase; } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.hxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.hxx index 5709e79a8f7a..81ce015402c2 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.hxx @@ -43,7 +43,7 @@ VendorSupportMapEntry gVendorMap[] ={ {x, & y::getJavaExePaths, & y::createInstance}, #define END_VENDOR_MAP() \ - {NULL, NULL, NULL} }; + {nullptr, nullptr, nullptr} }; /* Examines if the vendor supplied in parameter sVendor is part of the list of supported vendors. That is the arry of VendorSupportMapEntry -- cgit