summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-01-15 13:50:26 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-01-15 15:58:07 +0100
commit29bc12777ceffd00ed0ae103b8f2affa26897b4e (patch)
tree137886309baa148e3e84646f89600c00dd37d0fe /include
parentfe37aa64ff79abcd3aeedeb03d8d74798225a367 (diff)
Let loplugin:nullptr look into template instantiations
It missed some occurrences of 0 when only looking into uninstantiated template code, as Clang doesn't model them with an ImplicitCastExpr, even if the target is known to be a (dependent) pointer type. Looking into all template instantiations of course carries the risk that a given use of 0 is meant to be interpreted as a pointer in some and as an integer in other instantiations. But the only case where that happened in the current code base is RegistryValueList::getElement (include/registry/registry.hxx), where {} is arguably a better choice anyway. (And which would presumably also hold for any future such cases.) Change-Id: I708bcfc8bedc0a49c9282d7814eb325afa29905c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128462 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/com/sun/star/uno/Any.hxx2
-rw-r--r--include/com/sun/star/uno/Sequence.hxx6
-rw-r--r--include/comphelper/newarray.hxx2
-rw-r--r--include/cppu/unotype.hxx4
-rw-r--r--include/cppuhelper/interfacecontainer.hxx2
-rw-r--r--include/oox/drawingml/chart/modelbase.hxx2
-rw-r--r--include/oox/helper/containerhelper.hxx6
-rw-r--r--include/oox/helper/refmap.hxx2
-rw-r--r--include/oox/helper/refvector.hxx2
-rw-r--r--include/registry/registry.hxx2
10 files changed, 15 insertions, 15 deletions
diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx
index 28d45f1ec21d..f1e5f86c8af2 100644
--- a/include/com/sun/star/uno/Any.hxx
+++ b/include/com/sun/star/uno/Any.hxx
@@ -202,7 +202,7 @@ inline bool Any::isExtractableTo( const Type & rType ) const
template <typename T>
inline bool Any::has() const
{
- Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(0));
+ Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(NULL));
return ::uno_type_isAssignableFromData(
rType.getTypeLibType(), pData, pType,
cpp_queryInterface,
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx
index e6643a2ec2f4..34d5def3b4f7 100644
--- a/include/com/sun/star/uno/Sequence.hxx
+++ b/include/com/sun/star/uno/Sequence.hxx
@@ -326,13 +326,13 @@ template< typename T > inline ::com::sun::star::uno::Type const &
getTypeFavourUnsigned(
SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T > const *)
{
- if (::com::sun::star::uno::Sequence< T >::s_pType == 0) {
+ if (::com::sun::star::uno::Sequence< T >::s_pType == NULL) {
::typelib_static_sequence_type_init(
&::com::sun::star::uno::Sequence< T >::s_pType,
(::cppu::getTypeFavourUnsigned(
static_cast<
typename ::com::sun::star::uno::Sequence< T >::ElementType * >(
- 0)).
+ NULL)).
getTypeLibType()));
}
return detail::getTypeFromTypeDescriptionReference(
@@ -352,7 +352,7 @@ getTypeFavourChar(
(::cppu::getTypeFavourChar(
static_cast<
typename ::com::sun::star::uno::Sequence< T >::ElementType * >(
- 0)).
+ NULL)).
getTypeLibType()));
}
return detail::getTypeFromTypeDescriptionReference(&td);
diff --git a/include/comphelper/newarray.hxx b/include/comphelper/newarray.hxx
index 6764cb3bfe3b..d3eaccd77ee5 100644
--- a/include/comphelper/newarray.hxx
+++ b/include/comphelper/newarray.hxx
@@ -30,7 +30,7 @@ template<typename T> T *
newArray_null(size_t const n) noexcept
{
if ((::std::numeric_limits<size_t>::max() / sizeof(T)) <= n) {
- return 0;
+ return nullptr;
}
return new (::std::nothrow) T[n];
}
diff --git a/include/cppu/unotype.hxx b/include/cppu/unotype.hxx
index 81e59de5993d..e794747ba097 100644
--- a/include/cppu/unotype.hxx
+++ b/include/cppu/unotype.hxx
@@ -241,7 +241,7 @@ cppu_detail_getUnoType(
SAL_UNUSED_PARAMETER css::uno::Sequence< T > const *)
{
return cppu_detail_getUnoType(
- static_cast< ::cppu::UnoSequenceType< T > * >(0));
+ static_cast< ::cppu::UnoSequenceType< T > * >(NULL));
}
inline css::uno::Type const & cppu_detail_getUnoType(
@@ -297,7 +297,7 @@ public:
#else
typedef T T1;
#endif
- return cppu_detail_getUnoType(static_cast< T1 * >(0));
+ return cppu_detail_getUnoType(static_cast< T1 * >(NULL));
}
private:
diff --git a/include/cppuhelper/interfacecontainer.hxx b/include/cppuhelper/interfacecontainer.hxx
index 09b47b5ffb72..a3bb65e4d0cc 100644
--- a/include/cppuhelper/interfacecontainer.hxx
+++ b/include/cppuhelper/interfacecontainer.hxx
@@ -50,7 +50,7 @@ inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::~OMu
while( iter != end )
{
delete static_cast<OInterfaceContainerHelper*>((*iter).second);
- (*iter).second = 0;
+ (*iter).second = NULL;
++iter;
}
delete m_pMap;
diff --git a/include/oox/drawingml/chart/modelbase.hxx b/include/oox/drawingml/chart/modelbase.hxx
index cd4e97176736..cdec3da17ce4 100644
--- a/include/oox/drawingml/chart/modelbase.hxx
+++ b/include/oox/drawingml/chart/modelbase.hxx
@@ -38,7 +38,7 @@ public:
ModelRef() {}
ModelRef( const std::shared_ptr< ModelType >& rxModel ) : std::shared_ptr< ModelType >( rxModel ) {}
- bool is() const { return this->get() != 0; }
+ bool is() const { return this->get() != nullptr; }
ModelType& create() { (*this) = std::make_shared<ModelType>(); return **this; }
template< typename Param1Type >
diff --git a/include/oox/helper/containerhelper.hxx b/include/oox/helper/containerhelper.hxx
index 10af6995f52c..3b725d5094ba 100644
--- a/include/oox/helper/containerhelper.hxx
+++ b/include/oox/helper/containerhelper.hxx
@@ -245,13 +245,13 @@ public:
template< typename VectorType >
/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex )
{
- return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : nullptr;
}
template< typename VectorType >
/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex )
{
- return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : nullptr;
}
template< typename VectorType >
@@ -264,7 +264,7 @@ template< typename MapType >
/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey )
{
typename MapType::const_iterator aIt = rMap.find( rKey );
- return (aIt == rMap.end()) ? 0 : &aIt->second;
+ return (aIt == rMap.end()) ? nullptr : &aIt->second;
}
template< typename MapType >
diff --git a/include/oox/helper/refmap.hxx b/include/oox/helper/refmap.hxx
index fb32c9d8c30f..2e63af512049 100644
--- a/include/oox/helper/refmap.hxx
+++ b/include/oox/helper/refmap.hxx
@@ -132,7 +132,7 @@ private:
const mapped_type* getRef( key_type nKey ) const
{
typename container_type::const_iterator aIt = this->find( nKey );
- return (aIt == this->end()) ? 0 : &aIt->second;
+ return (aIt == this->end()) ? nullptr : &aIt->second;
}
};
diff --git a/include/oox/helper/refvector.hxx b/include/oox/helper/refvector.hxx
index 1084e71cecf5..01894083639d 100644
--- a/include/oox/helper/refvector.hxx
+++ b/include/oox/helper/refvector.hxx
@@ -151,7 +151,7 @@ private:
const value_type* getRef( sal_Int32 nIndex ) const
{
return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
- &(*this)[ static_cast< size_type >( nIndex ) ] : 0;
+ &(*this)[ static_cast< size_type >( nIndex ) ] : nullptr;
}
};
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
index 3190b13ca66c..b98b1e936a4f 100644
--- a/include/registry/registry.hxx
+++ b/include/registry/registry.hxx
@@ -298,7 +298,7 @@ public:
return m_pValueList[index];
} else
{
- return 0;
+ return {};
}
}