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

loplugin:nullptr (automatic rewrite)

Change-Id: Ic33cbe3feed8aec9f7578aea2cbd809169d9b8c8
üst 40c4a086
......@@ -160,7 +160,7 @@ bool fileExists(const OString& fileName)
{
FILE *f= fopen(fileName.getStr(), "r");
if (f != NULL)
if (f != nullptr)
{
fclose(f);
return true;
......@@ -175,7 +175,7 @@ bool checkFileContent(const OString& targetFileName, const OString& tmpFileName)
FILE *tmp = fopen(tmpFileName.getStr(), "r");
bool bFindChanges = false;
if (target != NULL && tmp != NULL)
if (target != nullptr && tmp != nullptr)
{
sal_Char buffer1[1024+1];
sal_Char buffer2[1024+1];
......@@ -271,7 +271,7 @@ OUString convertToFileUrl(const OString& fileName)
// FileStream
FileStream::FileStream()
: m_file(NULL)
: m_file(nullptr)
{
}
......@@ -308,7 +308,7 @@ void FileStream::createTempFile(const OString& sPath)
osl_File_Attribute_GrpRead |
osl_File_Attribute_OthRead;
if (osl_setFileAttributes(sTmpName.pData, uAttr) != osl_File_E_None) {
m_file = NULL;
m_file = nullptr;
return;
}
#endif
......@@ -316,7 +316,7 @@ void FileStream::createTempFile(const OString& sPath)
FileBase::getSystemPathFromFileURL(sTmpName, sSysTmpName);
m_name = OUStringToOString(sSysTmpName, osl_getThreadTextEncoding());
} else
m_file = NULL;
m_file = nullptr;
}
void FileStream::close()
......@@ -324,7 +324,7 @@ void FileStream::close()
if ( isValid() )
{
osl_closeFile(m_file);
m_file = NULL;
m_file = nullptr;
m_name.clear();
}
}
......
......@@ -63,7 +63,7 @@ codemaker::UnoType::Sort TypeManager::getSort(
rtl::Reference< unoidl::MapCursor > * cursor) const
{
if (name.isEmpty()) {
if (cursor != 0) {
if (cursor != nullptr) {
*cursor = manager_->createCursor("");
}
return codemaker::UnoType::SORT_MODULE;
......@@ -123,12 +123,12 @@ codemaker::UnoType::Sort TypeManager::getSort(
if (!ent.is()) {
throw CannotDumpException("Unknown entity '" + name + "'");
}
if (entity != 0) {
if (entity != nullptr) {
*entity = ent;
}
switch (ent->getSort()) {
case unoidl::Entity::SORT_MODULE:
if (cursor != 0) {
if (cursor != nullptr) {
*cursor = manager_->createCursor(name);
}
return codemaker::UnoType::SORT_MODULE;
......@@ -208,16 +208,16 @@ codemaker::UnoType::Sort TypeManager::decompose(
case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
case codemaker::UnoType::SORT_EXCEPTION_TYPE:
case codemaker::UnoType::SORT_INTERFACE_TYPE:
if (nucleus != 0) {
if (nucleus != nullptr) {
*nucleus = n;
}
if (rank != 0) {
if (rank != nullptr) {
*rank = k;
}
if (arguments != 0) {
if (arguments != nullptr) {
arguments->clear();
}
if (entity != 0) {
if (entity != nullptr) {
*entity = ent;
}
return s;
......@@ -231,13 +231,13 @@ codemaker::UnoType::Sort TypeManager::decompose(
"bad number of template arguments for \"" + n
+ "\" resolved from \"" + name + "\"");
}
if (nucleus != 0) {
if (nucleus != nullptr) {
*nucleus = n;
}
if (rank != 0) {
if (rank != nullptr) {
*rank = k;
}
if (arguments != 0) {
if (arguments != nullptr) {
arguments->clear();
for (std::vector< OString >::iterator i(args.begin());
i != args.end(); ++i)
......@@ -245,7 +245,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
arguments->push_back(b2u(*i));
}
}
if (entity != 0) {
if (entity != nullptr) {
*entity = ent;
}
return
......
......@@ -34,10 +34,10 @@ OString codemaker::UnoType::decompose(
while (len - i > 1 && type[i + 1] == ']') {
i += 2;
}
if (rank != 0) {
if (rank != nullptr) {
*rank = i / 2;
}
sal_Int32 j = arguments == 0 ? -1 : type.indexOf('<', i);
sal_Int32 j = arguments == nullptr ? -1 : type.indexOf('<', i);
if (j < 0) {
return type.copy(i);
}
......
......@@ -288,7 +288,7 @@ OString translateUnoToCppIdentifier(
|| unoIdentifier == "std"))
// Others:
|| unoIdentifier == "NDEBUG"
|| (forbidden != 0 && unoIdentifier == *forbidden) )
|| (forbidden != nullptr && unoIdentifier == *forbidden) )
{
return prefix + "_" + unoIdentifier;
} else {
......
......@@ -61,7 +61,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
i = 0;
}
char *s=NULL;
char *s=nullptr;
for( ; i < ac; i++)
{
if (av[i][0] == '-')
......@@ -265,7 +265,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
if (av[i][0] == '@')
{
FILE* cmdFile = fopen(av[i]+1, "r");
if( cmdFile == NULL )
if( cmdFile == nullptr )
{
fprintf(stderr, "%s", prepareHelp().getStr());
ret = false;
......
......@@ -188,7 +188,7 @@ public:
OUString getTypeClass(OUString const & name, bool cStyle = false);
void dumpCppuGetType(
FileStream & out, OUString const & name, OUString const * ownName = 0);
FileStream & out, OUString const & name, OUString const * ownName = nullptr);
sal_uInt32 getInheritedMemberCount();
......@@ -538,7 +538,7 @@ void CppuType::dumpHFileContent(
addDefaultHIncludes(includes);
dumpHeaderDefine(out, "HDL");
out << "\n";
includes.dump(out, 0);
includes.dump(out, nullptr);
out << ("\nnamespace com { namespace sun { namespace star { namespace uno"
" { class Type; } } } }\n\n");
if (codemaker::cppumaker::dumpNamespaceOpen(out, name_, false)) {
......@@ -835,7 +835,7 @@ void CppuType::dumpCppuGetType(
OUString nucleus;
sal_Int32 rank;
codemaker::UnoType::Sort sort = m_typeMgr->decompose(
name, true, &nucleus, &rank, 0, 0);
name, true, &nucleus, &rank, nullptr, nullptr);
switch (rank == 0 ? sort : codemaker::UnoType::SORT_SEQUENCE_TYPE) {
case codemaker::UnoType::SORT_VOID:
case codemaker::UnoType::SORT_BOOLEAN:
......@@ -860,7 +860,7 @@ void CppuType::dumpCppuGetType(
case codemaker::UnoType::SORT_EXCEPTION_TYPE:
case codemaker::UnoType::SORT_INTERFACE_TYPE:
// Take care of recursion like struct S { sequence<S> x; }:
if (ownName == 0 || nucleus != *ownName) {
if (ownName == nullptr || nucleus != *ownName) {
out << indent() << "::cppu::UnoType< ";
dumpType(out, name, false, false, false, true);
out << " >::get();\n";
......@@ -1507,7 +1507,7 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) {
void InterfaceType::dumpAttributesCppuDecl(
FileStream & out, std::set< OUString > * seen)
{
assert(seen != 0);
assert(seen != nullptr);
for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::const_iterator
i(entity_->getDirectAttributes().begin());
i != entity_->getDirectAttributes().end(); ++i)
......@@ -1537,7 +1537,7 @@ void InterfaceType::dumpAttributesCppuDecl(
void InterfaceType::dumpMethodsCppuDecl(
FileStream & out, std::set< OUString > * seen)
{
assert(seen != 0);
assert(seen != nullptr);
for (std::vector< unoidl::InterfaceTypeEntity::Method >::const_iterator i(
entity_->getDirectMethods().begin());
i != entity_->getDirectMethods().end(); ++i)
......@@ -1650,7 +1650,7 @@ void ConstantGroup::dumpHFile(
OUString headerDefine(dumpHeaderDefine(out, "HDL"));
out << "\n";
addDefaultHIncludes(includes);
includes.dump(out, 0);
includes.dump(out, nullptr);
out << "\n";
if (codemaker::cppumaker::dumpNamespaceOpen(out, name_, true)) {
out << "\n";
......@@ -3289,7 +3289,7 @@ void Typedef::dumpHFile(
o << "\n";
addDefaultHIncludes(includes);
includes.dump(o, 0);
includes.dump(o, nullptr);
o << "\n";
if (codemaker::cppumaker::dumpNamespaceOpen(o, name_, false)) {
......@@ -3453,7 +3453,7 @@ void ServiceType::dumpHxxFile(
u2b(id_), "service", isGlobal()));
OUString headerDefine(dumpHeaderDefine(o, "HPP"));
o << "\n";
includes.dump(o, 0);
includes.dump(o, nullptr);
if (!entity_->getConstructors().empty()) {
o << ("\n#if defined ANDROID || defined IOS //TODO\n"
"#include <com/sun/star/lang/XInitialization.hpp>\n"
......@@ -3775,7 +3775,7 @@ void SingletonType::dumpHxxFile(
includes.addReference();
includes.addRtlUstringH();
includes.addRtlUstringHxx();
includes.dump(o, 0);
includes.dump(o, nullptr);
o << ("\n#if defined ANDROID || defined IOS //TODO\n"
"#include <com/sun/star/lang/XInitialization.hpp>\n"
"#include <osl/detail/component-defines.h>\n#endif\n\n"
......
......@@ -125,7 +125,7 @@ void Includes::add(OString const & entityName) {
namespace {
void dumpEmptyLineBeforeFirst(FileStream & out, bool * first) {
OSL_ASSERT(first != 0);
OSL_ASSERT(first != nullptr);
if (*first) {
out << "\n";
*first = false;
......@@ -135,7 +135,7 @@ void dumpEmptyLineBeforeFirst(FileStream & out, bool * first) {
}
void Includes::dump(FileStream & out, OUString const * companionHdl) {
OSL_ASSERT(companionHdl == 0 || m_hpp);
OSL_ASSERT(companionHdl == nullptr || m_hpp);
if (!m_includeReference) {
for (Dependencies::Map::iterator i(m_map.begin()); i != m_map.end();
++i)
......
......@@ -338,7 +338,7 @@ void ClassFile::Code::instrTableswitch(
for (std::list< Code * >::const_iterator i(blocks.begin());
i != blocks.end(); ++i)
{
if (*i == 0) {
if (*i == nullptr) {
appendU4(m_code, defaultOffset);
} else {
appendU4(m_code, static_cast< sal_uInt32 >(pos2 - pos1));
......@@ -350,7 +350,7 @@ void ClassFile::Code::instrTableswitch(
for (std::list< Code * >::const_iterator i(blocks.begin());
i != blocks.end(); ++i)
{
if (*i != 0) {
if (*i != nullptr) {
appendStream(m_code, (*i)->m_code);
}
}
......@@ -608,9 +608,9 @@ void ClassFile::addMethod(
}
appendU2(
m_methods,
((code == 0 ? 0 : 1) + (exceptions.empty() ? 0 : 1)
((code == nullptr ? 0 : 1) + (exceptions.empty() ? 0 : 1)
+ (signature.isEmpty() ? 0 : 1)));
if (code != 0) {
if (code != nullptr) {
std::vector< unsigned char >::size_type codeSize = code->m_code.size();
std::vector< unsigned char >::size_type exceptionTableSize
= code->m_exceptionTable.size();
......
......@@ -53,7 +53,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
i = 1;
}
char *s=NULL;
char *s=nullptr;
for( ; i < ac; i++)
{
if (av[i][0] == '-')
......@@ -190,7 +190,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
if (av[i][0] == '@')
{
FILE* cmdFile = fopen(av[i]+1, "r");
if( cmdFile == NULL )
if( cmdFile == nullptr )
{
fprintf(stderr, "%s", prepareHelp().getStr());
ret = false;
......
......@@ -54,7 +54,7 @@ enum IdentifierTranslationMode {
rtl::OString translateUnoToCppIdentifier(
rtl::OString const & identifier, rtl::OString const & prefix,
IdentifierTranslationMode transmode = ITM_GLOBAL,
rtl::OString const * forbidden = 0);
rtl::OString const * forbidden = nullptr);
} }
......
......@@ -47,8 +47,8 @@ public:
bool foundAtPrimaryProvider(OUString const & name) const;
codemaker::UnoType::Sort getSort(
OUString const & name, rtl::Reference< unoidl::Entity > * entity = 0,
rtl::Reference< unoidl::MapCursor > * cursor = 0) const;
OUString const & name, rtl::Reference< unoidl::Entity > * entity = nullptr,
rtl::Reference< unoidl::MapCursor > * cursor = nullptr) const;
codemaker::UnoType::Sort decompose(
OUString const & name, bool resolveTypedefs, OUString * nucleus,
......
......@@ -80,8 +80,8 @@ namespace UnoType {
@return the base part of the given type
*/
rtl::OString decompose(
rtl::OString const & type, sal_Int32 * rank = 0,
std::vector< rtl::OString > * arguments = 0);
rtl::OString const & type, sal_Int32 * rank = nullptr,
std::vector< rtl::OString > * arguments = nullptr);
}
}
......
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