Kaydet (Commit) 89805658 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: I9dfcec9488b2a25e32d3934766d6d4b208a8c2dc
üst 81da71b6
...@@ -64,7 +64,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) ...@@ -64,7 +64,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
return -1; return -1;
} }
JavaInfo * pInfo = NULL; JavaInfo * pInfo = nullptr;
errcode = jfw_getSelectedJRE( & pInfo); errcode = jfw_getSelectedJRE( & pInfo);
if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS) if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS)
...@@ -73,7 +73,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) ...@@ -73,7 +73,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
return -1; return -1;
} }
if (pInfo == NULL) if (pInfo == nullptr)
{ {
if (!findAndSelect(&pInfo)) if (!findAndSelect(&pInfo))
return -1; return -1;
......
...@@ -88,7 +88,7 @@ char const* const* GnuInfo::getRuntimePaths(int * size) ...@@ -88,7 +88,7 @@ char const* const* GnuInfo::getRuntimePaths(int * size)
char const* const* GnuInfo::getLibraryPaths(int* /*size*/) char const* const* GnuInfo::getLibraryPaths(int* /*size*/)
{ {
return NULL; return nullptr;
} }
bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
......
...@@ -147,8 +147,8 @@ OString getPluginJarPath( ...@@ -147,8 +147,8 @@ OString getPluginJarPath(
JavaInfo* createJavaInfo(const rtl::Reference<VendorBase> & info) JavaInfo* createJavaInfo(const rtl::Reference<VendorBase> & info)
{ {
JavaInfo* pInfo = static_cast<JavaInfo*>(rtl_allocateMemory(sizeof(JavaInfo))); JavaInfo* pInfo = static_cast<JavaInfo*>(rtl_allocateMemory(sizeof(JavaInfo)));
if (pInfo == NULL) if (pInfo == nullptr)
return NULL; return nullptr;
OUString sVendor = info->getVendor(); OUString sVendor = info->getVendor();
pInfo->sVendor = sVendor.pData; pInfo->sVendor = sVendor.pData;
rtl_uString_acquire(sVendor.pData); rtl_uString_acquire(sVendor.pData);
...@@ -317,15 +317,15 @@ javaPluginError jfw_plugin_getAllJavaInfos( ...@@ -317,15 +317,15 @@ javaPluginError jfw_plugin_getAllJavaInfos(
//nLenlist contains the number of elements in arExcludeList. //nLenlist contains the number of elements in arExcludeList.
//If no exclude list is provided then nLenList must be 0 //If no exclude list is provided then nLenList must be 0
OSL_ASSERT( ! (arExcludeList == NULL && nLenList > 0)); OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0));
if (arExcludeList == NULL && nLenList > 0) if (arExcludeList == nullptr && nLenList > 0)
return JFW_PLUGIN_E_INVALID_ARG; return JFW_PLUGIN_E_INVALID_ARG;
OSL_ASSERT(!sVendor.isEmpty()); OSL_ASSERT(!sVendor.isEmpty());
if (sVendor.isEmpty()) if (sVendor.isEmpty())
return JFW_PLUGIN_E_INVALID_ARG; return JFW_PLUGIN_E_INVALID_ARG;
JavaInfo** arInfo = NULL; JavaInfo** arInfo = nullptr;
//Find all JREs //Find all JREs
vector<rtl::Reference<VendorBase> > vecInfos = vector<rtl::Reference<VendorBase> > vecInfos =
...@@ -383,8 +383,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath( ...@@ -383,8 +383,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
//nLenlist contains the number of elements in arExcludeList. //nLenlist contains the number of elements in arExcludeList.
//If no exclude list is provided then nLenList must be 0 //If no exclude list is provided then nLenList must be 0
OSL_ASSERT( ! (arExcludeList == NULL && nLenList > 0)); OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0));
if (arExcludeList == NULL && nLenList > 0) if (arExcludeList == nullptr && nLenList > 0)
return JFW_PLUGIN_E_INVALID_ARG; return JFW_PLUGIN_E_INVALID_ARG;
OSL_ASSERT(!sVendor.isEmpty()); OSL_ASSERT(!sVendor.isEmpty());
...@@ -654,7 +654,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( ...@@ -654,7 +654,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
// unless errorcode is volatile the following warning occurs on gcc: // unless errorcode is volatile the following warning occurs on gcc:
// warning: variable 'errorcode' might be clobbered by `longjmp' or `vfork' // warning: variable 'errorcode' might be clobbered by `longjmp' or `vfork'
volatile javaPluginError errorcode = JFW_PLUGIN_E_NONE; 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; return JFW_PLUGIN_E_INVALID_ARG;
//Check if the Vendor (pInfo->sVendor) is supported by this plugin //Check if the Vendor (pInfo->sVendor) is supported by this plugin
if ( ! isVendorSupported(pInfo->sVendor)) if ( ! isVendorSupported(pInfo->sVendor))
...@@ -827,7 +827,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( ...@@ -827,7 +827,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
*/ */
g_bInGetJavaVM = 1; g_bInGetJavaVM = 1;
jint err; jint err;
JavaVM * pJavaVM = 0; JavaVM * pJavaVM = nullptr;
memset( jmp_jvm_abort, 0, sizeof(jmp_jvm_abort)); memset( jmp_jvm_abort, 0, sizeof(jmp_jvm_abort));
int jmpval= setjmp( jmp_jvm_abort ); int jmpval= setjmp( jmp_jvm_abort );
/* If jmpval is not "0" then this point was reached by a longjmp in the /* If jmpval is not "0" then this point was reached by a longjmp in the
......
...@@ -205,7 +205,7 @@ bool SunVersion::init(const char *szVersion) ...@@ -205,7 +205,7 @@ bool SunVersion::init(const char *szVersion)
SunVersion::PreRelease SunVersion::getPreRelease(const char *szRelease) SunVersion::PreRelease SunVersion::getPreRelease(const char *szRelease)
{ {
if (szRelease == NULL) if (szRelease == nullptr)
return Rel_NONE; return Rel_NONE;
if( ! strcmp(szRelease,"internal")) if( ! strcmp(szRelease,"internal"))
return Rel_INTERNAL; return Rel_INTERNAL;
......
...@@ -235,7 +235,7 @@ private: ...@@ -235,7 +235,7 @@ private:
inline FileHandleGuard::~FileHandleGuard() inline FileHandleGuard::~FileHandleGuard()
{ {
if (m_rHandle != 0) if (m_rHandle != nullptr)
{ {
if (osl_closeFile(m_rHandle) != osl_File_E_None) if (osl_closeFile(m_rHandle) != osl_File_E_None)
{ {
...@@ -471,9 +471,9 @@ bool getJavaProps(const OUString & exePath, ...@@ -471,9 +471,9 @@ bool getJavaProps(const OUString & exePath,
cArgs = 4; cArgs = 4;
} }
oslProcess javaProcess= 0; oslProcess javaProcess= nullptr;
oslFileHandle fileOut= 0; oslFileHandle fileOut= nullptr;
oslFileHandle fileErr= 0; oslFileHandle fileErr= nullptr;
FileHandleReader stdoutReader(fileOut); FileHandleReader stdoutReader(fileOut);
rtl::Reference< AsynchReader > stderrReader(new AsynchReader(fileErr)); rtl::Reference< AsynchReader > stderrReader(new AsynchReader(fileErr));
...@@ -484,12 +484,12 @@ bool getJavaProps(const OUString & exePath, ...@@ -484,12 +484,12 @@ bool getJavaProps(const OUString & exePath,
args, args,
cArgs, //sal_uInt32 nArguments, cArgs, //sal_uInt32 nArguments,
osl_Process_HIDDEN, //oslProcessOption Options, osl_Process_HIDDEN, //oslProcessOption Options,
NULL, //oslSecurity Security, nullptr, //oslSecurity Security,
usStartDir.pData,//usStartDir.pData,//usWorkDir.pData, //rtl_uString *strWorkDir, usStartDir.pData,//usStartDir.pData,//usWorkDir.pData, //rtl_uString *strWorkDir,
NULL, //rtl_uString *strEnvironment[], nullptr, //rtl_uString *strEnvironment[],
0, // sal_uInt32 nEnvironmentVars, 0, // sal_uInt32 nEnvironmentVars,
&javaProcess, //oslProcess *pProcess, &javaProcess, //oslProcess *pProcess,
NULL,//oslFileHandle *pChildInputWrite, nullptr,//oslFileHandle *pChildInputWrite,
&fileOut,//oslFileHandle *pChildOutputRead, &fileOut,//oslFileHandle *pChildOutputRead,
&fileErr);//oslFileHandle *pChildErrorRead); &fileErr);//oslFileHandle *pChildErrorRead);
...@@ -564,7 +564,7 @@ bool getJavaProps(const OUString & exePath, ...@@ -564,7 +564,7 @@ bool getJavaProps(const OUString & exePath,
*/ */
bool decodeOutput(const OString& s, OUString* out) bool decodeOutput(const OString& s, OUString* out)
{ {
OSL_ASSERT(out != 0); OSL_ASSERT(out != nullptr);
OUStringBuffer buff(512); OUStringBuffer buff(512);
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
do do
...@@ -761,7 +761,7 @@ void addJREInfoFromBinPath( ...@@ -761,7 +761,7 @@ void addJREInfoFromBinPath(
//map: jre/bin/java.exe //map: jre/bin/java.exe
for ( sal_Int32 pos = 0; for ( sal_Int32 pos = 0;
gVendorMap[pos].sVendorName != NULL; ++pos ) gVendorMap[pos].sVendorName != nullptr; ++pos )
{ {
vector<OUString> vecPaths; vector<OUString> vecPaths;
getJavaExePaths_func pFunc = gVendorMap[pos].getJavaFunc; getJavaExePaths_func pFunc = gVendorMap[pos].getJavaFunc;
...@@ -910,7 +910,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -910,7 +910,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
// If this path is invalid then there is no chance to find a JRE here // If this path is invalid then there is no chance to find a JRE here
if (sResolvedDir.isEmpty()) if (sResolvedDir.isEmpty())
{ {
return 0; return nullptr;
} }
//check if the directory path is good, that is a JRE was already recognized. //check if the directory path is good, that is a JRE was already recognized.
...@@ -927,7 +927,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -927,7 +927,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
} }
for ( sal_Int32 pos = 0; for ( sal_Int32 pos = 0;
gVendorMap[pos].sVendorName != NULL; ++pos ) gVendorMap[pos].sVendorName != nullptr; ++pos )
{ {
vector<OUString> vecPaths; vector<OUString> vecPaths;
getJavaExePaths_func pFunc = gVendorMap[pos].getJavaFunc; getJavaExePaths_func pFunc = gVendorMap[pos].getJavaFunc;
...@@ -1053,7 +1053,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -1053,7 +1053,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
{ {
//find the creator func for the respective vendor name //find the creator func for the respective vendor name
for ( sal_Int32 c = 0; for ( sal_Int32 c = 0;
gVendorMap[c].sVendorName != NULL; ++c ) gVendorMap[c].sVendorName != nullptr; ++c )
{ {
OUString sNameMap(gVendorMap[c].sVendorName, strlen(gVendorMap[c].sVendorName), OUString sNameMap(gVendorMap[c].sVendorName, strlen(gVendorMap[c].sVendorName),
RTL_TEXTENCODING_ASCII_US); RTL_TEXTENCODING_ASCII_US);
...@@ -1087,7 +1087,7 @@ Reference<VendorBase> createInstance(createInstance_func pFunc, ...@@ -1087,7 +1087,7 @@ Reference<VendorBase> createInstance(createInstance_func pFunc,
if (aBase.is()) if (aBase.is())
{ {
if (!aBase->initialize(properties)) if (!aBase->initialize(properties))
aBase = 0; aBase = nullptr;
} }
return aBase; return aBase;
} }
......
...@@ -43,7 +43,7 @@ VendorSupportMapEntry gVendorMap[] ={ ...@@ -43,7 +43,7 @@ VendorSupportMapEntry gVendorMap[] ={
{x, & y::getJavaExePaths, & y::createInstance}, {x, & y::getJavaExePaths, & y::createInstance},
#define END_VENDOR_MAP() \ #define END_VENDOR_MAP() \
{NULL, NULL, NULL} }; {nullptr, nullptr, nullptr} };
/* Examines if the vendor supplied in parameter sVendor is part of the /* Examines if the vendor supplied in parameter sVendor is part of the
list of supported vendors. That is the arry of VendorSupportMapEntry list of supported vendors. That is the arry of VendorSupportMapEntry
......
This diff is collapsed.
This diff is collapsed.
...@@ -103,7 +103,7 @@ VendorSettings::VendorSettings(): ...@@ -103,7 +103,7 @@ VendorSettings::VendorSettings():
if (!sSettingsPath.isEmpty()) if (!sSettingsPath.isEmpty())
{ {
m_xmlDocVendorSettings = xmlParseFile(sSettingsPath.getStr()); m_xmlDocVendorSettings = xmlParseFile(sSettingsPath.getStr());
if (m_xmlDocVendorSettings == NULL) if (m_xmlDocVendorSettings == nullptr)
throw FrameworkException( throw FrameworkException(
JFW_E_ERROR, JFW_E_ERROR,
OString("[Java framework] Error while parsing file: ") OString("[Java framework] Error while parsing file: ")
...@@ -179,7 +179,7 @@ VersionInfo VendorSettings::getVersionInformation(const OUString & sVendor) ...@@ -179,7 +179,7 @@ VersionInfo VendorSettings::getVersionInformation(const OUString & sVendor)
if (!xmlXPathNodeSetIsEmpty(xPathObjectVersions->nodesetval)) if (!xmlXPathNodeSetIsEmpty(xPathObjectVersions->nodesetval))
{ {
xmlNode* cur = xPathObjectVersions->nodesetval->nodeTab[0]; xmlNode* cur = xPathObjectVersions->nodesetval->nodeTab[0];
while (cur != NULL) while (cur != nullptr)
{ {
if (cur->type == XML_ELEMENT_NODE ) if (cur->type == XML_ELEMENT_NODE )
{ {
...@@ -212,7 +212,7 @@ std::vector<OUString> VendorSettings::getSupportedVendors() ...@@ -212,7 +212,7 @@ std::vector<OUString> VendorSettings::getSupportedVendors()
{ {
//get the values of the vendor elements + name attribute //get the values of the vendor elements + name attribute
xmlNode* cur = result->nodesetval->nodeTab[0]; xmlNode* cur = result->nodesetval->nodeTab[0];
while (cur != NULL) while (cur != nullptr)
{ {
//between vendor elements are also text elements //between vendor elements are also text elements
if (cur->type == XML_ELEMENT_NODE) if (cur->type == XML_ELEMENT_NODE)
...@@ -346,7 +346,7 @@ OUString BootParams::getJREHome() ...@@ -346,7 +346,7 @@ OUString BootParams::getJREHome()
else if (bEnvJRE) else if (bEnvJRE)
{ {
const char * pJRE = getenv("JAVA_HOME"); const char * pJRE = getenv("JAVA_HOME");
if (pJRE == NULL) if (pJRE == nullptr)
{ {
throw FrameworkException( throw FrameworkException(
JFW_E_CONFIGURATION, JFW_E_CONFIGURATION,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
namespace jfw namespace jfw
{ {
CXPathObjectPtr::CXPathObjectPtr():_object(NULL) CXPathObjectPtr::CXPathObjectPtr():_object(nullptr)
{ {
} }
...@@ -45,7 +45,7 @@ CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext) ...@@ -45,7 +45,7 @@ CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
{ {
} }
CXPathContextPtr::CXPathContextPtr():_object(NULL) CXPathContextPtr::CXPathContextPtr():_object(nullptr)
{ {
} }
...@@ -69,7 +69,7 @@ CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc) ...@@ -69,7 +69,7 @@ CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc)
{ {
} }
CXmlDocPtr::CXmlDocPtr():_object(NULL) CXmlDocPtr::CXmlDocPtr():_object(nullptr)
{ {
} }
...@@ -95,12 +95,12 @@ CXmlCharPtr::CXmlCharPtr(xmlChar * aChar) ...@@ -95,12 +95,12 @@ CXmlCharPtr::CXmlCharPtr(xmlChar * aChar)
} }
CXmlCharPtr::CXmlCharPtr(const OUString & s): CXmlCharPtr::CXmlCharPtr(const OUString & s):
_object(NULL) _object(nullptr)
{ {
OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8); OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
_object = xmlCharStrdup(o.getStr()); _object = xmlCharStrdup(o.getStr());
} }
CXmlCharPtr::CXmlCharPtr():_object(NULL) CXmlCharPtr::CXmlCharPtr():_object(nullptr)
{ {
} }
...@@ -122,7 +122,7 @@ CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj) ...@@ -122,7 +122,7 @@ CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj)
CXmlCharPtr::operator OUString() CXmlCharPtr::operator OUString()
{ {
OUString ret; OUString ret;
if (_object != NULL) if (_object != nullptr)
{ {
OString aOStr(reinterpret_cast<char*>(_object)); OString aOStr(reinterpret_cast<char*>(_object));
ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8); ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment