From 87a9abf351d1547638ec25c72d7fcb27d1b61440 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:11:36 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: Ic33cbe3feed8aec9f7578aea2cbd809169d9b8c8 --- codemaker/source/codemaker/global.cxx | 12 +-- codemaker/source/codemaker/typemanager.cxx | 22 ++-- codemaker/source/codemaker/unotype.cxx | 4 +- codemaker/source/commoncpp/commoncpp.cxx | 2 +- codemaker/source/cppumaker/cppuoptions.cxx | 4 +- codemaker/source/cppumaker/cpputype.cxx | 20 ++-- codemaker/source/cppumaker/includes.cxx | 4 +- codemaker/source/javamaker/classfile.cxx | 8 +- codemaker/source/javamaker/javaoptions.cxx | 4 +- codemaker/source/javamaker/javatype.cxx | 156 ++++++++++++++--------------- include/codemaker/commoncpp.hxx | 2 +- include/codemaker/typemanager.hxx | 4 +- include/codemaker/unotype.hxx | 4 +- 13 files changed, 123 insertions(+), 123 deletions(-) diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx index 810f91e61e0e..8853a5b4375e 100644 --- a/codemaker/source/codemaker/global.cxx +++ b/codemaker/source/codemaker/global.cxx @@ -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(); } } diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx index 3d1bd83199ca..65d6640e961d 100644 --- a/codemaker/source/codemaker/typemanager.cxx +++ b/codemaker/source/codemaker/typemanager.cxx @@ -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 diff --git a/codemaker/source/codemaker/unotype.cxx b/codemaker/source/codemaker/unotype.cxx index 38de2a7e1913..0c3c0f2abd40 100644 --- a/codemaker/source/codemaker/unotype.cxx +++ b/codemaker/source/codemaker/unotype.cxx @@ -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); } diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx index b03520033620..46a779089e06 100644 --- a/codemaker/source/commoncpp/commoncpp.cxx +++ b/codemaker/source/commoncpp/commoncpp.cxx @@ -288,7 +288,7 @@ OString translateUnoToCppIdentifier( || unoIdentifier == "std")) // Others: || unoIdentifier == "NDEBUG" - || (forbidden != 0 && unoIdentifier == *forbidden) ) + || (forbidden != nullptr && unoIdentifier == *forbidden) ) { return prefix + "_" + unoIdentifier; } else { diff --git a/codemaker/source/cppumaker/cppuoptions.cxx b/codemaker/source/cppumaker/cppuoptions.cxx index 3414a533ee53..40b33e30e2b5 100644 --- a/codemaker/source/cppumaker/cppuoptions.cxx +++ b/codemaker/source/cppumaker/cppuoptions.cxx @@ -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; diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 58a67b23d3d3..a27058d81152 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -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 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 \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 \n" "#include \n#endif\n\n" diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index 4c47c7e5be86..22c783085558 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -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) diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx index 2c9f35c12d59..b33d28153105 100644 --- a/codemaker/source/javamaker/classfile.cxx +++ b/codemaker/source/javamaker/classfile.cxx @@ -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(); diff --git a/codemaker/source/javamaker/javaoptions.cxx b/codemaker/source/javamaker/javaoptions.cxx index 75e2bd65153a..ea1a7cdcf548 100644 --- a/codemaker/source/javamaker/javaoptions.cxx +++ b/codemaker/source/javamaker/javaoptions.cxx @@ -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; diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index f31dfee4d508..ae198763c953 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -59,7 +59,7 @@ void appendUnoName( { assert(manager.is()); assert(rank >= 0); - assert(buffer != 0); + assert(buffer != nullptr); for (sal_Int32 i = 0; i != rank; ++i) { buffer->append("[]"); } @@ -75,7 +75,7 @@ void appendUnoName( OUString n; sal_Int32 k; std::vector< OUString > args; - manager->decompose(*i, false, &n, &k, &args, 0); + manager->decompose(*i, false, &n, &k, &args, nullptr); appendUnoName(manager, n, k, args, buffer); } buffer->append('>'); @@ -141,7 +141,7 @@ SpecialType translateUnoTypeToDescriptor( PolymorphicUnoType * polymorphicUnoType) { assert(rank >= 0); - assert((signature == 0) == (needsSignature == 0)); + assert((signature == nullptr) == (needsSignature == nullptr)); assert( arguments.empty() == (sort @@ -154,14 +154,14 @@ SpecialType translateUnoTypeToDescriptor( ++rank; } for (sal_Int32 i = 0; i != rank; ++i) { - if (descriptor != 0) { + if (descriptor != nullptr) { descriptor->append('['); } - if (signature != 0) { + if (signature != nullptr) { signature->append('['); } } - if (polymorphicUnoType != 0) { + if (polymorphicUnoType != nullptr) { if (sort == codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE) { @@ -210,10 +210,10 @@ SpecialType translateUnoTypeToDescriptor( { "Ljava/lang/Object;", "Ljava/lang/Object;" } }; char const * s = simpleTypeDescriptors[sort][rank == 0 && classType]; - if (descriptor != 0) { + if (descriptor != nullptr) { descriptor->append(s); } - if (signature != 0) { + if (signature != nullptr) { signature->append(s); } static SpecialType const @@ -227,10 +227,10 @@ SpecialType translateUnoTypeToDescriptor( } case codemaker::UnoType::SORT_INTERFACE_TYPE: if (nucleus == "com.sun.star.uno.XInterface") { - if (descriptor != 0) { + if (descriptor != nullptr) { descriptor->append("Ljava/lang/Object;"); } - if (signature != 0) { + if (signature != nullptr) { signature->append("Ljava/lang/Object;"); } return SPECIAL_TYPE_INTERFACE; @@ -240,15 +240,15 @@ SpecialType translateUnoTypeToDescriptor( case codemaker::UnoType::SORT_ENUM_TYPE: case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE: case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE: - if (dependencies != 0) { + if (dependencies != nullptr) { dependencies->insert(nucleus); } - if (descriptor != 0) { + if (descriptor != nullptr) { descriptor->append( "L" + codemaker::convertString(nucleus).replace('.', '/') + ";"); } - if (signature != 0) { + if (signature != nullptr) { signature->append( "L" + codemaker::convertString(nucleus).replace('.', '/')); if (!arguments.empty()) { @@ -258,8 +258,8 @@ SpecialType translateUnoTypeToDescriptor( i != arguments.end(); ++i) { translateUnoTypeToDescriptor( - manager, *i, false, true, dependencies, 0, signature, - needsSignature, 0); + manager, *i, false, true, dependencies, nullptr, signature, + needsSignature, nullptr); } signature->append('>'); *needsSignature = true; @@ -285,7 +285,7 @@ SpecialType translateUnoTypeToDescriptor( sal_Int32 rank; std::vector< OUString > args; codemaker::UnoType::Sort sort = manager->decompose( - type, true, &nucleus, &rank, &args, 0); + type, true, &nucleus, &rank, &args, nullptr); return translateUnoTypeToDescriptor( manager, sort, nucleus, rank, args, array, classType, dependencies, descriptor, signature, needsSignature, polymorphicUnoType); @@ -296,7 +296,7 @@ SpecialType getFieldDescriptor( OUString const & type, OString * descriptor, OString * signature, PolymorphicUnoType * polymorphicUnoType) { - assert(descriptor != 0); + assert(descriptor != nullptr); OStringBuffer desc; OStringBuffer sig; bool needsSig = false; @@ -304,7 +304,7 @@ SpecialType getFieldDescriptor( manager, type, false, false, dependencies, &desc, &sig, &needsSig, polymorphicUnoType); *descriptor = desc.makeStringAndClear(); - if (signature != 0) { + if (signature != nullptr) { if (needsSig) { *signature = sig.makeStringAndClear(); } else { @@ -348,7 +348,7 @@ MethodDescriptor::MethodDescriptor( PolymorphicUnoType * polymorphicUnoType): m_manager(manager), m_dependencies(dependencies), m_needsSignature(false) { - assert(dependencies != 0); + assert(dependencies != nullptr); m_descriptorStart.append('('); m_signatureStart.append('('); OStringBuffer descEnd; @@ -360,7 +360,7 @@ MethodDescriptor::MethodDescriptor( &m_needsSignature, polymorphicUnoType); m_descriptorEnd = descEnd.makeStringAndClear(); m_signatureEnd = sigEnd.makeStringAndClear(); - if (specialReturnType != 0) { + if (specialReturnType != nullptr) { *specialReturnType = special; } } @@ -370,7 +370,7 @@ SpecialType MethodDescriptor::addParameter( PolymorphicUnoType * polymorphicUnoType) { return translateUnoTypeToDescriptor( - m_manager, type, array, false, dependency ? m_dependencies : 0, + m_manager, type, array, false, dependency ? m_dependencies : nullptr, &m_descriptorStart, &m_signatureStart, &m_needsSignature, polymorphicUnoType); } @@ -576,7 +576,7 @@ sal_uInt16 TypeInfo::generateCode( void TypeInfo::generatePolymorphicUnoTypeCode( ClassFile::Code & code, Dependencies * dependencies) const { - assert(dependencies != 0); + assert(dependencies != nullptr); assert(m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE); code.instrNew("com/sun/star/uno/Type"); code.instrDup(); @@ -643,7 +643,7 @@ void addTypeInfo( OString const & className, std::vector< TypeInfo > const & typeInfo, Dependencies * dependencies, ClassFile * classFile) { - assert(classFile != 0); + assert(classFile != nullptr); std::vector< TypeInfo >::size_type typeInfos = typeInfo.size(); if (typeInfos > SAL_MAX_INT32) { throw CannotDumpException( @@ -769,7 +769,7 @@ void handleEnumType( sal_Int32 value = i->first; if (last != SAL_MAX_INT32) { for (sal_Int32 j = last + 1; j < value; ++j) { - blocks.push_back(0); + blocks.push_back(nullptr); } } last = value; @@ -841,8 +841,8 @@ void addField( sal_Int32 typeParameterIndex, OUString const & type, OUString const & name, sal_Int32 index) { - assert(classFile != 0); - assert(typeInfo != 0); + assert(classFile != nullptr); + assert(typeInfo != nullptr); OString descriptor; OString signature; SpecialType specialType; @@ -872,7 +872,7 @@ sal_uInt16 addFieldInit( Dependencies * dependencies, ClassFile::Code * code) { assert(manager.is()); - assert(code != 0); + assert(code != nullptr); if (typeParameter) { return 0; } @@ -924,7 +924,7 @@ sal_uInt16 addFieldInit( OStringBuffer descBuf; translateUnoTypeToDescriptor( manager, sort, nucleus, 0, std::vector< OUString >(), false, - false, dependencies, &descBuf, 0, 0, 0); + false, dependencies, &descBuf, nullptr, nullptr, nullptr); OString desc(descBuf.makeStringAndClear()); code->instrGetstatic( codemaker::convertString(nucleus).replace('.', '/'), @@ -945,7 +945,7 @@ sal_uInt16 addFieldInit( OStringBuffer desc; translateUnoTypeToDescriptor( manager, sort, nucleus, 0, args, false, false, dependencies, - &desc, 0, 0, 0); + &desc, nullptr, nullptr, nullptr); code->instrPutfield(className, name, desc.makeStringAndClear()); return 3; } @@ -976,13 +976,13 @@ sal_uInt16 addFieldInit( OStringBuffer desc; translateUnoTypeToDescriptor( manager, sort, nucleus, rank - 1, std::vector< OUString >(), false, - false, dependencies, &desc, 0, 0, 0); + false, dependencies, &desc, nullptr, nullptr, nullptr); code->instrAnewarray(desc.makeStringAndClear()); } OStringBuffer desc; translateUnoTypeToDescriptor( manager, sort, nucleus, rank, std::vector< OUString >(), false, false, - dependencies, &desc, 0, 0, 0); + dependencies, &desc, nullptr, nullptr, nullptr); code->instrPutfield(className, name, desc.makeStringAndClear()); return 2; } @@ -993,10 +993,10 @@ sal_uInt16 addLoadLocal( Dependencies * dependencies) { assert(manager.is()); - assert(code != 0); - assert(index != 0); + assert(code != nullptr); + assert(index != nullptr); assert(!(typeParameter && any)); - assert(dependencies != 0); + assert(dependencies != nullptr); sal_uInt16 stack = 1; sal_uInt16 size = 1; if (typeParameter) { @@ -1007,7 +1007,7 @@ sal_uInt16 addLoadLocal( sal_Int32 rank; std::vector< OUString > args; codemaker::UnoType::Sort sort = manager->decompose( - type, true, &nucleus, &rank, &args, 0); + type, true, &nucleus, &rank, &args, nullptr); if (rank == 0) { switch (sort) { case codemaker::UnoType::SORT_BOOLEAN: @@ -1339,15 +1339,15 @@ sal_uInt16 addDirectArgument( sal_uInt16 * index, OString const & className, OString const & fieldName, bool typeParameter, OUString const & fieldType) { - assert(methodDescriptor != 0); - assert(code != 0); + assert(methodDescriptor != nullptr); + assert(code != nullptr); OString desc; if (typeParameter) { methodDescriptor->addTypeParameter(fieldType); desc = "Ljava/lang/Object;"; } else { - methodDescriptor->addParameter(fieldType, false, true, 0); - getFieldDescriptor(manager, dependencies, fieldType, &desc, 0, 0); + methodDescriptor->addParameter(fieldType, false, true, nullptr); + getFieldDescriptor(manager, dependencies, fieldType, &desc, nullptr, nullptr); } code->loadLocalReference(0); sal_uInt16 stack = addLoadLocal( @@ -1362,7 +1362,7 @@ void addPlainStructBaseArguments( OUString const & base, sal_uInt16 * index) { assert(manager.is()); - assert(methodDescriptor != 0); + assert(methodDescriptor != nullptr); rtl::Reference< unoidl::Entity > ent; if (manager->getSort(base, &ent) != codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE) @@ -1382,7 +1382,7 @@ void addPlainStructBaseArguments( ent2.getDirectMembers().begin()); i != ent2.getDirectMembers().end(); ++i) { - methodDescriptor->addParameter(i->type, false, true, 0); + methodDescriptor->addParameter(i->type, false, true, nullptr); addLoadLocal(manager, code, index, false, i->type, false, dependencies); } } @@ -1394,7 +1394,7 @@ void handlePlainStructType( Dependencies * dependencies) { assert(entity.is()); - assert(dependencies != 0); + assert(dependencies != nullptr); OString className(codemaker::convertString(name).replace('.', '/')); OString superClass; if (entity->getDirectBase().isEmpty()) { @@ -1438,7 +1438,7 @@ void handlePlainStructType( cf->addMethod( ClassFile::ACC_PUBLIC, "", "()V", code.get(), std::vector< OString >(), ""); - MethodDescriptor desc(manager, dependencies, "void", 0, 0); + MethodDescriptor desc(manager, dependencies, "void", nullptr, nullptr); code.reset(cf->newCode()); code->loadLocalReference(0); sal_uInt16 index2 = 1; @@ -1538,7 +1538,7 @@ void handlePolyStructType( cf->addMethod( ClassFile::ACC_PUBLIC, "", "()V", code.get(), std::vector< OString >(), ""); - MethodDescriptor desc(manager, dependencies, "void", 0, 0); + MethodDescriptor desc(manager, dependencies, "void", nullptr, nullptr); code.reset(cf->newCode()); code->loadLocalReference(0); sal_uInt16 index2 = 1; @@ -1570,7 +1570,7 @@ void addExceptionBaseArguments( OUString const & base, sal_uInt16 * index) { assert(manager.is()); - assert(methodDescriptor != 0); + assert(methodDescriptor != nullptr); rtl::Reference< unoidl::Entity > ent; if (manager->getSort(base, &ent) != codemaker::UnoType::SORT_EXCEPTION_TYPE) { @@ -1591,7 +1591,7 @@ void addExceptionBaseArguments( i != ent2.getDirectMembers().end(); ++i) { if (!baseException || i != ent2.getDirectMembers().begin()) { - methodDescriptor->addParameter(i->type, false, true, 0); + methodDescriptor->addParameter(i->type, false, true, nullptr); addLoadLocal( manager, code, index, false, i->type, false, dependencies); } @@ -1604,7 +1604,7 @@ void handleExceptionType( Dependencies * dependencies) { assert(entity.is()); - assert(dependencies != 0); + assert(dependencies != nullptr); OString className(codemaker::convertString(name).replace('.', '/')); bool baseException = false; bool baseRuntimeException = false; @@ -1780,12 +1780,12 @@ void handleExceptionType( // create (String Message, Object Context, T1 m1, ..., Tn mn) constructor - MethodDescriptor desc1(manager, dependencies, "void", 0, 0); + MethodDescriptor desc1(manager, dependencies, "void", nullptr, nullptr); code.reset(cf->newCode()); code->loadLocalReference(0); sal_uInt16 index2 = 1; code->loadLocalReference(index2++); - desc1.addParameter("string", false, true, 0); + desc1.addParameter("string", false, true, nullptr); if (!(baseException || baseRuntimeException)) { addExceptionBaseArguments( manager, dependencies, &desc1, code.get(), entity->getDirectBase(), @@ -1820,13 +1820,13 @@ void handleExceptionType( std::vector< OString >(), desc1.getSignature()); // create (Throwable Cause, String Message, Object Context, T1 m1, ..., Tn mn) constructor - MethodDescriptor desc2(manager, dependencies, "void", 0, 0); + MethodDescriptor desc2(manager, dependencies, "void", nullptr, nullptr); code.reset(cf->newCode()); code->loadLocalReference(0); sal_uInt16 index3 = 3; // Note that we hack in the java.lang.Throwable parameter further down, // because MethodDescriptor does not know how to handle it. - desc2.addParameter("string", false, true, 0); + desc2.addParameter("string", false, true, nullptr); if (baseException || baseRuntimeException) { code->loadLocalReference(2); code->loadLocalReference(1); @@ -1876,15 +1876,15 @@ void createExceptionsAttribute( Dependencies * dependencies, std::vector< OString > * exceptions, codemaker::ExceptionTree * tree) { - assert(dependencies != 0); - assert(exceptions != 0); + assert(dependencies != nullptr); + assert(exceptions != nullptr); for (std::vector< OUString >::const_iterator i(exceptionTypes.begin()); i != exceptionTypes.end(); ++i) { dependencies->insert(*i); OString type(codemaker::convertString(*i).replace('.', '/')); exceptions->push_back(type); - if (tree != 0) { + if (tree != nullptr) { tree->add(type.replace('/', '.'), manager); } } @@ -1896,7 +1896,7 @@ void handleInterfaceType( Dependencies * dependencies) { assert(entity.is()); - assert(dependencies != 0); + assert(dependencies != nullptr); OString className(codemaker::convertString(name).replace('.', '/')); std::unique_ptr< ClassFile > cf( new ClassFile( @@ -1931,23 +1931,23 @@ void handleInterfaceType( &polymorphicUnoType); std::vector< OString > exc; createExceptionsAttribute( - manager, i->getExceptions, dependencies, &exc, 0); + manager, i->getExceptions, dependencies, &exc, nullptr); OString attrName(codemaker::convertString(i->name)); cf->addMethod( static_cast< ClassFile::AccessFlags >( ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT), - "get" + attrName, gdesc.getDescriptor(), 0, exc, + "get" + attrName, gdesc.getDescriptor(), nullptr, exc, gdesc.getSignature()); if (!i->readOnly) { - MethodDescriptor sdesc(manager, dependencies, "void", 0, 0); - sdesc.addParameter(i->type, false, true, 0); + MethodDescriptor sdesc(manager, dependencies, "void", nullptr, nullptr); + sdesc.addParameter(i->type, false, true, nullptr); std::vector< OString > exc2; createExceptionsAttribute( - manager, i->setExceptions, dependencies, &exc2, 0); + manager, i->setExceptions, dependencies, &exc2, nullptr); cf->addMethod( static_cast< ClassFile::AccessFlags >( ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT), - "set" + attrName, sdesc.getDescriptor(), 0, exc2, + "set" + attrName, sdesc.getDescriptor(), nullptr, exc2, sdesc.getSignature()); } typeInfo.push_back( @@ -2000,11 +2000,11 @@ void handleInterfaceType( } std::vector< OString > exc2; createExceptionsAttribute( - manager, i->exceptions, dependencies, &exc2, 0); + manager, i->exceptions, dependencies, &exc2, nullptr); cf->addMethod( static_cast< ClassFile::AccessFlags >( ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT), - methodName, desc.getDescriptor(), 0, exc2, desc.getSignature()); + methodName, desc.getDescriptor(), nullptr, exc2, desc.getSignature()); } } addTypeInfo(className, typeInfo, dependencies, cf.get()); @@ -2017,9 +2017,9 @@ void handleTypedef( { assert(entity.is()); assert(manager.is()); - assert(dependencies != 0); + assert(dependencies != nullptr); OUString nucleus; - switch (manager->decompose(entity->getType(), false, &nucleus, 0, 0, 0)) + switch (manager->decompose(entity->getType(), false, &nucleus, nullptr, nullptr, nullptr)) { case codemaker::UnoType::SORT_BOOLEAN: case codemaker::UnoType::SORT_BYTE: @@ -2112,7 +2112,7 @@ void handleConstantGroup( } OString desc; OString sig; - getFieldDescriptor(manager, dependencies, type, &desc, &sig, 0); + getFieldDescriptor(manager, dependencies, type, &desc, &sig, nullptr); cf->addField( static_cast< ClassFile::AccessFlags >( ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC @@ -2127,8 +2127,8 @@ void addExceptionHandlers( ClassFile::Code::Position start, ClassFile::Code::Position end, ClassFile::Code::Position handler, ClassFile::Code * code) { - assert(node != 0); - assert(code != 0); + assert(node != nullptr); + assert(code != nullptr); if (node->present) { code->addException(start, end, handler, node->name.replace('.', '/')); } else { @@ -2149,10 +2149,10 @@ void addConstructor( OUString const & returnType, Dependencies * dependencies, ClassFile * classFile) { - assert(dependencies != 0); - assert(classFile != 0); - MethodDescriptor desc(manager, dependencies, returnType, 0, 0); - desc.addParameter("com.sun.star.uno.XComponentContext", false, false, 0); + assert(dependencies != nullptr); + assert(classFile != nullptr); + MethodDescriptor desc(manager, dependencies, returnType, nullptr, nullptr); + desc.addParameter("com.sun.star.uno.XComponentContext", false, false, nullptr); std::unique_ptr< ClassFile::Code > code(classFile->newCode()); code->loadLocalReference(0); // stack: context @@ -2187,7 +2187,7 @@ void addConstructor( if (constructor.parameters.size() == 1 && constructor.parameters[0].rest) { - desc.addParameter("any", true, true, 0); + desc.addParameter("any", true, true, nullptr); code->loadLocalReference(localIndex++); // stack: factory serviceName args stack = 4; @@ -2206,7 +2206,7 @@ void addConstructor( constructor.parameters.begin()); i != constructor.parameters.end(); ++i) { - desc.addParameter(i->type, false, true, 0); + desc.addParameter(i->type, false, true, nullptr); code->instrDup(); // stack: factory serviceName args args code->loadIntegerConstant(n++); @@ -2302,7 +2302,7 @@ void handleService( Dependencies * dependencies) { assert(entity.is()); - assert(dependencies != 0); + assert(dependencies != nullptr); OString unoName(codemaker::convertString(name)); OString className( translateUnoidlEntityNameToJavaFullyQualifiedName(name, "service")); @@ -2397,7 +2397,7 @@ void handleSingleton( Dependencies * dependencies) { assert(entity.is()); - assert(dependencies != 0); + assert(dependencies != nullptr); OString realJavaBaseName(codemaker::convertString(entity->getBase())); OString base(realJavaBaseName.replace('.', '/')); dependencies->insert(entity->getBase()); @@ -2413,8 +2413,8 @@ void handleSingleton( ClassFile::ACC_PUBLIC | ClassFile::ACC_FINAL | ClassFile::ACC_SUPER), className, "java/lang/Object", "")); - MethodDescriptor desc(manager, dependencies, entity->getBase(), 0, 0); - desc.addParameter("com.sun.star.uno.XComponentContext", false, false, 0); + MethodDescriptor desc(manager, dependencies, entity->getBase(), nullptr, nullptr); + desc.addParameter("com.sun.star.uno.XComponentContext", false, false, nullptr); std::unique_ptr< ClassFile::Code > code(cf->newCode()); code->loadLocalReference(0); // stack: context diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx index 48c071dfbed1..e09b387cd92e 100644 --- a/include/codemaker/commoncpp.hxx +++ b/include/codemaker/commoncpp.hxx @@ -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); } } diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx index d9bb4d83d5af..0d57a7ef80ff 100644 --- a/include/codemaker/typemanager.hxx +++ b/include/codemaker/typemanager.hxx @@ -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, diff --git a/include/codemaker/unotype.hxx b/include/codemaker/unotype.hxx index 6c747dda8068..ef2859c1dee1 100644 --- a/include/codemaker/unotype.hxx +++ b/include/codemaker/unotype.hxx @@ -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); } } -- cgit