diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:12:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:20 +0100 |
commit | 4730b58d9989512ed25790768ba78decfde7d667 (patch) | |
tree | 2d53902a514a0f69a70dc0bc7bebe6d39290e1be | |
parent | 311fd06af4e297fa748684a61edd3ee38845c485 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I17eb40b2923793280ea220e519f97563c8490a19
35 files changed, 535 insertions, 535 deletions
diff --git a/cppu/qa/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx index a775bcf7990e..c481b7707f6a 100644 --- a/cppu/qa/cppumaker/test_cppumaker.cxx +++ b/cppu/qa/cppumaker/test_cppumaker.cxx @@ -472,11 +472,11 @@ void Test::testBigStruct() { css::uno::Type t( cppu::UnoType< test::codemaker::cppumaker::BigStruct >::get()); - typelib_TypeDescription * td = NULL; + typelib_TypeDescription * td = nullptr; t.getDescription(&td); typelib_typedescription_complete(&td); fprintf(stdout, "#### 1\n"); - CPPUNIT_ASSERT(td != NULL); + CPPUNIT_ASSERT(td != nullptr); CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_STRUCT, +td->eTypeClass); typelib_StructTypeDescription * std = reinterpret_cast< typelib_StructTypeDescription * >(td); @@ -506,7 +506,7 @@ void Test::testExceptions() { aEmptySequence; test::codemaker::cppumaker::TestException1 e11( - rtl::OUString("abc"), 0, 1, + rtl::OUString("abc"), nullptr, 1, css::uno::makeAny(123.0), test::codemaker::cppumaker::HelperEnum_ONE, test::codemaker::cppumaker::Struct<sal_Int32, sal_Int32>(5, aEmptySequence), 2); @@ -516,7 +516,7 @@ void Test::testExceptions() { e13 = e11; CPPUNIT_ASSERT_EQUAL(e11, e13); test::codemaker::cppumaker::TestException2 e21( - rtl::OUString("abc"), 0, 1, + rtl::OUString("abc"), nullptr, 1, css::uno::makeAny(123.0), test::codemaker::cppumaker::HelperEnum_ONE, test::codemaker::cppumaker::Struct<sal_Int32, sal_Int32>(5, aEmptySequence), 2); diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx index 053b155628f1..88ced4b5c17c 100644 --- a/cppu/qa/test_unotype.cxx +++ b/cppu/qa/test_unotype.cxx @@ -93,8 +93,8 @@ public: void Test::testUnoType() { // Avoid warnings about unused ~DerivedInterface1/2 (see above): if (false) { - DerivedInterface1::dummy(0); - DerivedInterface2::dummy(0); + DerivedInterface1::dummy(nullptr); + DerivedInterface2::dummy(nullptr); } css::uno::Type t; @@ -276,161 +276,161 @@ void Test::testGetTypeFavourUnsigned() { // ::getCppuType(static_cast< ::sal_uInt16 * >(0))); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< ::cppu::UnoVoidType * >(0)) == + static_cast< ::cppu::UnoVoidType * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoVoidType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< bool * >(nullptr)) == ::cppu::UnoType< bool >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< sal_Bool * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< sal_Bool * >(nullptr)) == ::cppu::UnoType< bool >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8 * >(nullptr)) == ::cppu::UnoType< ::sal_Int8 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16 * >(nullptr)) == ::cppu::UnoType< ::sal_Int16 >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< ::cppu::UnoUnsignedShortType * >(0)) == + static_cast< ::cppu::UnoUnsignedShortType * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16 * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32 * >(nullptr)) == ::cppu::UnoType< ::sal_Int32 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32 * >(nullptr)) == ::cppu::UnoType< ::sal_uInt32 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64 * >(nullptr)) == ::cppu::UnoType< ::sal_Int64 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64 * >(nullptr)) == ::cppu::UnoType< ::sal_uInt64 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< float * >(nullptr)) == ::cppu::UnoType< float >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< double * >(nullptr)) == ::cppu::UnoType< double >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< ::cppu::UnoCharType * >(0)) == + static_cast< ::cppu::UnoCharType * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoCharType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString * >(nullptr)) == ::cppu::UnoType< ::rtl::OUString >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type * >(nullptr)) == ::cppu::UnoType< css::uno::Type >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any * >(nullptr)) == ::cppu::UnoType< css::uno::Any >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( static_cast< - ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > * >(0)) == + ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::Sequence< ::sal_uInt16 > * >(0)) == + static_cast< css::uno::Sequence< ::sal_uInt16 > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( static_cast< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< - ::cppu::UnoUnsignedShortType > > * >(0)) == + ::cppu::UnoUnsignedShortType > > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( static_cast< css::uno::Sequence< css::uno::Sequence< - ::sal_uInt16 > > * >(0)) == + ::sal_uInt16 > > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::Sequence< ::sal_Unicode > * >(0)) == + static_cast< css::uno::Sequence< ::sal_Unicode > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( static_cast< css::uno::Sequence< css::uno::Sequence< - ::sal_Unicode > > * >(0)) == + ::sal_Unicode > > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::TypeClass * >(0)) == + static_cast< css::uno::TypeClass * >(nullptr)) == ::cppu::UnoType< css::uno::TypeClass >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::lang::EventObject * >(0)) == + static_cast< css::lang::EventObject * >(nullptr)) == ::cppu::UnoType< css::lang::EventObject >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1 * >(nullptr)) == ::cppu::UnoType< css::lang::EventObject >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::beans::PropertyChangeEvent * >(0)) == + static_cast< css::beans::PropertyChangeEvent * >(nullptr)) == ::cppu::UnoType< css::beans::PropertyChangeEvent >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2 * >(nullptr)) == ::cppu::UnoType< css::beans::PropertyChangeEvent >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::beans::Optional< ::sal_Int8 > * >(0)) == + static_cast< css::beans::Optional< ::sal_Int8 > * >(nullptr)) == ::cppu::UnoType< css::beans::Optional< ::sal_Int8 > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::Exception * >(0)) == + static_cast< css::uno::Exception * >(nullptr)) == ::cppu::UnoType< css::uno::Exception >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1 * >(nullptr)) == ::cppu::UnoType< css::uno::Exception >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::RuntimeException * >(0)) == + static_cast< css::uno::RuntimeException * >(nullptr)) == ::cppu::UnoType< css::uno::RuntimeException >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2 * >(nullptr)) == ::cppu::UnoType< css::uno::RuntimeException >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::XInterface * >(0)) == + static_cast< css::uno::XInterface * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::Reference< css::uno::XInterface > * >(0)) == + static_cast< css::uno::Reference< css::uno::XInterface > * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1 * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::Reference< DerivedInterface1 > * >(0)) == + static_cast< css::uno::Reference< DerivedInterface1 > * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::XComponentContext * >(0)) == + static_cast< css::uno::XComponentContext * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( static_cast< - css::uno::Reference< css::uno::XComponentContext > * >(0)) == + css::uno::Reference< css::uno::XComponentContext > * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2 * >(0)) == + ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2 * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourUnsigned( - static_cast< css::uno::Reference< DerivedInterface2 > * >(0)) == + static_cast< css::uno::Reference< DerivedInterface2 > * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); } @@ -439,158 +439,158 @@ void Test::testGetTypeFavourChar() { // CPPUNIT_ASSERT( // ::getCppuType< ::sal_Unicode >() == ::getCppuType< ::sal_uInt16 >()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoVoidType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< bool * >(0)) == + ::cppu::getTypeFavourChar(static_cast< bool * >(nullptr)) == ::cppu::UnoType< bool >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< sal_Bool * >(0)) == + ::cppu::getTypeFavourChar(static_cast< sal_Bool * >(nullptr)) == ::cppu::UnoType< bool >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_Int8 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_Int8 * >(nullptr)) == ::cppu::UnoType< ::sal_Int8 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_Int16 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_Int16 * >(nullptr)) == ::cppu::UnoType< ::sal_Int16 >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< ::cppu::UnoUnsignedShortType * >(0)) == + static_cast< ::cppu::UnoUnsignedShortType * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16 * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoCharType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_Int32 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_Int32 * >(nullptr)) == ::cppu::UnoType< ::sal_Int32 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32 * >(nullptr)) == ::cppu::UnoType< ::sal_uInt32 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_Int64 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_Int64 * >(nullptr)) == ::cppu::UnoType< ::sal_Int64 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64 * >(nullptr)) == ::cppu::UnoType< ::sal_uInt64 >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< float * >(0)) == + ::cppu::getTypeFavourChar(static_cast< float * >(nullptr)) == ::cppu::UnoType< float >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< double * >(0)) == + ::cppu::getTypeFavourChar(static_cast< double * >(nullptr)) == ::cppu::UnoType< double >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoCharType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoCharType >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString * >(0)) == + ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString * >(nullptr)) == ::cppu::UnoType< ::rtl::OUString >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< css::uno::Type * >(0)) == + ::cppu::getTypeFavourChar(static_cast< css::uno::Type * >(nullptr)) == ::cppu::UnoType< css::uno::Type >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< css::uno::Any * >(0)) == + ::cppu::getTypeFavourChar(static_cast< css::uno::Any * >(nullptr)) == ::cppu::UnoType< css::uno::Any >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( static_cast< - ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > * >(0)) == + ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::Sequence< ::sal_uInt16 > * >(0)) == + static_cast< css::uno::Sequence< ::sal_uInt16 > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( static_cast< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< - ::cppu::UnoUnsignedShortType > > * >(0)) == + ::cppu::UnoUnsignedShortType > > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( static_cast< css::uno::Sequence< css::uno::Sequence< - ::sal_uInt16 > > * >(0)) == + ::sal_uInt16 > > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::Sequence< ::sal_Unicode > * >(0)) == + static_cast< css::uno::Sequence< ::sal_Unicode > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( static_cast< css::uno::Sequence< css::uno::Sequence< - ::sal_Unicode > > * >(0)) == + ::sal_Unicode > > * >(nullptr)) == ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > > >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass * >(0)) == + ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass * >(nullptr)) == ::cppu::UnoType< css::uno::TypeClass >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::lang::EventObject * >(0)) == + static_cast< css::lang::EventObject * >(nullptr)) == ::cppu::UnoType< css::lang::EventObject >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< DerivedStruct1 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< DerivedStruct1 * >(nullptr)) == ::cppu::UnoType< css::lang::EventObject >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::beans::PropertyChangeEvent * >(0)) == + static_cast< css::beans::PropertyChangeEvent * >(nullptr)) == ::cppu::UnoType< css::beans::PropertyChangeEvent >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< DerivedStruct2 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< DerivedStruct2 * >(nullptr)) == ::cppu::UnoType< css::beans::PropertyChangeEvent >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::beans::Optional< ::sal_Int8 > * >(0)) == + static_cast< css::beans::Optional< ::sal_Int8 > * >(nullptr)) == ::cppu::UnoType< css::beans::Optional< ::sal_Int8 > >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< css::uno::Exception * >(0)) == + ::cppu::getTypeFavourChar(static_cast< css::uno::Exception * >(nullptr)) == ::cppu::UnoType< css::uno::Exception >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< DerivedException1 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< DerivedException1 * >(nullptr)) == ::cppu::UnoType< css::uno::Exception >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::RuntimeException * >(0)) == + static_cast< css::uno::RuntimeException * >(nullptr)) == ::cppu::UnoType< css::uno::RuntimeException >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< DerivedException2 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< DerivedException2 * >(nullptr)) == ::cppu::UnoType< css::uno::RuntimeException >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::XInterface * >(0)) == + static_cast< css::uno::XInterface * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::Reference< css::uno::XInterface > * >(0)) == + static_cast< css::uno::Reference< css::uno::XInterface > * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< DerivedInterface1 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< DerivedInterface1 * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::Reference< DerivedInterface1 > * >(0)) == + static_cast< css::uno::Reference< DerivedInterface1 > * >(nullptr)) == ::cppu::UnoType< css::uno::XInterface >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::XComponentContext * >(0)) == + static_cast< css::uno::XComponentContext * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( static_cast< - css::uno::Reference< css::uno::XComponentContext > * >(0)) == + css::uno::Reference< css::uno::XComponentContext > * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); CPPUNIT_ASSERT( - ::cppu::getTypeFavourChar(static_cast< DerivedInterface2 * >(0)) == + ::cppu::getTypeFavourChar(static_cast< DerivedInterface2 * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); CPPUNIT_ASSERT( ::cppu::getTypeFavourChar( - static_cast< css::uno::Reference< DerivedInterface2 > * >(0)) == + static_cast< css::uno::Reference< DerivedInterface2 > * >(nullptr)) == ::cppu::UnoType< css::uno::XComponentContext >::get()); } diff --git a/cppu/source/AffineBridge/AffineBridge.cxx b/cppu/source/AffineBridge/AffineBridge.cxx index 85463261627a..2fa80655ebcd 100644 --- a/cppu/source/AffineBridge/AffineBridge.cxx +++ b/cppu/source/AffineBridge/AffineBridge.cxx @@ -132,20 +132,20 @@ void OuterThread::run() m_pAffineBridge->outerDispatch(0); m_pAffineBridge->m_outerThreadId = 0; - m_pAffineBridge->m_pOuterThread = NULL; - m_pAffineBridge = NULL; + m_pAffineBridge->m_pOuterThread = nullptr; + m_pAffineBridge = nullptr; } AffineBridge::AffineBridge() : m_message (CB_DONE), - m_pCallee (0), - m_pParam (0), + m_pCallee (nullptr), + m_pParam (nullptr), m_innerThreadId(0), - m_pInnerThread (NULL), + m_pInnerThread (nullptr), m_enterCount (0), m_outerThreadId(0), - m_pOuterThread (NULL) + m_pOuterThread (nullptr) { LOG_LIFECYCLE_AffineBridge_emit(fprintf(stderr, "LIFE: %s -> %p\n", "AffineBridge::AffineBridge(uno_Environment * pEnv)", this)); } diff --git a/cppu/source/LogBridge/LogBridge.cxx b/cppu/source/LogBridge/LogBridge.cxx index edbdad8460b4..e791e7a5be94 100644 --- a/cppu/source/LogBridge/LogBridge.cxx +++ b/cppu/source/LogBridge/LogBridge.cxx @@ -236,7 +236,7 @@ void LogProbe( if ( ppException && *ppException ) { SAL_INFO("cppu.log", " exception occurred : "); - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, (*ppException)->pType ); const ::rtl::OString sValue( ::rtl::OUStringToOString(pElementTypeDescr->pTypeName,osl_getThreadTextEncoding())); SAL_INFO("cppu.log", "" << sValue.getStr()); diff --git a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx index e20206fd27fe..1e316c7f2550 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx @@ -275,7 +275,7 @@ Base::~Base() m_pEnv->acquireWeak = m_env_acquireWeak; m_pEnv->releaseWeak = m_env_releaseWeak; - m_pEnv->pReserved = NULL; + m_pEnv->pReserved = nullptr; delete m_pEnterable; m_pEnv->release(m_pEnv); diff --git a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx index 20c121b8d037..8f46ce7a875a 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx @@ -150,7 +150,7 @@ void Mapping::mapInterface( if (*ppOut) { (*ppOut)->release(*ppOut); - *ppOut = 0; + *ppOut = nullptr; } if (!pUnoI) @@ -158,7 +158,7 @@ void Mapping::mapInterface( // get object id of uno interface to be wrapped // need to enter environment because of potential "queryInterface" call - rtl_uString * pOId = 0; + rtl_uString * pOId = nullptr; uno_Environment_invoke(m_from.get(), s_getIdentifier_v, m_from.get(), &pOId, pUnoI); OSL_ASSERT(pOId); @@ -197,7 +197,7 @@ void Mapping::acquire() { uno_Mapping * pMapping = this; - ::uno_registerMapping(&pMapping, s_free, m_from.get(), m_to.get(), NULL); + ::uno_registerMapping(&pMapping, s_free, m_from.get(), m_to.get(), nullptr); } } @@ -219,7 +219,7 @@ void createMapping(uno_Mapping ** ppMapping, { *ppMapping = new Mapping(pFrom, pTo, probeFun, pContext); - ::uno_registerMapping(ppMapping, s_free, pFrom, pTo, NULL); + ::uno_registerMapping(ppMapping, s_free, pFrom, pTo, nullptr); } }}} diff --git a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx index 90ee6b052a6f..2c0b789de0fb 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx @@ -56,7 +56,7 @@ static bool relatesToInterface(typelib_TypeDescription * pTypeDescr) case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType ); bool bRel = relatesToInterface( pTD ); TYPELIB_DANGER_RELEASE( pTD ); @@ -85,7 +85,7 @@ static bool relatesToInterface(typelib_TypeDescription * pTypeDescr) case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, pTypes[nPos] ); bool bRel = relatesToInterface( pTD ); TYPELIB_DANGER_RELEASE( pTD ); @@ -122,8 +122,8 @@ extern "C" { static void SAL_CALL s_Proxy_dispatch( typelib_MethodParameter param; sal_Int32 nParams = 0; - typelib_MethodParameter * pParams = 0; - typelib_TypeDescriptionReference * pReturnTypeRef = 0; + typelib_MethodParameter * pParams = nullptr; + typelib_TypeDescriptionReference * pReturnTypeRef = nullptr; // sal_Int32 nOutParams = 0; switch (pMemberType->eTypeClass) @@ -135,7 +135,7 @@ extern "C" { static void SAL_CALL s_Proxy_dispatch( reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>( pMemberType)->pAttributeTypeRef; nParams = 0; - pParams = NULL; + pParams = nullptr; } else { @@ -260,7 +260,7 @@ static uno::TypeDescription getAcquireMethod() typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE); - typelib_TypeDescription * pTXInterfaceDescr = 0; + typelib_TypeDescription * pTXInterfaceDescr = nullptr; TYPELIB_DANGER_GET (&pTXInterfaceDescr, type_XInterface); uno::TypeDescription acquire( reinterpret_cast< typelib_InterfaceTypeDescription * >( @@ -275,7 +275,7 @@ static uno::TypeDescription getReleaseMethod() typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE); - typelib_TypeDescription * pTXInterfaceDescr = 0; + typelib_TypeDescription * pTXInterfaceDescr = nullptr; TYPELIB_DANGER_GET (&pTXInterfaceDescr, type_XInterface); uno::TypeDescription release( reinterpret_cast< typelib_InterfaceTypeDescription * >( @@ -295,12 +295,12 @@ void Proxy::acquire() this, m_pProbeContext, *typelib_static_type_getByTypeClass(typelib_TypeClass_VOID), - NULL, + nullptr, 0, s_acquireMethod.get(), - NULL, - NULL, - NULL); + nullptr, + nullptr, + nullptr); if (osl_atomic_increment(&m_nRef) == 1) { @@ -319,12 +319,12 @@ void Proxy::acquire() this, m_pProbeContext, *typelib_static_type_getByTypeClass(typelib_TypeClass_VOID), - NULL, + nullptr, 0, s_acquireMethod.get(), - NULL, - NULL, - NULL); + nullptr, + nullptr, + nullptr); } @@ -338,12 +338,12 @@ void Proxy::release() this, m_pProbeContext, *typelib_static_type_getByTypeClass(typelib_TypeClass_VOID), - NULL, + nullptr, 0, s_releaseMethod.get(), - NULL, - NULL, - NULL); + nullptr, + nullptr, + nullptr); if (osl_atomic_decrement(&m_nRef) == 0) m_from.get()->pExtEnv->revokeInterface(m_from.get()->pExtEnv, this); @@ -353,12 +353,12 @@ void Proxy::release() this, pProbeContext, *typelib_static_type_getByTypeClass(typelib_TypeClass_VOID), - NULL, + nullptr, 0, s_releaseMethod.get(), - NULL, - NULL, - NULL); + nullptr, + nullptr, + nullptr); } @@ -369,7 +369,7 @@ static void s_type_destructData_v(va_list * pParam) void * ret = va_arg(*pParam, void *); typelib_TypeDescriptionReference * pReturnTypeRef = va_arg(*pParam, typelib_TypeDescriptionReference *); - uno_type_destructData(ret, pReturnTypeRef, 0); + uno_type_destructData(ret, pReturnTypeRef, nullptr); } static void s_dispatcher_v(va_list * pParam) @@ -406,7 +406,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, void ** args = static_cast<void **>(alloca( sizeof (void *) * nParams )); - typelib_TypeDescription * return_td = 0; + typelib_TypeDescription * return_td = nullptr; void * ret = pReturn; if (pReturnTypeRef) { @@ -421,7 +421,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, for (sal_Int32 nPos = 0; nPos < nParams; ++ nPos) { typelib_MethodParameter const & param = pParams[nPos]; - typelib_TypeDescription * td = 0; + typelib_TypeDescription * td = nullptr; TYPELIB_DANGER_GET( &td, param.pTypeRef ); if (relatesToInterface(td)) { @@ -444,7 +444,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, // do the UNO call... uno_Environment_invoke(m_to.get(), s_dispatcher_v, m_pUnoI, pMemberType, ret, args, &exc); - if (exc == 0) + if (exc == nullptr) { for (sal_Int32 nPos = 0; nPos < nParams; ++ nPos) { @@ -455,7 +455,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, { if (param.bIn) // is inout { - uno_type_destructData(pArgs[nPos], param.pTypeRef, 0); + uno_type_destructData(pArgs[nPos], param.pTypeRef, nullptr); } uno_type_copyAndConvertData(pArgs[ nPos ], args[ nPos ], @@ -475,7 +475,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, uno_Environment_invoke(m_to.get(), s_type_destructData_v, ret, pReturnTypeRef, 0); } - *ppException = 0; + *ppException = nullptr; } else // exception occurred { @@ -497,7 +497,7 @@ void Proxy::dispatch(typelib_TypeDescriptionReference * pReturnTypeRef, m_to_from.get()); // FIXME: need to destruct in m_to - uno_any_destruct(exc, 0); + uno_any_destruct(exc, nullptr); } if (m_probeFun) diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx index cc313cdf925a..084e82b2f07f 100644 --- a/cppu/source/threadpool/current.cxx +++ b/cppu/source/threadpool/current.cxx @@ -42,15 +42,15 @@ namespace cppu static typelib_InterfaceTypeDescription * get_type_XCurrentContext() { - static typelib_InterfaceTypeDescription * s_type_XCurrentContext = 0; - if (0 == s_type_XCurrentContext) + static typelib_InterfaceTypeDescription * s_type_XCurrentContext = nullptr; + if (nullptr == s_type_XCurrentContext) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (0 == s_type_XCurrentContext) + if (nullptr == s_type_XCurrentContext) { OUString sTypeName("com.sun.star.uno.XCurrentContext"); - typelib_InterfaceTypeDescription * pTD = 0; - typelib_TypeDescriptionReference * pMembers[1] = { 0 }; + typelib_InterfaceTypeDescription * pTD = nullptr; + typelib_TypeDescriptionReference * pMembers[1] = { nullptr }; OUString sMethodName0("com.sun.star.uno.XCurrentContext::getValueByName"); typelib_typedescriptionreference_new( &pMembers[0], @@ -66,7 +66,7 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext() typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pTD) ); typelib_typedescriptionreference_release( pMembers[0] ); - typelib_InterfaceMethodTypeDescription * pMethod = 0; + typelib_InterfaceMethodTypeDescription * pMethod = nullptr; typelib_Parameter_Init aParameters[1]; OUString sParamName0("Name"); OUString sParamType0("string"); @@ -122,7 +122,7 @@ public: explicit ThreadKey( oslThreadKeyCallbackFunction pCallback ) : _bInit(false) - , _hThreadKey(0) + , _hThreadKey(nullptr) , _pCallback(pCallback) { } @@ -166,8 +166,8 @@ IdContainer * getIdContainer() if (! pId) { pId = new IdContainer(); - pId->pCurrentContext = 0; - pId->pCurrentContextEnv = 0; + pId->pCurrentContext = nullptr; + pId->pCurrentContextEnv = nullptr; pId->bInit = false; ::osl_setThreadKeyData( aKey, pId ); } @@ -192,14 +192,14 @@ extern "C" sal_Bool SAL_CALL uno_setCurrentContext( pId->pCurrentContextEnv, pId->pCurrentContext ); (*pId->pCurrentContextEnv->aBase.release)( &pId->pCurrentContextEnv->aBase ); - pId->pCurrentContextEnv = 0; + pId->pCurrentContextEnv = nullptr; - pId->pCurrentContext = 0; + pId->pCurrentContext = nullptr; } if (pCurrentContext) { - uno_Environment * pEnv = 0; + uno_Environment * pEnv = nullptr; ::uno_getEnvironment( &pEnv, pEnvTypeName, pEnvContext ); OSL_ASSERT( pEnv && pEnv->pExtEnv ); if (pEnv) @@ -242,16 +242,16 @@ extern "C" sal_Bool SAL_CALL uno_getCurrentContext( if (! target_env.is()) return sal_False; uno_ExtEnvironment * pEnv = target_env.get()->pExtEnv; - OSL_ASSERT( 0 != pEnv ); - if (0 == pEnv) + OSL_ASSERT( nullptr != pEnv ); + if (nullptr == pEnv) return sal_False; (*pEnv->releaseInterface)( pEnv, *ppCurrentContext ); - *ppCurrentContext = 0; + *ppCurrentContext = nullptr; } // case: null-ref - if (0 == pId->pCurrentContext) + if (nullptr == pId->pCurrentContext) return sal_True; if (! target_env.is()) diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx index c0fdd6249383..094a55ef9372 100644 --- a/cppu/source/threadpool/jobqueue.cxx +++ b/cppu/source/threadpool/jobqueue.cxx @@ -47,13 +47,13 @@ namespace cppu_threadpool { void *JobQueue::enter( sal_Int64 nDisposeId , bool bReturnWhenNoJob ) { - void *pReturn = 0; + void *pReturn = nullptr; { // synchronize with the dispose calls MutexGuard guard( m_mutex ); if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) ) { - return 0; + return nullptr; } m_lstCallstack.push_front( nDisposeId ); } @@ -72,7 +72,7 @@ namespace cppu_threadpool { m_cndWait.wait(); - struct Job job={0,0}; + struct Job job={nullptr,nullptr}; { // synchronize with add and dispose calls MutexGuard guard( m_mutex ); diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx index ead78c3080f1..3b95c8d5d5bb 100644 --- a/cppu/source/threadpool/thread.cxx +++ b/cppu/source/threadpool/thread.cxx @@ -180,7 +180,7 @@ namespace cppu_threadpool { } delete m_pQueue; - m_pQueue = 0; + m_pQueue = nullptr; if( ! m_bAsynchron ) { diff --git a/cppu/source/threadpool/threadident.cxx b/cppu/source/threadpool/threadident.cxx index dcf6d1fe9475..87daa491342c 100644 --- a/cppu/source/threadpool/threadident.cxx +++ b/cppu/source/threadpool/threadident.cxx @@ -100,7 +100,7 @@ extern "C" sal_Bool SAL_CALL uno_bindIdToCurrentThread( sal_Sequence *pThreadId IdContainer *p = getIdContainer(); if( ! p->bInit ) { - p->pLocalThreadId = 0; + p->pLocalThreadId = nullptr; createLocalId( &(p->pLocalThreadId) ); p->nRefCountOfCurrentId = 1; p->pCurrentId = pThreadId; diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx index 9868d0cd64b5..42a4ff0ff8a5 100644 --- a/cppu/source/threadpool/threadpool.cxx +++ b/cppu/source/threadpool/threadpool.cxx @@ -193,7 +193,7 @@ namespace cppu_threadpool // inform the thread and let it go struct WaitingThread *pWaitingThread = m_lstThreads.back(); pWaitingThread->thread->setTask( pQueue , aThreadId , bAsynchron ); - pWaitingThread->thread = 0; + pWaitingThread->thread = nullptr; // remove from list m_lstThreads.pop_back(); @@ -224,7 +224,7 @@ namespace cppu_threadpool return false; } - (*ii).second.second = 0; + (*ii).second.second = nullptr; if( (*ii).second.first ) { // all oneway request have been processed, now @@ -239,10 +239,10 @@ namespace cppu_threadpool // another thread has put something into the queue return false; } - (*ii).second.first = 0; + (*ii).second.first = nullptr; } - if( 0 == (*ii).second.first && 0 == (*ii).second.second ) + if( nullptr == (*ii).second.first && nullptr == (*ii).second.second ) { m_mapQueue.erase( ii ); } @@ -258,7 +258,7 @@ namespace cppu_threadpool RequestFun * doRequest ) { bool bCreateThread = false; - JobQueue *pQueue = 0; + JobQueue *pQueue = nullptr; { MutexGuard guard( m_mutex ); @@ -311,7 +311,7 @@ namespace cppu_threadpool JobQueue *p = new JobQueue(); m_mapQueue[ aThreadId ] = pair< JobQueue * , JobQueue * > ( p , nullptr ); } - else if( 0 == (*ii).second.first ) + else if( nullptr == (*ii).second.first ) { (*ii).second.first = new JobQueue(); } @@ -319,7 +319,7 @@ namespace cppu_threadpool void * ThreadPool::enter( const ByteSequence & aThreadId , sal_Int64 nDisposeId ) { - JobQueue *pQueue = 0; + JobQueue *pQueue = nullptr; { MutexGuard guard( m_mutex ); @@ -385,7 +385,7 @@ namespace { ThreadPoolHolder getThreadPool( uno_ThreadPool hPool ) { MutexGuard guard( Mutex::getGlobalMutex() ); - assert( g_pThreadpoolHashSet != 0 ); + assert( g_pThreadpoolHashSet != nullptr ); ThreadpoolHashSet::iterator i( g_pThreadpoolHashSet->find(hPool) ); assert( i != g_pThreadpoolHashSet->end() ); return i->second; @@ -418,7 +418,7 @@ uno_threadpool_create() SAL_THROW_EXTERN_C() extern "C" void SAL_CALL uno_threadpool_attach( uno_ThreadPool hPool ) SAL_THROW_EXTERN_C() { - sal_Sequence *pThreadId = 0; + sal_Sequence *pThreadId = nullptr; uno_getIdOfCurrentThread( &pThreadId ); getThreadPool( hPool )->prepare( pThreadId ); rtl_byte_sequence_release( pThreadId ); @@ -429,7 +429,7 @@ extern "C" void SAL_CALL uno_threadpool_enter( uno_ThreadPool hPool , void **ppJob ) SAL_THROW_EXTERN_C() { - sal_Sequence *pThreadId = 0; + sal_Sequence *pThreadId = nullptr; uno_getIdOfCurrentThread( &pThreadId ); *ppJob = getThreadPool( hPool )->enter( @@ -493,7 +493,7 @@ uno_threadpool_destroy( uno_ThreadPool hPool ) SAL_THROW_EXTERN_C() if( empty ) { delete g_pThreadpoolHashSet; - g_pThreadpoolHashSet = 0; + g_pThreadpoolHashSet = nullptr; } } diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 5d4a3de01926..4e80a2620918 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -99,7 +99,7 @@ namespace // !for NOT REALLY WEAK TYPES only! static inline typelib_TypeDescriptionReference * igetTypeByName( rtl_uString * pTypeName ) { - typelib_TypeDescriptionReference * pRef = 0; + typelib_TypeDescriptionReference * pRef = nullptr; ::typelib_typedescriptionreference_getByName( &pRef, pTypeName ); if (pRef && pRef->pType && pRef->pType->pWeakRef) // found initialized td { @@ -107,7 +107,7 @@ static inline typelib_TypeDescriptionReference * igetTypeByName( rtl_uString * p } else { - return 0; + return nullptr; } } @@ -119,9 +119,9 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( SAL_THROW_EXTERN_C() { static typelib_TypeDescriptionReference * s_aTypes[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 }; + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr }; if (! s_aTypes[eTypeClass]) { @@ -171,9 +171,9 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( { OUString sTypeName("com.sun.star.uno.XInterface"); - typelib_InterfaceTypeDescription * pTD = 0; + typelib_InterfaceTypeDescription * pTD = nullptr; - typelib_TypeDescriptionReference * pMembers[3] = { 0,0,0 }; + typelib_TypeDescriptionReference * pMembers[3] = { nullptr,nullptr,nullptr }; OUString sMethodName0("com.sun.star.uno.XInterface::queryInterface"); ::typelib_typedescriptionreference_new( &pMembers[0], typelib_TypeClass_INTERFACE_METHOD, sMethodName0.pData ); @@ -185,7 +185,7 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( &pMembers[2], typelib_TypeClass_INTERFACE_METHOD, sMethodName2.pData ); ::typelib_typedescription_newInterface( - &pTD, sTypeName.pData, 0, 0, 0, 0, 0, 0, 3, pMembers ); + &pTD, sTypeName.pData, 0, 0, 0, 0, 0, nullptr, 3, pMembers ); ::typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription **>(&pTD) ); ::typelib_typedescriptionreference_acquire( @@ -200,7 +200,7 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( // Exception assert( ! s_aTypes[typelib_TypeClass_EXCEPTION] ); { - typelib_TypeDescription * pTD1 = 0; + typelib_TypeDescription * pTD1 = nullptr; OUString sTypeName1("com.sun.star.uno.Exception"); typelib_CompoundMember_Init aMembers[2]; @@ -216,7 +216,7 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( aMembers[1].pMemberName = sMemberName1.pData; ::typelib_typedescription_new( - &pTD1, typelib_TypeClass_EXCEPTION, sTypeName1.pData, 0, 2, aMembers ); + &pTD1, typelib_TypeClass_EXCEPTION, sTypeName1.pData, nullptr, 2, aMembers ); typelib_typedescription_register( &pTD1 ); typelib_typedescriptionreference_acquire( s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef ); @@ -225,12 +225,12 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( // RuntimeException OUString sTypeName2("com.sun.star.uno.RuntimeException"); ::typelib_typedescription_new( - &pTD1, typelib_TypeClass_EXCEPTION, sTypeName2.pData, s_aTypes[typelib_TypeClass_EXCEPTION], 0, 0 ); + &pTD1, typelib_TypeClass_EXCEPTION, sTypeName2.pData, s_aTypes[typelib_TypeClass_EXCEPTION], 0, nullptr ); ::typelib_typedescription_register( &pTD1 ); ::typelib_typedescription_release( pTD1 ); } // XInterface members - typelib_InterfaceMethodTypeDescription * pMethod = 0; + typelib_InterfaceMethodTypeDescription * pMethod = nullptr; typelib_Parameter_Init aParameters[1]; OUString sParamName0("aType"); OUString sParamType0("type"); @@ -252,13 +252,13 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sReturnType1("void"); ::typelib_typedescription_newInterfaceMethod( &pMethod, 1, sal_True, sMethodName1.pData, - typelib_TypeClass_VOID, sReturnType1.pData, 0, 0, 0, 0 ); + typelib_TypeClass_VOID, sReturnType1.pData, 0, nullptr, 0, nullptr ); ::typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pMethod) ); ::typelib_typedescription_newInterfaceMethod( &pMethod, 2, sal_True, sMethodName2.pData, typelib_TypeClass_VOID, sReturnType1.pData, - 0, 0, 0, 0 ); + 0, nullptr, 0, nullptr ); ::typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pMethod) ); ::typelib_typedescription_release( &pMethod->aBase.aBase ); } @@ -315,10 +315,10 @@ void SAL_CALL typelib_static_sequence_type_init( *ppRef = igetTypeByName( aTypeName.pData ); if (!*ppRef) { - typelib_TypeDescription * pReg = 0; + typelib_TypeDescription * pReg = nullptr; ::typelib_typedescription_new( &pReg, typelib_TypeClass_SEQUENCE, - aTypeName.pData, pElementType, 0, 0 ); + aTypeName.pData, pElementType, 0, nullptr ); ::typelib_typedescription_register( &pReg ); *ppRef = reinterpret_cast<typelib_TypeDescriptionReference *>(pReg); @@ -352,7 +352,7 @@ void init( *ppRef = igetTypeByName( aTypeName.pData ); if (!*ppRef) { - typelib_CompoundTypeDescription * pComp = 0; + typelib_CompoundTypeDescription * pComp = nullptr; ::typelib_typedescription_newEmpty( reinterpret_cast<typelib_TypeDescription **>(&pComp), eTypeClass, aTypeName.pData ); @@ -371,7 +371,7 @@ void init( pComp->nMembers = nMembers; pComp->pMemberOffsets = new sal_Int32[ nMembers ]; pComp->ppTypeRefs = new typelib_TypeDescriptionReference *[ nMembers ]; - if (pParameterizedTypes != 0) { + if (pParameterizedTypes != nullptr) { reinterpret_cast< typelib_StructTypeDescription * >( pComp)->pParameterizedTypes = new sal_Bool[nMembers]; @@ -381,14 +381,14 @@ void init( ::typelib_typedescriptionreference_acquire( pComp->ppTypeRefs[i] = ppMembers[i] ); // write offset - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, pComp->ppTypeRefs[i] ); assert( pTD->nSize ); // void member? nOffset = newAlignedSize( nOffset, pTD->nSize, pTD->nAlignment ); pComp->pMemberOffsets[i] = nOffset - pTD->nSize; TYPELIB_DANGER_RELEASE( pTD ); - if (pParameterizedTypes != 0) { + if (pParameterizedTypes != nullptr) { reinterpret_cast< typelib_StructTypeDescription * >( pComp)->pParameterizedTypes[i] = pParameterizedTypes[i]; @@ -422,7 +422,7 @@ void SAL_CALL typelib_static_compound_type_init( sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers ) SAL_THROW_EXTERN_C() { - init(ppRef, eTypeClass, pTypeName, pBaseType, nMembers, ppMembers, 0); + init(ppRef, eTypeClass, pTypeName, pBaseType, nMembers, ppMembers, nullptr); } void SAL_CALL typelib_static_struct_type_init( @@ -445,7 +445,7 @@ void SAL_CALL typelib_static_interface_type_init( { // coverity[callee_ptr_arith] typelib_static_mi_interface_type_init( - ppRef, pTypeName, pBaseType == 0 ? 0 : 1, &pBaseType); + ppRef, pTypeName, pBaseType == nullptr ? 0 : 1, &pBaseType); } void SAL_CALL typelib_static_mi_interface_type_init( @@ -465,7 +465,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( *ppRef = igetTypeByName( aTypeName.pData ); if (!*ppRef) { - typelib_InterfaceTypeDescription * pIface = 0; + typelib_InterfaceTypeDescription * pIface = nullptr; ::typelib_typedescription_newEmpty( reinterpret_cast<typelib_TypeDescription **>(&pIface), typelib_TypeClass_INTERFACE, aTypeName.pData ); @@ -475,7 +475,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( if (nBaseTypes > 0) { for (sal_Int32 i = 0; i < nBaseTypes; ++i) { - pIface->ppBaseTypes[i] = 0; + pIface->ppBaseTypes[i] = nullptr; ::typelib_typedescriptionreference_getDescription( reinterpret_cast<typelib_TypeDescription **>(&pIface->ppBaseTypes[i]), ppBaseTypes[i] ); assert( pIface->ppBaseTypes[i] ); @@ -483,7 +483,7 @@ void SAL_CALL typelib_static_mi_interface_type_init( } else { - pIface->ppBaseTypes[0] = 0; + pIface->ppBaseTypes[0] = nullptr; ::typelib_typedescriptionreference_getDescription( reinterpret_cast<typelib_TypeDescription **>(&pIface->ppBaseTypes[0]), * ::typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ) ); @@ -528,7 +528,7 @@ void SAL_CALL typelib_static_enum_type_init( *ppRef = igetTypeByName( aTypeName.pData ); if (!*ppRef) { - typelib_TypeDescription * pReg = 0; + typelib_TypeDescription * pReg = nullptr; ::typelib_typedescription_newEmpty( &pReg, typelib_TypeClass_ENUM, aTypeName.pData ); typelib_EnumTypeDescription * pEnum = reinterpret_cast<typelib_EnumTypeDescription *>(pReg); diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 2c274bdc8891..ee7ca0dad143 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -204,7 +204,7 @@ struct TypeDescriptor_Init_Impl #endif TypeDescriptor_Init_Impl(): - pWeakMap(0), pCallbacks(0), pCache(0), pMutex(0) + pWeakMap(nullptr), pCallbacks(nullptr), pCache(nullptr), pMutex(nullptr) #if OSL_DEBUG_LEVEL > 1 , nTypeDescriptionCount(0), nCompoundTypeDescriptionCount(0), nIndirectTypeDescriptionCount(0), @@ -232,8 +232,8 @@ inline Mutex & TypeDescriptor_Init_Impl::getMutex() inline void TypeDescriptor_Init_Impl::callChain( typelib_TypeDescription ** ppRet, rtl_uString * pName ) { - assert(ppRet != 0); - assert(*ppRet == 0); + assert(ppRet != nullptr); + assert(*ppRet == nullptr); if (pCallbacks) { CallbackSet_Impl::const_iterator aIt = pCallbacks->begin(); @@ -260,7 +260,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() ++aIt; } delete pCache; - pCache = 0; + pCache = nullptr; } if( pWeakMap ) @@ -313,7 +313,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() #endif delete pWeakMap; - pWeakMap = 0; + pWeakMap = nullptr; } #if OSL_DEBUG_LEVEL > 1 OSL_ENSURE( !nTypeDescriptionCount, "### nTypeDescriptionCount is not zero" ); @@ -329,12 +329,12 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() #endif delete pCallbacks; - pCallbacks = 0; + pCallbacks = nullptr; if( pMutex ) { delete pMutex; - pMutex = 0; + pMutex = nullptr; } }; @@ -390,7 +390,7 @@ static inline void typelib_typedescription_initTables( pReadWriteAttributes[i] = sal_False; if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pITD->ppAllMembers[i]->eTypeClass ) { - typelib_TypeDescription * pM = 0; + typelib_TypeDescription * pM = nullptr; TYPELIB_DANGER_GET( &pM, pITD->ppAllMembers[i] ); OSL_ASSERT( pM ); if (pM) @@ -486,7 +486,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { return true; } - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; // on demand access of complete td TypeDescriptor_Init_Impl &rInit = Init::get(); rInit.callChain( &pTD, (*ppTypeDescr)->pTypeName ); @@ -566,7 +566,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( if( *ppRet ) { typelib_typedescription_release( *ppRet ); - *ppRet = 0; + *ppRet = nullptr; } OSL_ASSERT( typelib_TypeClass_TYPEDEF != eTypeClass ); @@ -581,7 +581,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nIndirectTypeDescriptionCount ); #endif - pTmp->pType = 0; + pTmp->pType = nullptr; } break; @@ -593,12 +593,12 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nCompoundTypeDescriptionCount ); #endif - pTmp->aBase.pBaseTypeDescription = 0; + pTmp->aBase.pBaseTypeDescription = nullptr; pTmp->aBase.nMembers = 0; - pTmp->aBase.pMemberOffsets = 0; - pTmp->aBase.ppTypeRefs = 0; - pTmp->aBase.ppMemberNames = 0; - pTmp->pParameterizedTypes = 0; + pTmp->aBase.pMemberOffsets = nullptr; + pTmp->aBase.ppTypeRefs = nullptr; + pTmp->aBase.ppMemberNames = nullptr; + pTmp->pParameterizedTypes = nullptr; } break; @@ -610,11 +610,11 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nCompoundTypeDescriptionCount ); #endif - pTmp->pBaseTypeDescription = 0; + pTmp->pBaseTypeDescription = nullptr; pTmp->nMembers = 0; - pTmp->pMemberOffsets = 0; - pTmp->ppTypeRefs = 0; - pTmp->ppMemberNames = 0; + pTmp->pMemberOffsets = nullptr; + pTmp->ppTypeRefs = nullptr; + pTmp->ppMemberNames = nullptr; } break; @@ -627,8 +627,8 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #endif pTmp->nDefaultEnumValue = 0; pTmp->nEnumValues = 0; - pTmp->ppEnumNames = 0; - pTmp->pEnumValues = 0; + pTmp->ppEnumNames = nullptr; + pTmp->pEnumValues = nullptr; } break; @@ -640,16 +640,16 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nInterfaceTypeDescriptionCount ); #endif - pTmp->pBaseTypeDescription = 0; + pTmp->pBaseTypeDescription = nullptr; pTmp->nMembers = 0; - pTmp->ppMembers = 0; + pTmp->ppMembers = nullptr; pTmp->nAllMembers = 0; - pTmp->ppAllMembers = 0; + pTmp->ppAllMembers = nullptr; pTmp->nMapFunctionIndexToMemberIndex = 0; - pTmp->pMapFunctionIndexToMemberIndex = 0; - pTmp->pMapMemberIndexToFunctionIndex= 0; + pTmp->pMapFunctionIndexToMemberIndex = nullptr; + pTmp->pMapMemberIndexToFunctionIndex= nullptr; pTmp->nBaseTypes = 0; - pTmp->ppBaseTypes = 0; + pTmp->ppBaseTypes = nullptr; } break; @@ -661,14 +661,14 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nInterfaceMethodTypeDescriptionCount ); #endif - pTmp->aBase.pMemberName = 0; - pTmp->pReturnTypeRef = 0; + pTmp->aBase.pMemberName = nullptr; + pTmp->pReturnTypeRef = nullptr; pTmp->nParams = 0; - pTmp->pParams = 0; + pTmp->pParams = nullptr; pTmp->nExceptions = 0; - pTmp->ppExceptions = 0; - pTmp->pInterface = 0; - pTmp->pBaseRef = 0; + pTmp->ppExceptions = nullptr; + pTmp->pInterface = nullptr; + pTmp->pBaseRef = nullptr; pTmp->nIndex = 0; } break; @@ -681,15 +681,15 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( #if OSL_DEBUG_LEVEL > 1 osl_atomic_increment( &Init::get().nInterfaceAttributeTypeDescriptionCount ); #endif - pTmp->aBase.pMemberName = 0; - pTmp->pAttributeTypeRef = 0; - pTmp->pInterface = 0; - pTmp->pBaseRef = 0; + pTmp->aBase.pMemberName = nullptr; + pTmp->pAttributeTypeRef = nullptr; + pTmp->pInterface = nullptr; + pTmp->pBaseRef = nullptr; pTmp->nIndex = 0; pTmp->nGetExceptions = 0; - pTmp->ppGetExceptions = 0; + pTmp->ppGetExceptions = nullptr; pTmp->nSetExceptions = 0; - pTmp->ppSetExceptions = 0; + pTmp->ppSetExceptions = nullptr; } break; @@ -705,15 +705,15 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty( pRet->nRefCount = 1; // reference count is initially 1 pRet->nStaticRefCount = 0; pRet->eTypeClass = eTypeClass; - pRet->pTypeName = 0; - pRet->pUniqueIdentifier = 0; - pRet->pReserved = 0; + pRet->pTypeName = nullptr; + pRet->pUniqueIdentifier = nullptr; + pRet->pReserved = nullptr; rtl_uString_acquire( pRet->pTypeName = pTypeName ); pRet->pSelf = pRet; pRet->bComplete = sal_True; pRet->nSize = 0; pRet->nAlignment = 0; - pRet->pWeakRef = 0; + pRet->pWeakRef = nullptr; pRet->bOnDemand = sal_False; *ppRet = pRet; } @@ -728,8 +728,8 @@ void newTypeDescription( typelib_StructMember_Init * pStructMembers) { OSL_ASSERT( - (pCompoundMembers == 0 || pStructMembers == 0) - && (pStructMembers == 0 || eTypeClass == typelib_TypeClass_STRUCT)); + (pCompoundMembers == nullptr || pStructMembers == nullptr) + && (pStructMembers == nullptr || eTypeClass == typelib_TypeClass_STRUCT)); if (typelib_TypeClass_TYPEDEF == eTypeClass) { OSL_TRACE( "### unexpected typedef!" ); @@ -771,7 +771,7 @@ void newTypeDescription( pTmp->ppMemberNames = new rtl_uString *[ nMembers ]; bool polymorphic = eTypeClass == typelib_TypeClass_STRUCT && rtl::OUString::unacquired(&pTypeName).indexOf('<') >= 0; - OSL_ASSERT(!polymorphic || pStructMembers != 0); + OSL_ASSERT(!polymorphic || pStructMembers != nullptr); if (polymorphic) { reinterpret_cast< typelib_StructTypeDescription * >(pTmp)-> pParameterizedTypes = new sal_Bool[nMembers]; @@ -779,8 +779,8 @@ void newTypeDescription( for( sal_Int32 i = 0 ; i < nMembers; i++ ) { // read the type and member names - pTmp->ppTypeRefs[i] = 0; - if (pCompoundMembers != 0) { + pTmp->ppTypeRefs[i] = nullptr; + if (pCompoundMembers != nullptr) { typelib_typedescriptionreference_new( pTmp->ppTypeRefs +i, pCompoundMembers[i].eTypeClass, pCompoundMembers[i].pTypeName ); @@ -807,7 +807,7 @@ void newTypeDescription( size = sizeof(void *); alignment = adjustAlignment(size); } else { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, pTmp->ppTypeRefs[i] ); OSL_ENSURE( pTD->nSize, "### void member?" ); size = pTD->nSize; @@ -853,7 +853,7 @@ extern "C" void SAL_CALL typelib_typedescription_new( SAL_THROW_EXTERN_C() { newTypeDescription( - ppRet, eTypeClass, pTypeName, pType, nMembers, pMembers, 0); + ppRet, eTypeClass, pTypeName, pType, nMembers, pMembers, nullptr); } extern "C" void SAL_CALL typelib_typedescription_newStruct( @@ -865,7 +865,7 @@ extern "C" void SAL_CALL typelib_typedescription_newStruct( SAL_THROW_EXTERN_C() { newTypeDescription( - ppRet, typelib_TypeClass_STRUCT, pTypeName, pType, nMembers, 0, + ppRet, typelib_TypeClass_STRUCT, pTypeName, pType, nMembers, nullptr, pMembers); } @@ -912,7 +912,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterface( { // coverity[callee_ptr_arith] typelib_typedescription_newMIInterface( - ppRet, pTypeName, 0, 0, 0, 0, 0, pBaseInterface == 0 ? 0 : 1, + ppRet, pTypeName, 0, 0, 0, 0, 0, pBaseInterface == nullptr ? 0 : 1, &pBaseInterface, nMembers, ppMembers); } @@ -974,11 +974,11 @@ void BaseList::calculate( e.directBaseMemberOffset = *directBaseMembers; e.base = desc; list.push_back(e); - OSL_ASSERT(desc->ppAllMembers != 0); + OSL_ASSERT(desc->ppAllMembers != nullptr); members += desc->nMembers; } if (directBaseSet.insert(desc->aBase.pTypeName).second) { - OSL_ASSERT(desc->ppAllMembers != 0); + OSL_ASSERT(desc->ppAllMembers != nullptr); *directBaseMembers += desc->nMembers; } } @@ -997,24 +997,24 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( typelib_TypeDescriptionReference ** ppMembers ) SAL_THROW_EXTERN_C() { - if (*ppRet != 0) { + if (*ppRet != nullptr) { typelib_typedescription_release(&(*ppRet)->aBase); - *ppRet = 0; + *ppRet = nullptr; } - typelib_InterfaceTypeDescription * pITD = 0; + typelib_InterfaceTypeDescription * pITD = nullptr; typelib_typedescription_newEmpty( reinterpret_cast<typelib_TypeDescription **>(&pITD), typelib_TypeClass_INTERFACE, pTypeName ); pITD->nBaseTypes = nBaseInterfaces; pITD->ppBaseTypes = new typelib_InterfaceTypeDescription *[nBaseInterfaces]; for (sal_Int32 i = 0; i < nBaseInterfaces; ++i) { - pITD->ppBaseTypes[i] = 0; + pITD->ppBaseTypes[i] = nullptr; typelib_typedescriptionreference_getDescription( reinterpret_cast< typelib_TypeDescription ** >( &pITD->ppBaseTypes[i]), ppBaseInterfaces[i]); - if (pITD->ppBaseTypes[i] == 0 + if (pITD->ppBaseTypes[i] == nullptr || !complete( reinterpret_cast< typelib_TypeDescription ** >( &pITD->ppBaseTypes[i]), @@ -1023,7 +1023,7 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( OSL_ASSERT(false); return; } - OSL_ASSERT(pITD->ppBaseTypes[i] != 0); + OSL_ASSERT(pITD->ppBaseTypes[i] != nullptr); } if (nBaseInterfaces > 0) { pITD->pBaseTypeDescription = pITD->ppBaseTypes[0]; @@ -1052,7 +1052,7 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( typelib_InterfaceTypeDescription const * pBase = i->base; typelib_InterfaceTypeDescription const * pDirectBase = pITD->ppBaseTypes[i->directBaseIndex]; - OSL_ASSERT(pBase->ppAllMembers != 0); + OSL_ASSERT(pBase->ppAllMembers != nullptr); for (sal_Int32 j = 0; j < pBase->nMembers; ++j) { typelib_TypeDescriptionReference const * pDirectBaseMember = pDirectBase->ppAllMembers[i->directBaseMemberOffset + j]; @@ -1064,7 +1064,7 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( aBuf.append(':'); aBuf.append(pITD->aBase.pTypeName); rtl::OUString aName(aBuf.makeStringAndClear()); - typelib_TypeDescriptionReference * pDerivedMember = 0; + typelib_TypeDescriptionReference * pDerivedMember = nullptr; typelib_typedescriptionreference_new( &pDerivedMember, pDirectBaseMember->eTypeClass, aName.pData); @@ -1104,12 +1104,12 @@ typelib_TypeDescriptionReference ** copyExceptions( { OSL_ASSERT(count >= 0); if (count == 0) { - return 0; + return nullptr; } typelib_TypeDescriptionReference ** p = new typelib_TypeDescriptionReference *[count]; for (sal_Int32 i = 0; i < count; ++i) { - p[i] = 0; + p[i] = nullptr; typelib_typedescriptionreference_new( p + i, typelib_TypeClass_EXCEPTION, typeNames[i]); } @@ -1131,9 +1131,9 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( rtl_uString ** ppExceptionNames ) SAL_THROW_EXTERN_C() { - if (*ppRet != 0) { + if (*ppRet != nullptr) { typelib_typedescription_release(&(*ppRet)->aBase.aBase); - *ppRet = 0; + *ppRet = nullptr; } sal_Int32 nOffset = rtl_ustr_lastIndexOfChar_WithLength( pTypeName->buffer, pTypeName->length, ':'); @@ -1142,11 +1142,11 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( return; } rtl::OUString aInterfaceTypeName(pTypeName->buffer, nOffset - 1); - typelib_InterfaceTypeDescription * pInterface = 0; + typelib_InterfaceTypeDescription * pInterface = nullptr; typelib_typedescription_getByName( reinterpret_cast< typelib_TypeDescription ** >(&pInterface), aInterfaceTypeName.pData); - if (pInterface == 0 + if (pInterface == nullptr || pInterface->aBase.eTypeClass != typelib_TypeClass_INTERFACE || !complete( reinterpret_cast< typelib_TypeDescription ** >(&pInterface), false)) @@ -1173,9 +1173,9 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( for( sal_Int32 i = 0; i < nParams; i++ ) { // get the name of the parameter - (*ppRet)->pParams[ i ].pName = 0; + (*ppRet)->pParams[ i ].pName = nullptr; rtl_uString_acquire( (*ppRet)->pParams[ i ].pName = pParams[i].pParamName ); - (*ppRet)->pParams[ i ].pTypeRef = 0; + (*ppRet)->pParams[ i ].pTypeRef = nullptr; // get the type name of the parameter and create the weak reference typelib_typedescriptionreference_new( &(*ppRet)->pParams[ i ].pTypeRef, pParams[i].eTypeClass, pParams[i].pTypeName ); @@ -1186,7 +1186,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( (*ppRet)->nExceptions = nExceptions; (*ppRet)->ppExceptions = copyExceptions(nExceptions, ppExceptionNames); (*ppRet)->pInterface = pInterface; - (*ppRet)->pBaseRef = 0; + (*ppRet)->pBaseRef = nullptr; OSL_ASSERT( (nAbsolutePosition >= pInterface->nAllMembers - pInterface->nMembers) && nAbsolutePosition < pInterface->nAllMembers); @@ -1209,7 +1209,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceAttribute( { typelib_typedescription_newExtendedInterfaceAttribute( ppRet, nAbsolutePosition, pTypeName, eAttributeTypeClass, - pAttributeTypeName, bReadOnly, 0, 0, 0, 0); + pAttributeTypeName, bReadOnly, 0, nullptr, 0, nullptr); } @@ -1224,9 +1224,9 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( sal_Int32 nSetExceptions, rtl_uString ** ppSetExceptionNames ) SAL_THROW_EXTERN_C() { - if (*ppRet != 0) { + if (*ppRet != nullptr) { typelib_typedescription_release(&(*ppRet)->aBase.aBase); - *ppRet = 0; + *ppRet = nullptr; } sal_Int32 nOffset = rtl_ustr_lastIndexOfChar_WithLength( pTypeName->buffer, pTypeName->length, ':'); @@ -1235,11 +1235,11 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( return; } rtl::OUString aInterfaceTypeName(pTypeName->buffer, nOffset - 1); - typelib_InterfaceTypeDescription * pInterface = 0; + typelib_InterfaceTypeDescription * pInterface = nullptr; typelib_typedescription_getByName( reinterpret_cast< typelib_TypeDescription ** >(&pInterface), aInterfaceTypeName.pData); - if (pInterface == 0 + if (pInterface == nullptr || pInterface->aBase.eTypeClass != typelib_TypeClass_INTERFACE || !complete( reinterpret_cast< typelib_TypeDescription ** >(&pInterface), false)) @@ -1259,7 +1259,7 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( typelib_typedescriptionreference_new( &(*ppRet)->pAttributeTypeRef, eAttributeTypeClass, pAttributeTypeName ); (*ppRet)->bReadOnly = bReadOnly; (*ppRet)->pInterface = pInterface; - (*ppRet)->pBaseRef = 0; + (*ppRet)->pBaseRef = nullptr; OSL_ASSERT( (nAbsolutePosition >= pInterface->nAllMembers - pInterface->nMembers) && nAbsolutePosition < pInterface->nAllMembers); @@ -1368,7 +1368,7 @@ static inline void typelib_typedescription_destructExtendedMembers( deleteExceptions(pIMTD->nExceptions, pIMTD->ppExceptions); rtl_uString_release( pIMTD->aBase.pMemberName ); typelib_typedescription_release(&pIMTD->pInterface->aBase); - if (pIMTD->pBaseRef != 0) { + if (pIMTD->pBaseRef != nullptr) { typelib_typedescriptionreference_release(pIMTD->pBaseRef); } } @@ -1383,7 +1383,7 @@ static inline void typelib_typedescription_destructExtendedMembers( if( pIATD->aBase.pMemberName ) rtl_uString_release( pIATD->aBase.pMemberName ); typelib_typedescription_release(&pIATD->pInterface->aBase); - if (pIATD->pBaseRef != 0) { + if (pIATD->pBaseRef != nullptr) { typelib_typedescriptionreference_release(pIATD->pBaseRef); } } @@ -1421,7 +1421,7 @@ extern "C" void SAL_CALL typelib_typedescription_release( { MutexGuard aGuard( rInit.getMutex() ); // remove this description from the weak reference - pTD->pWeakRef->pType = 0; + pTD->pWeakRef->pType = nullptr; } typelib_typedescriptionreference_release( pTD->pWeakRef ); } @@ -1484,7 +1484,7 @@ extern "C" void SAL_CALL typelib_typedescription_register( TypeDescriptor_Init_Impl &rInit = Init::get(); ClearableMutexGuard aGuard( rInit.getMutex() ); - typelib_TypeDescriptionReference * pTDR = 0; + typelib_TypeDescriptionReference * pTDR = nullptr; typelib_typedescriptionreference_getByName( &pTDR, (*ppNewDescription)->pTypeName ); OSL_ASSERT( (*ppNewDescription)->pWeakRef || reallyWeak( (*ppNewDescription)->eTypeClass ) ); @@ -1671,7 +1671,7 @@ extern "C" sal_Int32 SAL_CALL typelib_typedescription_getAlignedUnoSize( } for( sal_Int32 i = 0; i < pTmp->nMembers; i++ ) { - typelib_TypeDescription * pMemberType = 0; + typelib_TypeDescription * pMemberType = nullptr; typelib_TypeDescriptionReference * pMemberRef = pTmp->ppTypeRefs[i]; sal_Int32 nMaxIntegral; @@ -1786,7 +1786,7 @@ bool createDerivedInterfaceMemberDescription( typelib_TypeDescription const * base, typelib_TypeDescription * interface, sal_Int32 index, sal_Int32 position) { - if (baseRef != 0 && base != 0 && interface != 0) { + if (baseRef != nullptr && base != nullptr && interface != nullptr) { switch (base->eTypeClass) { case typelib_TypeClass_INTERFACE_METHOD: { @@ -1879,7 +1879,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( if( *ppRet ) { typelib_typedescription_release( (*ppRet) ); - *ppRet = 0; + *ppRet = nullptr; } static bool bInited = false; @@ -1894,59 +1894,59 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( // avoid recursion during the next ...new calls bInited = true; - rtl_uString * pTypeName = 0; - typelib_TypeDescription * pType = 0; + rtl_uString * pTypeName = nullptr; + typelib_TypeDescription * pType = nullptr; rtl_uString_newFromAscii( &pTypeName, "type" ); - typelib_typedescription_new( &pType, typelib_TypeClass_TYPE, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_TYPE, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "void" ); - typelib_typedescription_new( &pType, typelib_TypeClass_VOID, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_VOID, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "boolean" ); - typelib_typedescription_new( &pType, typelib_TypeClass_BOOLEAN, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_BOOLEAN, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "char" ); - typelib_typedescription_new( &pType, typelib_TypeClass_CHAR, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_CHAR, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "byte" ); - typelib_typedescription_new( &pType, typelib_TypeClass_BYTE, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_BYTE, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "string" ); - typelib_typedescription_new( &pType, typelib_TypeClass_STRING, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_STRING, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "short" ); - typelib_typedescription_new( &pType, typelib_TypeClass_SHORT, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_SHORT, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "unsigned short" ); - typelib_typedescription_new( &pType, typelib_TypeClass_UNSIGNED_SHORT, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_UNSIGNED_SHORT, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "long" ); - typelib_typedescription_new( &pType, typelib_TypeClass_LONG, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_LONG, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "unsigned long" ); - typelib_typedescription_new( &pType, typelib_TypeClass_UNSIGNED_LONG, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_UNSIGNED_LONG, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "hyper" ); - typelib_typedescription_new( &pType, typelib_TypeClass_HYPER, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_HYPER, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "unsigned hyper" ); - typelib_typedescription_new( &pType, typelib_TypeClass_UNSIGNED_HYPER, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_UNSIGNED_HYPER, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "float" ); - typelib_typedescription_new( &pType, typelib_TypeClass_FLOAT, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_FLOAT, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "double" ); - typelib_typedescription_new( &pType, typelib_TypeClass_DOUBLE, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_DOUBLE, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); rtl_uString_newFromAscii( &pTypeName, "any" ); - typelib_typedescription_new( &pType, typelib_TypeClass_ANY, pTypeName, 0, 0, 0 ); + typelib_typedescription_new( &pType, typelib_TypeClass_ANY, pTypeName, nullptr, 0, nullptr ); typelib_typedescription_register( &pType ); typelib_typedescription_release( pType ); rtl_uString_release( pTypeName ); } } - typelib_TypeDescriptionReference * pTDR = 0; + typelib_TypeDescriptionReference * pTDR = nullptr; typelib_typedescriptionreference_getByName( &pTDR, pName ); if( pTDR ) { @@ -1963,24 +1963,24 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( typelib_typedescriptionreference_release( pTDR ); } - if (0 == *ppRet) + if (nullptr == *ppRet) { // check for sequence OUString const & name = OUString::unacquired( &pName ); if (2 < name.getLength() && '[' == name[ 0 ]) { OUString element_name( name.copy( 2 ) ); - typelib_TypeDescription * element_td = 0; + typelib_TypeDescription * element_td = nullptr; typelib_typedescription_getByName( &element_td, element_name.pData ); - if (0 != element_td) + if (nullptr != element_td) { typelib_typedescription_new( - ppRet, typelib_TypeClass_SEQUENCE, pName, element_td->pWeakRef, 0, 0 ); + ppRet, typelib_TypeClass_SEQUENCE, pName, element_td->pWeakRef, 0, nullptr ); // register? typelib_typedescription_release( element_td ); } } - if (0 == *ppRet) + if (nullptr == *ppRet) { // Check for derived interface member type: sal_Int32 i1 = name.lastIndexOf(":@"); @@ -1990,12 +1990,12 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( if (i3 >= 0) { sal_Int32 i4 = name.indexOf(':', i3); if (i4 >= 0) { - typelib_TypeDescriptionReference * pBaseRef = 0; - typelib_TypeDescription * pBase = 0; - typelib_TypeDescription * pInterface = 0; + typelib_TypeDescriptionReference * pBaseRef = nullptr; + typelib_TypeDescription * pBase = nullptr; + typelib_TypeDescription * pInterface = nullptr; typelib_typedescriptionreference_getByName( &pBaseRef, name.copy(0, i1).pData); - if (pBaseRef != 0) { + if (pBaseRef != nullptr) { typelib_typedescriptionreference_getDescription( &pBase, pBaseRef); } @@ -2006,13 +2006,13 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( name.copy(i2, i3 - i2).toInt32(), name.copy(i3 + 1, i4 - i3 - 1).toInt32())) { - if (pInterface != 0) { + if (pInterface != nullptr) { typelib_typedescription_release(pInterface); } - if (pBase != 0) { + if (pBase != nullptr) { typelib_typedescription_release(pBase); } - if (pBaseRef != 0) { + if (pBaseRef != nullptr) { typelib_typedescriptionreference_release( pBaseRef); } @@ -2021,7 +2021,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( } } } - if (0 == *ppRet) + if (nullptr == *ppRet) { // on demand access rInit.callChain( ppRet, pName ); @@ -2032,7 +2032,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( // typedescription found if (typelib_TypeClass_TYPEDEF == (*ppRet)->eTypeClass) { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; typelib_typedescriptionreference_getDescription( &pTD, reinterpret_cast<typelib_IndirectTypeDescription *>(*ppRet)->pType ); typelib_typedescription_release( *ppRet ); @@ -2082,7 +2082,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( if( eTypeClass == typelib_TypeClass_TYPEDEF ) { // on demand access - typelib_TypeDescription * pRet = 0; + typelib_TypeDescription * pRet = nullptr; rInit.callChain( &pRet, pTypeName ); if( pRet ) { @@ -2129,7 +2129,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( OSL_ENSURE( !"### typedef not found: ", aStr.getStr() ); #endif typelib_typedescriptionreference_release( *ppTDR ); - *ppTDR = 0; + *ppTDR = nullptr; } return; } @@ -2148,10 +2148,10 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( pTDR->nRefCount = 1; pTDR->nStaticRefCount = 0; pTDR->eTypeClass = eTypeClass; - pTDR->pUniqueIdentifier = 0; - pTDR->pReserved = 0; + pTDR->pUniqueIdentifier = nullptr; + pTDR->pReserved = nullptr; rtl_uString_acquire( pTDR->pTypeName = pTypeName ); - pTDR->pType = 0; + pTDR->pType = nullptr; *ppTDR = pTDR; } else @@ -2200,7 +2200,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_release( } rtl_uString_release( pRef->pTypeName ); - OSL_ASSERT( pRef->pType == 0 ); + OSL_ASSERT( pRef->pType == nullptr ); #if OSL_DEBUG_LEVEL > 1 osl_atomic_decrement( &rInit.nTypeDescriptionReferenceCount ); #endif @@ -2221,7 +2221,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getDescription( if( *ppRet ) { typelib_typedescription_release( *ppRet ); - *ppRet = 0; + *ppRet = nullptr; } if( !reallyWeak( pRef->eTypeClass ) && pRef->pType && pRef->pType->pWeakRef ) @@ -2250,7 +2250,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getDescription( (void)osl_atomic_decrement( &pRef->pType->nRefCount ); // destruction of this type in progress (another thread!) // no access through this weak reference - pRef->pType = 0; + pRef->pType = nullptr; } } } @@ -2270,7 +2270,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getByName( if( *ppRet ) { typelib_typedescriptionreference_release( *ppRet ); - *ppRet = 0; + *ppRet = nullptr; } TypeDescriptor_Init_Impl &rInit = Init::get(); if( rInit.pWeakMap ) @@ -2386,7 +2386,7 @@ extern "C" sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pFromDescr = 0; + typelib_TypeDescription * pFromDescr = nullptr; TYPELIB_DANGER_GET( &pFromDescr, pFrom ); if (!reinterpret_cast<typelib_CompoundTypeDescription *>(pFromDescr)->pBaseTypeDescription) { @@ -2401,7 +2401,7 @@ extern "C" sal_Bool SAL_CALL typelib_typedescriptionreference_isAssignableFrom( } case typelib_TypeClass_INTERFACE: { - typelib_TypeDescription * pFromDescr = 0; + typelib_TypeDescription * pFromDescr = nullptr; TYPELIB_DANGER_GET( &pFromDescr, pFrom ); typelib_InterfaceTypeDescription * pFromIfc = reinterpret_cast< diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 5fefaa85640a..2c1100a62499 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -88,7 +88,7 @@ static void s_setCurrent(uno_Environment * pEnv) static uno_Environment * s_getCurrent() { - uno_Environment * pEnv = NULL; + uno_Environment * pEnv = nullptr; oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier(); @@ -108,7 +108,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl if (*ppEnv) { (*ppEnv)->release(*ppEnv); - *ppEnv = NULL; + *ppEnv = nullptr; } rtl::OUString currPurpose; @@ -122,7 +122,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl rtl::OUString envDcp(pTypeName); envDcp += currPurpose; - uno_getEnvironment(ppEnv, envDcp.pData, NULL); + uno_getEnvironment(ppEnv, envDcp.pData, nullptr); } else { @@ -134,7 +134,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl else { rtl::OUString uno_envDcp(UNO_LB_UNO); - uno_getEnvironment(ppEnv, uno_envDcp.pData, NULL); + uno_getEnvironment(ppEnv, uno_envDcp.pData, nullptr); } } } @@ -205,14 +205,14 @@ static int s_getNextEnv(uno_Environment ** ppEnv, uno_Environment * pCurrEnv, un rtl::OUString next_envDcp(UNO_LB_UNO); next_envDcp += nextPurpose; - uno_getEnvironment(ppEnv, next_envDcp.pData, NULL); + uno_getEnvironment(ppEnv, next_envDcp.pData, nullptr); } else { if (*ppEnv) (*ppEnv)->release(*ppEnv); - *ppEnv = NULL; + *ppEnv = nullptr; } return res; @@ -278,7 +278,7 @@ extern "C" { static void s_environment_invoke_vv(va_list * pParam) static void s_environment_invoke_v(uno_Environment * pCurrEnv, uno_Environment * pTargetEnv, uno_EnvCallee * pCallee, va_list * pParam) { - uno_Environment * pNextEnv = NULL; + uno_Environment * pNextEnv = nullptr; switch(s_getNextEnv(&pNextEnv, pCurrEnv, pTargetEnv)) { case -1: @@ -325,7 +325,7 @@ extern "C" void SAL_CALL uno_Environment_invoke(uno_Environment * pEnv, uno_EnvC extern "C" void SAL_CALL uno_Environment_enter(uno_Environment * pTargetEnv) SAL_THROW_EXTERN_C() { - uno_Environment * pNextEnv = NULL; + uno_Environment * pNextEnv = nullptr; uno_Environment * pCurrEnv = s_getCurrent(); int res; diff --git a/cppu/source/uno/any.cxx b/cppu/source/uno/any.cxx index 891518422a51..e26b97286d01 100644 --- a/cppu/source/uno/any.cxx +++ b/cppu/source/uno/any.cxx @@ -36,7 +36,7 @@ void SAL_CALL uno_type_any_assign( _destructAny( pDest, release ); if (pType) { - _copyConstructAny( pDest, pSource, pType, 0, acquire, 0 ); + _copyConstructAny( pDest, pSource, pType, nullptr, acquire, nullptr ); } else { @@ -53,7 +53,7 @@ void SAL_CALL uno_any_assign( _destructAny( pDest, release ); if (pTypeDescr) { - _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 ); + _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, nullptr ); } else { @@ -69,7 +69,7 @@ void SAL_CALL uno_type_any_construct( { if (pType) { - _copyConstructAny( pDest, pSource, pType, 0, acquire, 0 ); + _copyConstructAny( pDest, pSource, pType, nullptr, acquire, nullptr ); } else { @@ -85,7 +85,7 @@ void SAL_CALL uno_any_construct( { if (pTypeDescr) { - _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 ); + _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, nullptr ); } else { @@ -101,7 +101,7 @@ void SAL_CALL uno_type_any_constructAndConvert( { if (pType) { - _copyConstructAny( pDest, pSource, pType, 0, 0, mapping ); + _copyConstructAny( pDest, pSource, pType, nullptr, nullptr, mapping ); } else { @@ -117,7 +117,7 @@ void SAL_CALL uno_any_constructAndConvert( { if (pTypeDescr) { - _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, 0, mapping ); + _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, nullptr, mapping ); } else { diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx index cd4b21b00414..e016565aa7c9 100644 --- a/cppu/source/uno/assign.hxx +++ b/cppu/source/uno/assign.hxx @@ -54,7 +54,7 @@ inline void * _queryInterface( { if (pSource) { - if (0 == queryInterface) + if (nullptr == queryInterface) queryInterface = binuno_queryInterface; pSource = (*queryInterface)( pSource, pDestType ); } @@ -116,7 +116,7 @@ inline bool _assignData( } while (typelib_TypeClass_ANY == pSourceType->eTypeClass) { - pSourceTypeDescr = 0; + pSourceTypeDescr = nullptr; pSourceType = static_cast<uno_Any *>(pSource)->pType; pSource = static_cast<uno_Any *>(pSource)->pData; if (pDest == pSource) @@ -338,7 +338,7 @@ inline bool _assignData( } case typelib_TypeClass_ANY: _destructAny( static_cast<uno_Any *>(pDest), release ); - _copyConstructAny( static_cast<uno_Any *>(pDest), pSource, pSourceType, pSourceTypeDescr, acquire, 0 ); + _copyConstructAny( static_cast<uno_Any *>(pDest), pSource, pSourceType, pSourceTypeDescr, acquire, nullptr ); return true; case typelib_TypeClass_ENUM: if (_type_equals( pDestType, pSourceType )) @@ -411,12 +411,12 @@ inline bool _assignData( _assignInterface( static_cast<void **>(pDest), *static_cast<void **>(pSource), acquire, release ); return true; } - else if (*static_cast< void ** >(pSource) == 0) + else if (*static_cast< void ** >(pSource) == nullptr) { // A null reference of any interface type can be converted to a null // reference of any other interface type: void * const pToBeReleased = *static_cast< void ** >(pDest); - *static_cast< void ** >(pDest) = 0; + *static_cast< void ** >(pDest) = nullptr; _release( pToBeReleased, release ); return true; } @@ -439,12 +439,12 @@ inline bool _assignData( // query for interface: void * pQueried = _queryInterface( *static_cast<void **>(pSource), pDestType, queryInterface ); - if (pQueried != 0) { + if (pQueried != nullptr) { void * const pToBeReleased = *static_cast<void **>(pDest); *static_cast<void **>(pDest) = pQueried; _release( pToBeReleased, release ); } - return (pQueried != 0); + return (pQueried != nullptr); } default: OSL_ASSERT(false); diff --git a/cppu/source/uno/cascade_mapping.cxx b/cppu/source/uno/cascade_mapping.cxx index a5295bce9d6b..3033545637fb 100644 --- a/cppu/source/uno/cascade_mapping.cxx +++ b/cppu/source/uno/cascade_mapping.cxx @@ -145,16 +145,16 @@ void MediatorMapping::mapInterface( void * pInterface, typelib_InterfaceTypeDescription * pInterfaceTypeDescr) { - if (*ppOut != 0) + if (*ppOut != nullptr) { uno_ExtEnvironment * env = m_to.get()->pExtEnv; - OSL_ASSERT( env != 0 ); + OSL_ASSERT( env != nullptr ); env->releaseInterface( env, *ppOut ); - *ppOut = NULL; + *ppOut = nullptr; } - void * ret = 0; - uno_Interface * pUnoI = 0; + void * ret = nullptr; + uno_Interface * pUnoI = nullptr; m_from.invoke(s_mapInterface_v, &pUnoI, pInterface, pInterfaceTypeDescr, m_from2uno.get()); @@ -247,7 +247,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, // reaching this point means, we need a mediated mapping!!! // we generally mediate via uno[:free] - uno_Environment * pInterm = NULL; + uno_Environment * pInterm = nullptr; // chained uno -> uno if (from_envType == uno_envType && to_envType == uno_envType) @@ -286,7 +286,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, uno_envDcp += rest.copy(0, index); } - uno_getEnvironment(&pInterm, uno_envDcp.pData, NULL); + uno_getEnvironment(&pInterm, uno_envDcp.pData, nullptr); } else if (from_envType != uno_envType && to_envType == uno_envType) // <ANY> -> UNO ? // mediate via uno:purpose(fromEnv) @@ -294,7 +294,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, rtl::OUString envDcp = uno_envType; envDcp += from_envPurpose; - uno_getEnvironment(&pInterm, envDcp.pData, NULL); + uno_getEnvironment(&pInterm, envDcp.pData, nullptr); } else if (from_envType == uno_envType && to_envType != uno_envType) // UNO -> <ANY>? // mediate via uno(context) @@ -302,7 +302,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, rtl::OUString envDcp = uno_envType; envDcp += to_envPurpose; - uno_getEnvironment(&pInterm, envDcp.pData, NULL); + uno_getEnvironment(&pInterm, envDcp.pData, nullptr); } else // everything else // mediate via uno:purpose @@ -312,7 +312,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, rtl::OUString uno_envDcp = uno_envType; uno_envDcp += purpose; - uno_getEnvironment(&pInterm, uno_envDcp.pData, NULL); + uno_getEnvironment(&pInterm, uno_envDcp.pData, nullptr); } uno_Mapping * pMapping = new MediatorMapping(pFrom, pInterm, pTo); diff --git a/cppu/source/uno/constr.hxx b/cppu/source/uno/constr.hxx index a1242da507ce..e6fd9abbcb66 100644 --- a/cppu/source/uno/constr.hxx +++ b/cppu/source/uno/constr.hxx @@ -89,7 +89,7 @@ inline void _defaultConstructData( *static_cast<double *>(pMem) = 0.0; break; case typelib_TypeClass_STRING: - *static_cast<rtl_uString **>(pMem) = 0; + *static_cast<rtl_uString **>(pMem) = nullptr; ::rtl_uString_new( static_cast<rtl_uString **>(pMem) ); break; case typelib_TypeClass_TYPE: @@ -127,7 +127,7 @@ inline void _defaultConstructData( *static_cast<uno_Sequence **>(pMem) = createEmptySequence(); break; case typelib_TypeClass_INTERFACE: - *static_cast<void **>(pMem) = 0; // either cpp or c-uno interface + *static_cast<void **>(pMem) = nullptr; // either cpp or c-uno interface break; default: OSL_ASSERT(false); diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index f082803d66a2..ab25e062b984 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -35,12 +35,12 @@ inline uno_Sequence * allocSeq( sal_Int32 nElementSize, sal_Int32 nElements ) { OSL_ASSERT( nElements >= 0 && nElementSize >= 0 ); - uno_Sequence * pSeq = 0; + uno_Sequence * pSeq = nullptr; sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements ); if (nSize > 0) { pSeq = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize )); - if (pSeq != 0) + if (pSeq != nullptr) { // header init pSeq->nRefCount = 1; @@ -251,7 +251,7 @@ inline void _copyConstructAny( CONSTRUCT_EMPTY_ANY( pDestAny ); return; } - pTypeDescr = 0; + pTypeDescr = nullptr; pSource = static_cast<uno_Any *>(pSource)->pData; } else @@ -316,7 +316,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_STRING: pDestAny->pData = &pDestAny->pReserved; - *static_cast<rtl_uString **>(pDestAny->pData) = 0; + *static_cast<rtl_uString **>(pDestAny->pData) = nullptr; ::rtl_uString_new( static_cast<rtl_uString **>(pDestAny->pData) ); break; case typelib_TypeClass_TYPE: @@ -359,7 +359,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_INTERFACE: pDestAny->pData = &pDestAny->pReserved; - pDestAny->pReserved = 0; // either cpp or c-uno interface + pDestAny->pReserved = nullptr; // either cpp or c-uno interface break; default: OSL_ASSERT(false); @@ -393,7 +393,7 @@ inline uno_Sequence * icopyConstructSequence( case typelib_TypeClass_ANY: { pDest = allocSeq( sizeof (uno_Any), nElements ); - if (pDest != 0) + if (pDest != nullptr) { uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pDest->elements); uno_Any * pSourceElements = reinterpret_cast<uno_Any *>(pSource->elements); @@ -410,7 +410,7 @@ inline uno_Sequence * icopyConstructSequence( _copyConstructAnyFromData( &pDestElements[nPos], pSourceElements[nPos].pData, - pType, 0, + pType, nullptr, acquire, mapping ); } } @@ -420,12 +420,12 @@ inline uno_Sequence * icopyConstructSequence( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; char * pSourceElements = pSource->elements; pDest = allocSeq( nElementSize, nElements ); - if (pDest != 0) + if (pDest != nullptr) { char * pElements = pDest->elements; for ( sal_Int32 nPos = nElements; nPos--; ) @@ -445,9 +445,9 @@ inline uno_Sequence * icopyConstructSequence( { // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here pDest = allocSeq( sizeof (uno_Sequence *), nElements ); - if (pDest != 0) + if (pDest != nullptr) { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>( @@ -463,7 +463,7 @@ inline uno_Sequence * icopyConstructSequence( pSourceElements[nPos], pSeqElementType, acquire, mapping ); - OSL_ASSERT( pNew != 0 ); + OSL_ASSERT( pNew != nullptr ); // ought never be a memory allocation problem, // because of reference counted sequence handles pDestElements[ nPos ] = pNew; @@ -476,15 +476,15 @@ inline uno_Sequence * icopyConstructSequence( case typelib_TypeClass_INTERFACE: { pDest = allocSeq( sizeof (void *), nElements ); - if (pDest != 0) + if (pDest != nullptr) { char * pElements = pDest->elements; void ** pSourceElements = reinterpret_cast<void **>(pSource->elements); - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); for ( sal_Int32 nPos = nElements; nPos--; ) { - reinterpret_cast<void **>(pElements)[nPos] = 0; + reinterpret_cast<void **>(pElements)[nPos] = nullptr; if (pSourceElements[nPos]) { (*mapping->mapInterface)( @@ -500,7 +500,7 @@ inline uno_Sequence * icopyConstructSequence( } default: OSL_FAIL( "### unexepcted sequence element type!" ); - pDest = 0; + pDest = nullptr; break; } } @@ -559,7 +559,7 @@ inline void _copyConstructData( case typelib_TypeClass_ANY: _copyConstructAny( static_cast<uno_Any *>(pDest), static_cast<uno_Any *>(pSource)->pData, - static_cast<uno_Any *>(pSource)->pType, 0, + static_cast<uno_Any *>(pSource)->pType, nullptr, acquire, mapping ); break; case typelib_TypeClass_ENUM: diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index 9ae11151a006..ed0ebdd292c2 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -40,21 +40,21 @@ namespace cppu // Sequence<>() (default ctor) relies on this being static: uno_Sequence g_emptySeq = { 1, 0, { 0 } }; -typelib_TypeDescriptionReference * g_pVoidType = 0; +typelib_TypeDescriptionReference * g_pVoidType = nullptr; void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * pDestType ) { // init queryInterface() td - static typelib_TypeDescription * g_pQITD = 0; - if (0 == g_pQITD) + static typelib_TypeDescription * g_pQITD = nullptr; + if (nullptr == g_pQITD) { MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (0 == g_pQITD) + if (nullptr == g_pQITD) { typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; + typelib_InterfaceTypeDescription * pTXInterfaceDescr = nullptr; TYPELIB_DANGER_GET( reinterpret_cast<typelib_TypeDescription **>(&pTXInterfaceDescr), type_XInterface ); assert(pTXInterfaceDescr->ppAllMembers); typelib_typedescriptionreference_getDescription( @@ -70,8 +70,8 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p (*static_cast<uno_Interface *>(pUnoI)->pDispatcher)( static_cast<uno_Interface *>(pUnoI), g_pQITD, &aRet, aArgs, &pExc ); - uno_Interface * ret = 0; - if (0 == pExc) + uno_Interface * ret = nullptr; + if (nullptr == pExc) { typelib_TypeDescriptionReference * ret_type = aRet.pType; switch (ret_type->eTypeClass) @@ -85,7 +85,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p ret = static_cast<uno_Interface *>(aRet.pReserved); // serving acquired interface break; default: - _destructAny( &aRet, 0 ); + _destructAny( &aRet, nullptr ); break; } } @@ -98,7 +98,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p << OUString(pExc->pType->pTypeName) << "] " << *static_cast<OUString const *>(pExc->pData)); // Message is very first member - uno_any_destruct( pExc, 0 ); + uno_any_destruct( pExc, nullptr ); } return ret; } @@ -180,7 +180,7 @@ void SAL_CALL uno_type_constructData( void * pMem, typelib_TypeDescriptionReference * pType ) SAL_THROW_EXTERN_C() { - _defaultConstructData( pMem, pType, 0 ); + _defaultConstructData( pMem, pType, nullptr ); } void SAL_CALL uno_constructData( @@ -195,7 +195,7 @@ void SAL_CALL uno_type_destructData( uno_ReleaseFunc release ) SAL_THROW_EXTERN_C() { - _destructData( pValue, pType, 0, release ); + _destructData( pValue, pType, nullptr, release ); } void SAL_CALL uno_destructData( @@ -213,7 +213,7 @@ void SAL_CALL uno_type_copyData( uno_AcquireFunc acquire ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pType, 0, acquire, 0 ); + _copyConstructData( pDest, pSource, pType, nullptr, acquire, nullptr ); } void SAL_CALL uno_copyData( @@ -222,7 +222,7 @@ void SAL_CALL uno_copyData( uno_AcquireFunc acquire ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 ); + _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, nullptr ); } void SAL_CALL uno_type_copyAndConvertData( @@ -231,7 +231,7 @@ void SAL_CALL uno_type_copyAndConvertData( uno_Mapping * mapping ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pType, 0, 0, mapping ); + _copyConstructData( pDest, pSource, pType, nullptr, nullptr, mapping ); } void SAL_CALL uno_copyAndConvertData( @@ -240,7 +240,7 @@ void SAL_CALL uno_copyAndConvertData( uno_Mapping * mapping ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, 0, mapping ); + _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, nullptr, mapping ); } sal_Bool SAL_CALL uno_type_equalData( @@ -250,7 +250,7 @@ sal_Bool SAL_CALL uno_type_equalData( SAL_THROW_EXTERN_C() { return _equalData( - pVal1, pVal1Type, 0, + pVal1, pVal1Type, nullptr, pVal2, pVal2Type, queryInterface, release ); } @@ -274,8 +274,8 @@ sal_Bool SAL_CALL uno_type_assignData( SAL_THROW_EXTERN_C() { return _assignData( - pDest, pDestType, 0, - pSource, pSourceType, 0, + pDest, pDestType, nullptr, + pSource, pSourceType, nullptr, queryInterface, acquire, release ); } @@ -306,17 +306,17 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( } // query - if (0 == pFrom) + if (nullptr == pFrom) return sal_False; void * pInterface = *static_cast<void **>(pFrom); - if (0 == pInterface) + if (nullptr == pInterface) return sal_False; - if (0 == queryInterface) + if (nullptr == queryInterface) queryInterface = binuno_queryInterface; void * p = (*queryInterface)( pInterface, pAssignable ); _release( p, release ); - return (0 != p); + return (nullptr != p); } } diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 1f0cc3213bb3..1bf9313801d0 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -113,7 +113,7 @@ inline void _destructAny( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); _destructStruct( pAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr), release ); TYPELIB_DANGER_RELEASE( pTypeDescr ); @@ -123,7 +123,7 @@ inline void _destructAny( case typelib_TypeClass_SEQUENCE: { destructSequence( - static_cast<uno_Sequence *>(pAny->pReserved), pType, 0, release ); + static_cast<uno_Sequence *>(pAny->pReserved), pType, nullptr, release ); break; } case typelib_TypeClass_INTERFACE: @@ -198,7 +198,7 @@ inline sal_Int32 idestructElements( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -214,7 +214,7 @@ inline sal_Int32 idestructElements( } case typelib_TypeClass_SEQUENCE: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); uno_Sequence ** pDest = static_cast<uno_Sequence **>(pElements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx index cd734ed2e215..92acdcded26f 100644 --- a/cppu/source/uno/eq.hxx +++ b/cppu/source/uno/eq.hxx @@ -39,19 +39,19 @@ inline bool _equalObject( { if (pI1 == pI2) return true; - if ((0 == pI1) || (0 == pI2)) + if ((nullptr == pI1) || (nullptr == pI2)) return false; bool bRet = false; typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - if (0 == queryInterface) + if (nullptr == queryInterface) queryInterface = binuno_queryInterface; pI1 = (*queryInterface)( pI1, type_XInterface ); - if (0 != pI1) + if (nullptr != pI1) { pI2 = (*queryInterface)( pI2, type_XInterface ); - if (0 != pI2) + if (nullptr != pI2) { bRet = (pI1 == pI2); _release( pI2, release ); @@ -204,7 +204,7 @@ inline bool _equalSequence( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; for ( sal_Int32 nPos = nElements; nPos--; ) @@ -223,7 +223,7 @@ inline bool _equalSequence( } case typelib_TypeClass_SEQUENCE: // sequence of sequence { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pElementTypeDescr)->pType; @@ -268,7 +268,7 @@ inline bool _equalData( typelib_TypeClass eSourceTypeClass, eDestTypeClass; while (typelib_TypeClass_ANY == (eDestTypeClass = pDestType->eTypeClass)) { - pDestTypeDescr = 0; + pDestTypeDescr = nullptr; pDestType = static_cast<uno_Any *>(pDest)->pType; pDest = static_cast<uno_Any *>(pDest)->pData; } diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index e1d294f53682..07ca0659bdad 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -189,7 +189,7 @@ inline InterfaceEntry * ObjectEntry::find( { OSL_ASSERT( ! aInterfaces.empty() ); if (aInterfaces.empty()) - return 0; + return nullptr; // shortcut common case: OUString const & type_name = @@ -211,7 +211,7 @@ inline InterfaceEntry * ObjectEntry::find( pITD = pITD->pBaseTypeDescription; } } - return 0; + return nullptr; } @@ -250,7 +250,7 @@ static void SAL_CALL defenv_registerInterface( ObjectEntry * pOEntry = new ObjectEntry( rOId ); insertion.first->second = pOEntry; ++pOEntry->nRef; // another register call on object - pOEntry->append( that, *ppInterface, pTypeDescr, 0 ); + pOEntry->append( that, *ppInterface, pTypeDescr, nullptr ); } else // object entry exists { @@ -272,7 +272,7 @@ static void SAL_CALL defenv_registerInterface( } else { - pOEntry->append( that, *ppInterface, pTypeDescr, 0 ); + pOEntry->append( that, *ppInterface, pTypeDescr, nullptr ); } } } @@ -307,7 +307,7 @@ static void SAL_CALL defenv_registerProxyInterface( // first registration was an original, then registerProxyInterface(): pOEntry->mixedObject |= (!pOEntry->aInterfaces.empty() && - pOEntry->aInterfaces[ 0 ].fpFreeProxy == 0); + pOEntry->aInterfaces[ 0 ].fpFreeProxy == nullptr); ++pOEntry->nRef; // another register call on object InterfaceEntry * pIEntry = pOEntry->find( pTypeDescr ); @@ -384,7 +384,7 @@ static void SAL_CALL s_stub_defenv_revokeInterface(va_list * pParam) else if (pOEntry->mixedObject) { OSL_ASSERT( !pOEntry->aInterfaces.empty() && - pOEntry->aInterfaces[ 0 ].fpFreeProxy == 0 ); + pOEntry->aInterfaces[ 0 ].fpFreeProxy == nullptr ); sal_Int32 index = pOEntry->find( pInterface, 1 ); OSL_ASSERT( index > 0 ); @@ -392,7 +392,7 @@ static void SAL_CALL s_stub_defenv_revokeInterface(va_list * pParam) { InterfaceEntry & entry = pOEntry->aInterfaces[ index ]; OSL_ASSERT( entry.pInterface == pInterface ); - if (entry.fpFreeProxy != 0) + if (entry.fpFreeProxy != nullptr) { --entry.refCount; if (entry.refCount == 0) @@ -436,7 +436,7 @@ static void SAL_CALL defenv_getObjectIdentifier( if (*ppOId) { ::rtl_uString_release( *ppOId ); - *ppOId = 0; + *ppOId = nullptr; } uno_DefaultEnvironment * that = @@ -467,7 +467,7 @@ static void SAL_CALL defenv_getRegisteredInterface( if (*ppInterface) { (*pEnv->releaseInterface)( pEnv, *ppInterface ); - *ppInterface = 0; + *ppInterface = nullptr; } OUString const & rOId = OUString::unacquired( &pOId ); @@ -567,7 +567,7 @@ static void SAL_CALL defenv_harden( if (*ppHardEnv) { (*(*ppHardEnv)->release)( *ppHardEnv ); - *ppHardEnv = 0; + *ppHardEnv = nullptr; } EnvironmentsData & rData = theEnvironmentsData::get(); @@ -601,7 +601,7 @@ uno_DefaultEnvironment::uno_DefaultEnvironment( nWeakRef( 0 ) { uno_Environment * that = reinterpret_cast< uno_Environment * >(this); - that->pReserved = 0; + that->pReserved = nullptr; // functions that->acquire = defenv_acquire; that->release = defenv_release; @@ -616,7 +616,7 @@ uno_DefaultEnvironment::uno_DefaultEnvironment( that->pContext = pContext_; // will be late initialized - that->environmentDisposing = 0; + that->environmentDisposing = nullptr; uno_ExtEnvironment::registerInterface = defenv_registerInterface; uno_ExtEnvironment::registerProxyInterface = defenv_registerProxyInterface; @@ -777,8 +777,8 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName( void * stream, rtl_uString * pEnvDcp, const sal_Char * pFilter ) SAL_THROW_EXTERN_C() { - uno_Environment * pEnv = 0; - uno_getEnvironment( &pEnv, pEnvDcp, 0 ); + uno_Environment * pEnv = nullptr; + uno_getEnvironment( &pEnv, pEnvDcp, nullptr ); if (pEnv) { ::uno_dumpEnvironment( stream, pEnv, pFilter ); @@ -808,7 +808,7 @@ namespace // pid oslProcessInfo info; info.Size = sizeof(oslProcessInfo); - if (::osl_getProcessInfo( 0, osl_Process_IDENTIFIER, &info ) == + if (::osl_getProcessInfo( nullptr, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) { aRet.append( (sal_Int64)info.Ident, 16 ); @@ -849,14 +849,14 @@ static void SAL_CALL unoenv_computeObjectIdentifier( if (*ppOId) { ::rtl_uString_release( *ppOId ); - *ppOId = 0; + *ppOId = nullptr; } uno_Interface * pUnoI = static_cast<uno_Interface *>( ::cppu::binuno_queryInterface( pInterface, *typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ) )); - if (0 != pUnoI) + if (nullptr != pUnoI) { (*pUnoI->release)( pUnoI ); // interface @@ -904,7 +904,7 @@ EnvironmentsData::~EnvironmentsData() iPos != aName2EnvMap.end(); ++iPos ) { uno_Environment * pWeak = iPos->second; - uno_Environment * pHard = 0; + uno_Environment * pHard = nullptr; (*pWeak->harden)( &pHard, pWeak ); (*pWeak->releaseWeak)( pWeak ); @@ -926,7 +926,7 @@ inline void EnvironmentsData::getEnvironment( if (*ppEnv) { (*(*ppEnv)->release)( *ppEnv ); - *ppEnv = 0; + *ppEnv = nullptr; } OUString aKey( @@ -966,7 +966,7 @@ inline void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv ) } else { - uno_Environment * pHard = 0; + uno_Environment * pHard = nullptr; uno_Environment * pWeak = iFind->second; (*pWeak->harden)( &pHard, pWeak ); if (pHard) @@ -1003,7 +1003,7 @@ inline void EnvironmentsData::getRegisteredEnvironments( if (rEnvDcp.isEmpty() || rEnvDcp.equals( pWeak->pTypeName )) { - ppFound[nSize] = 0; + ppFound[nSize] = nullptr; (*pWeak->harden)( &ppFound[nSize], pWeak ); if (ppFound[nSize]) ++nSize; @@ -1023,7 +1023,7 @@ inline void EnvironmentsData::getRegisteredEnvironments( } else { - *pppEnvs = 0; + *pppEnvs = nullptr; } } @@ -1103,7 +1103,7 @@ static uno_Environment * initDefaultEnvironment( if(!loadEnv(libStem, pEnv)) { pEnv->release(pEnv); - return NULL; + return nullptr; } } } @@ -1118,7 +1118,7 @@ static uno_Environment * initDefaultEnvironment( if (!loadEnv(aStr, pEnv)) { pEnv->release(pEnv); - return NULL; + return nullptr; } } diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index 82060fd72b01..442c34172212 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -62,7 +62,7 @@ class Mapping uno_Mapping * _pMapping; public: - inline explicit Mapping( uno_Mapping * pMapping = 0 ); + inline explicit Mapping( uno_Mapping * pMapping = nullptr ); inline Mapping( const Mapping & rMapping ); inline ~Mapping(); inline Mapping & SAL_CALL operator = ( uno_Mapping * pMapping ); @@ -71,7 +71,7 @@ public: inline uno_Mapping * SAL_CALL get() const { return _pMapping; } inline bool SAL_CALL is() const - { return (_pMapping != 0); } + { return (_pMapping != nullptr); } }; inline Mapping::Mapping( uno_Mapping * pMapping ) @@ -152,7 +152,7 @@ struct MappingsData static MappingsData & getMappingsData() { - static MappingsData * s_p = 0; + static MappingsData * s_p = nullptr; if (! s_p) { MutexGuard aGuard( Mutex::getGlobalMutex() ); @@ -228,18 +228,18 @@ static void SAL_CALL mediate_mapInterface( uno_Mediate_Mapping * that = static_cast< uno_Mediate_Mapping * >( pMapping ); uno_Mapping * pFrom2Uno = that->aFrom2Uno.get(); - uno_Interface * pUnoI = 0; + uno_Interface * pUnoI = nullptr; (*pFrom2Uno->mapInterface)( pFrom2Uno, reinterpret_cast<void **>(&pUnoI), pInterface, pInterfaceTypeDescr ); - if (0 == pUnoI) + if (nullptr == pUnoI) { void * pOut = *ppOut; - if (0 != pOut) + if (nullptr != pOut) { uno_ExtEnvironment * pTo = that->aTo.get()->pExtEnv; - OSL_ENSURE( 0 != pTo, "### cannot release out interface: leaking!" ); - if (0 != pTo) + OSL_ENSURE( nullptr != pTo, "### cannot release out interface: leaking!" ); + if (nullptr != pTo) (*pTo->releaseInterface)( pTo, pOut ); - *ppOut = 0; // set to 0 anyway, because mapping was not successful! + *ppOut = nullptr; // set to 0 anyway, because mapping was not successful! } } else @@ -508,7 +508,7 @@ static Mapping getMediateMapping( else { // get registered uno env - ::uno_getEnvironment( reinterpret_cast<uno_Environment **>(&aUno), aUnoEnvTypeName.pData, 0 ); + ::uno_getEnvironment( reinterpret_cast<uno_Environment **>(&aUno), aUnoEnvTypeName.pData, nullptr ); aUno2To = getDirectMapping( aUno, rTo ); // : uno <-> to @@ -521,7 +521,7 @@ static Mapping getMediateMapping( { // create anonymous uno env Environment aAnUno; - ::uno_createEnvironment( reinterpret_cast<uno_Environment **>(&aAnUno), aUnoEnvTypeName.pData, 0 ); + ::uno_createEnvironment( reinterpret_cast<uno_Environment **>(&aAnUno), aUnoEnvTypeName.pData, nullptr ); Mapping aAnUno2Uno( getDirectMapping( aAnUno, aUno, rAddPurpose ) ); if (! aAnUno2Uno.is()) @@ -562,13 +562,13 @@ void SAL_CALL uno_getMapping( rtl_uString * pAddPurpose ) SAL_THROW_EXTERN_C() { - assert(ppMapping != 0); - assert(pFrom != 0); - assert(pTo != 0); + assert(ppMapping != nullptr); + assert(pFrom != nullptr); + assert(pTo != nullptr); if (*ppMapping) { (*(*ppMapping)->release)( *ppMapping ); - *ppMapping = 0; + *ppMapping = nullptr; } Mapping aRet; @@ -636,16 +636,16 @@ void SAL_CALL uno_getMappingByName( if (*ppMapping) { (*(*ppMapping)->release)( *ppMapping ); - *ppMapping = 0; + *ppMapping = nullptr; } - uno_Environment * pEFrom = 0; - uno_getEnvironment( &pEFrom, pFrom, 0 ); + uno_Environment * pEFrom = nullptr; + uno_getEnvironment( &pEFrom, pFrom, nullptr ); OSL_ENSURE( pEFrom, "### cannot get source environment!" ); if (pEFrom) { - uno_Environment * pETo = 0; - uno_getEnvironment( &pETo, pTo, 0 ); + uno_Environment * pETo = nullptr; + uno_getEnvironment( &pETo, pTo, nullptr ); OSL_ENSURE( pETo, "### cannot get target environment!" ); if (pETo) { diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index 3fcdb132d888..cf66016353cd 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -51,7 +51,7 @@ inline void * _map( uno_Mapping * mapping ) { - void * pRet = 0; + void * pRet = nullptr; if (p) { if (pTypeDescr) diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index cd536a853614..3b5f01fdacee 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -45,11 +45,11 @@ static inline uno_Sequence * reallocSeq( uno_Sequence * pReallocate, sal_Size nElementSize, sal_Int32 nElements ) { OSL_ASSERT( nElements >= 0 ); - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements ); if (nSize > 0) { - if (pReallocate == 0) + if (pReallocate == nullptr) { pNew = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize )); } @@ -57,7 +57,7 @@ static inline uno_Sequence * reallocSeq( { pNew = static_cast<uno_Sequence *>(rtl_reallocateMemory( pReallocate, nSize )); } - if (pNew != 0) + if (pNew != nullptr) { // header init pNew->nRefCount = 1; @@ -80,7 +80,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_CHAR: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), @@ -91,7 +91,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_BOOLEAN: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Bool) * nStartIndex), @@ -102,7 +102,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_BYTE: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int8) * nStartIndex), @@ -114,7 +114,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_UNSIGNED_SHORT: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int16) * nStartIndex), @@ -126,7 +126,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_UNSIGNED_LONG: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), @@ -138,7 +138,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_UNSIGNED_HYPER: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int64) * nStartIndex), @@ -150,7 +150,7 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(float), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { float * pElements = reinterpret_cast<float *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -164,7 +164,7 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { double * pElements = reinterpret_cast<double *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -178,12 +178,12 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { rtl_uString ** pElements = reinterpret_cast<rtl_uString **>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { - pElements[nPos] = 0; + pElements[nPos] = nullptr; rtl_uString_new( &pElements[nPos] ); } } @@ -196,7 +196,7 @@ static inline bool idefaultConstructElements( pSeq = reallocSeq( pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc ); } - if (pSeq != 0) + if (pSeq != nullptr) { typelib_TypeDescriptionReference ** pElements = reinterpret_cast<typelib_TypeDescriptionReference **>(pSeq->elements); @@ -211,7 +211,7 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { uno_Any * pElements = reinterpret_cast<uno_Any *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -225,9 +225,9 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 eEnum = reinterpret_cast<typelib_EnumTypeDescription *>( @@ -245,13 +245,13 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { char * pElements = pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -272,7 +272,7 @@ static inline bool idefaultConstructElements( // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here pSeq = reallocSeq(pSeq, sizeof(uno_Sequence*), nAlloc); } - if (pSeq != 0) + if (pSeq != nullptr) { uno_Sequence ** pElements = reinterpret_cast<uno_Sequence **>(pSeq->elements); @@ -286,7 +286,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_INTERFACE: // either C++ or C-UNO interface if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(void *) * nStartIndex), @@ -296,11 +296,11 @@ static inline bool idefaultConstructElements( break; default: OSL_FAIL( "### unexpected element type!" ); - pSeq = 0; + pSeq = nullptr; break; } - if (pSeq == 0) + if (pSeq == nullptr) { OSL_ASSERT( nAlloc >= 0 ); // must have been an allocation failure return false; @@ -326,7 +326,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_CHAR: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), @@ -337,7 +337,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_BOOLEAN: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Bool) * nStartIndex), @@ -348,7 +348,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_BYTE: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int8) * nStartIndex), @@ -360,7 +360,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_UNSIGNED_SHORT: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int16) * nStartIndex), @@ -372,7 +372,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_UNSIGNED_LONG: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), @@ -384,7 +384,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_UNSIGNED_HYPER: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int64) * nStartIndex), @@ -395,7 +395,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_FLOAT: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(float), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(float) * nStartIndex), @@ -406,7 +406,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_DOUBLE: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(double) * nStartIndex), @@ -417,7 +417,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_ENUM: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), @@ -429,7 +429,7 @@ static inline bool icopyConstructFromElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { rtl_uString ** pDestElements = reinterpret_cast<rtl_uString **>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -450,7 +450,7 @@ static inline bool icopyConstructFromElements( pSeq = reallocSeq( pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc ); } - if (pSeq != 0) + if (pSeq != nullptr) { typelib_TypeDescriptionReference ** pDestElements = reinterpret_cast<typelib_TypeDescriptionReference **>(pSeq->elements); @@ -470,7 +470,7 @@ static inline bool icopyConstructFromElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -479,8 +479,8 @@ static inline bool icopyConstructFromElements( _copyConstructAny( &pDestElements[nPos], pSource->pData, - pSource->pType, 0, - acquire, 0 ); + pSource->pType, nullptr, + acquire, nullptr ); } } break; @@ -488,13 +488,13 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { char * pDestElements = pSeq->elements; @@ -512,7 +512,7 @@ static inline bool icopyConstructFromElements( // copy base value _copyConstructStruct( pDest, pSource, - pTypeDescr->pBaseTypeDescription, acquire, 0 ); + pTypeDescr->pBaseTypeDescription, acquire, nullptr ); } // then copy members @@ -541,9 +541,9 @@ static inline bool icopyConstructFromElements( // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here pSeq = reallocSeq(pSeq, sizeof(uno_Sequence*), nAlloc); } - if (pSeq != 0) + if (pSeq != nullptr) { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pElementTypeDescr)->pType; @@ -552,8 +552,8 @@ static inline bool icopyConstructFromElements( { uno_Sequence * pNew = icopyConstructSequence( static_cast<uno_Sequence **>(pSourceElements)[nPos], - pSeqElementType, acquire, 0 ); - OSL_ASSERT( pNew != 0 ); + pSeqElementType, acquire, nullptr ); + OSL_ASSERT( pNew != nullptr ); // ought never be a memory allocation problem, // because of reference counted sequence handles pDestElements[ nPos ] = pNew; @@ -566,7 +566,7 @@ static inline bool icopyConstructFromElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { void ** pDestElements = reinterpret_cast<void **>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -579,11 +579,11 @@ static inline bool icopyConstructFromElements( } default: OSL_FAIL( "### unexpected element type!" ); - pSeq = 0; + pSeq = nullptr; break; } - if (pSeq == 0) + if (pSeq == nullptr) { OSL_ASSERT( nAlloc >= 0 ); // must have been an allocation failure return false; @@ -613,7 +613,7 @@ static inline bool ireallocSequence( typelib_TypeClass_EXCEPTION == pElementType->eTypeClass) { // split sequence and construct new one from scratch - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; sal_Int32 nRest = nSize - nElements; sal_Int32 nCopy = (nRest > 0 ? nElements : nSize); @@ -667,8 +667,8 @@ static inline bool ireallocSequence( // warning: it is assumed that the following will never fail, // else this leads to a sequence null handle *ppSequence = reallocSeq( pSeq, nElementSize, nSize ); - OSL_ASSERT( *ppSequence != 0 ); - ret = (*ppSequence != 0); + OSL_ASSERT( *ppSequence != nullptr ); + ret = (*ppSequence != nullptr); } } @@ -691,14 +691,14 @@ sal_Bool SAL_CALL uno_type_sequence_construct( bool ret; if (len) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); typelib_TypeDescriptionReference * pElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType; - *ppSequence = 0; - if (pElements == 0) + *ppSequence = nullptr; + if (pElements == nullptr) { ret = idefaultConstructElements( ppSequence, pElementType, @@ -721,7 +721,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( ret = true; } - OSL_ASSERT( (*ppSequence != 0) == ret ); + OSL_ASSERT( (*ppSequence != nullptr) == ret ); return ret; } @@ -738,8 +738,8 @@ sal_Bool SAL_CALL uno_sequence_construct( typelib_TypeDescriptionReference * pElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType; - *ppSequence = 0; - if (pElements == 0) + *ppSequence = nullptr; + if (pElements == nullptr) { ret = idefaultConstructElements( ppSequence, pElementType, @@ -760,7 +760,7 @@ sal_Bool SAL_CALL uno_sequence_construct( ret = true; } - OSL_ASSERT( (*ppSequence != 0) == ret ); + OSL_ASSERT( (*ppSequence != nullptr) == ret ); return ret; } @@ -776,7 +776,7 @@ sal_Bool SAL_CALL uno_type_sequence_realloc( bool ret = true; if (nSize != (*ppSequence)->nElements) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); ret = ireallocSequence( ppSequence, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, @@ -817,10 +817,10 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( uno_Sequence * pSequence = *ppSequence; if (pSequence->nRefCount > 1) { - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; if (pSequence->nElements > 0) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); ret = icopyConstructFromElements( @@ -839,7 +839,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( else { pNew = allocSeq( 0, 0 ); - ret = (pNew != 0); + ret = (pNew != nullptr); if (ret) { // easy destruction of empty sequence: @@ -864,7 +864,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( uno_Sequence * pSequence = *ppSequence; if (pSequence->nRefCount > 1) { - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; if (pSequence->nElements > 0) { ret = icopyConstructFromElements( @@ -882,7 +882,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( else { pNew = allocSeq( 0, 0 ); - ret = (pNew != 0); + ret = (pNew != nullptr); if (ret) { // easy destruction of empty sequence: @@ -923,7 +923,7 @@ void SAL_CALL uno_type_sequence_assign( if (*ppDest != pSource) { osl_atomic_increment( &pSource->nRefCount ); - idestructSequence( *ppDest, pType, 0, release ); + idestructSequence( *ppDest, pType, nullptr, release ); *ppDest = pSource; } } diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 09d3a148c5ff..9f0de98acf1a 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -51,7 +51,7 @@ namespace uno inline Any::Any() { - ::uno_any_construct( this, 0, 0, cpp_acquire ); + ::uno_any_construct( this, NULL, NULL, cpp_acquire ); } diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h index a4bdf7c6fbba..58009a3d7da9 100644 --- a/include/com/sun/star/uno/Reference.h +++ b/include/com/sun/star/uno/Reference.h @@ -90,7 +90,7 @@ public: @return true if reference acquires an interface, i.e. true if it is not null */ inline bool SAL_CALL is() const - { return (0 != _pInterface); } + { return (NULL != _pInterface); } /** Equality operator: compares two interfaces Checks if both references are null or refer to the same object. diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx index 1ba4e48d2524..7e8b4db279e2 100644 --- a/include/com/sun/star/uno/Reference.hxx +++ b/include/com/sun/star/uno/Reference.hxx @@ -51,11 +51,11 @@ inline XInterface * BaseReference::iquery( if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass) { XInterface * pRet = static_cast< XInterface * >( aRet.pReserved ); - aRet.pReserved = 0; + aRet.pReserved = NULL; return pRet; } } - return 0; + return NULL; } template< class interface_type > @@ -167,7 +167,7 @@ template< class interface_type > inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Query ) { _pInterface = (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass - ? iquery( static_cast< XInterface * >( rAny.pReserved ) ) : 0); + ? iquery( static_cast< XInterface * >( rAny.pReserved ) ) : NULL); } template< class interface_type > @@ -186,7 +186,7 @@ template< class interface_type > inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_QueryThrow ) { _pInterface = iquery_throw( typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass - ? static_cast< XInterface * >( rAny.pReserved ) : 0 ); + ? static_cast< XInterface * >( rAny.pReserved ) : NULL ); } template< class interface_type > @@ -275,7 +275,7 @@ inline bool Reference< interface_type >::set( castFromXInterface( iquery( rAny.pType->eTypeClass == typelib_TypeClass_INTERFACE - ? static_cast< XInterface * >( rAny.pReserved ) : 0 )), + ? static_cast< XInterface * >( rAny.pReserved ) : NULL )), SAL_NO_ACQUIRE ); } @@ -302,7 +302,7 @@ inline void Reference< interface_type >::set( set( castFromXInterface( iquery_throw( rAny.pType->eTypeClass == typelib_TypeClass_INTERFACE - ? static_cast< XInterface * >( rAny.pReserved ) : 0 )), + ? static_cast< XInterface * >( rAny.pReserved ) : NULL )), SAL_NO_ACQUIRE ); } diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx index b23283e1d896..c52293223fed 100644 --- a/include/com/sun/star/uno/Sequence.hxx +++ b/include/com/sun/star/uno/Sequence.hxx @@ -41,7 +41,7 @@ namespace uno /// @cond INTERNAL template< class E > -typelib_TypeDescriptionReference * Sequence< E >::s_pType = 0; +typelib_TypeDescriptionReference * Sequence< E >::s_pType = NULL; /// @endcond template< class E > @@ -230,8 +230,8 @@ getTypeFavourChar( { //TODO On certain platforms with weak memory models, the following code can // result in some threads observing that td points to garbage: - static typelib_TypeDescriptionReference * td = 0; - if (td == 0) { + static typelib_TypeDescriptionReference * td = NULL; + if (td == NULL) { ::typelib_static_sequence_type_init( &td, (::cppu::getTypeFavourChar( @@ -274,7 +274,7 @@ SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType ) inline const ::com::sun::star::uno::Type & SAL_CALL getCharSequenceCppuType() { - static typelib_TypeDescriptionReference * s_pType_com_sun_star_uno_Sequence_Char = 0; + static typelib_TypeDescriptionReference * s_pType_com_sun_star_uno_Sequence_Char = NULL; if (! s_pType_com_sun_star_uno_Sequence_Char) { const ::com::sun::star::uno::Type & rElementType = cppu::UnoType<cppu::UnoCharType>::get(); diff --git a/include/com/sun/star/uno/Type.hxx b/include/com/sun/star/uno/Type.hxx index 6b22224c4e4a..0d88928fe445 100644 --- a/include/com/sun/star/uno/Type.hxx +++ b/include/com/sun/star/uno/Type.hxx @@ -40,13 +40,13 @@ inline Type::Type() } inline Type::Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName ) - : _pType( 0 ) + : _pType( NULL ) { ::typelib_typedescriptionreference_new( &_pType, (typelib_TypeClass)eTypeClass, rTypeName.pData ); } inline Type::Type( TypeClass eTypeClass, const sal_Char * pTypeName ) - : _pType( 0 ) + : _pType( NULL ) { ::typelib_typedescriptionreference_newByAsciiName( &_pType, (typelib_TypeClass)eTypeClass, pTypeName ); } @@ -86,7 +86,7 @@ inline Type & Type::operator = ( const Type & rType ) template< class T > -typelib_TypeDescriptionReference * Array< T >::s_pType = 0; +typelib_TypeDescriptionReference * Array< T >::s_pType = NULL; } } diff --git a/include/com/sun/star/uno/genfunc.hxx b/include/com/sun/star/uno/genfunc.hxx index a33de80b2c43..9583375c6aed 100644 --- a/include/com/sun/star/uno/genfunc.hxx +++ b/include/com/sun/star/uno/genfunc.hxx @@ -55,7 +55,7 @@ inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescription if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass) { XInterface * pRet = static_cast< XInterface * >( aRet.pReserved ); - aRet.pReserved = 0; + aRet.pReserved = NULL; return pRet; } } @@ -63,7 +63,7 @@ inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescription { } } - return 0; + return NULL; } } diff --git a/include/cppu/unotype.hxx b/include/cppu/unotype.hxx index edacc774f723..5b4cb4c6fe2c 100644 --- a/include/cppu/unotype.hxx +++ b/include/cppu/unotype.hxx @@ -206,8 +206,8 @@ cppu_detail_getUnoType( SAL_UNUSED_PARAMETER ::cppu::UnoSequenceType< T > const *) { //TODO: depending on memory model, the following might not work reliably - static typelib_TypeDescriptionReference * p = 0; - if (p == 0) { + static typelib_TypeDescriptionReference * p = NULL; + if (p == NULL) { ::typelib_static_sequence_type_init( &p, ::cppu::UnoType< T >::get().getTypeLibType()); } diff --git a/include/typelib/typedescription.hxx b/include/typelib/typedescription.hxx index 2b5e855193dd..26252a344023 100644 --- a/include/typelib/typedescription.hxx +++ b/include/typelib/typedescription.hxx @@ -62,7 +62,7 @@ public: @param pTypeDescr a type description */ - inline TypeDescription( typelib_TypeDescription * pTypeDescr = 0 ); + inline TypeDescription( typelib_TypeDescription * pTypeDescr = NULL ); /** Constructor: @param pTypeDescrRef a type description reference @@ -135,7 +135,7 @@ public: @return true, if a type description is set, false otherwise */ inline bool SAL_CALL is() const - { return (_pTypeDescr != 0); } + { return (_pTypeDescr != NULL); } }; inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) @@ -146,14 +146,14 @@ inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) } inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) - : _pTypeDescr( 0 ) + : _pTypeDescr( NULL ) { if (pTypeDescrRef) typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef ); } inline TypeDescription::TypeDescription( const css::uno::Type & rType ) - : _pTypeDescr( 0 ) + : _pTypeDescr( NULL ) { if (rType.getTypeLibType()) typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() ); @@ -167,13 +167,13 @@ inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr ) } inline TypeDescription::TypeDescription( rtl_uString * pTypeName ) - : _pTypeDescr( 0 ) + : _pTypeDescr( NULL ) { typelib_typedescription_getByName( &_pTypeDescr , pTypeName ); } inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName ) - : _pTypeDescr( 0 ) + : _pTypeDescr( NULL ) { typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData ); } |