Use <cstddef> for NULL 07/35707/2
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 23 Feb 2015 14:33:31 +0000 (14:33 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 23 Feb 2015 14:35:09 +0000 (14:35 +0000)
Change-Id: I88562c4de8484da168443731bc06f8bc5db1577f

dali/internal/common/owner-pointer.h
dali/internal/update/node-attachments/node-attachment.h
dali/public-api/object/any.h
dali/public-api/signals/callback.cpp
dali/public-api/signals/callback.h
dali/public-api/signals/signal-slot-connections.cpp

index 9316845..d8bf7ea 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstddef>    // NULL
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 
@@ -36,7 +39,7 @@ public:
    */
   OwnerPointer()
   {
-    mObject = 0;
+    mObject = NULL;
   }
 
   /**
@@ -103,7 +106,7 @@ public:
    */
   T& operator*()
   {
-    DALI_ASSERT_DEBUG( mObject != 0 );
+    DALI_ASSERT_DEBUG( mObject != NULL );
 
     return *mObject;
   }
@@ -114,7 +117,7 @@ public:
    */
   T& operator*() const
   {
-    DALI_ASSERT_DEBUG( mObject != 0 );
+    DALI_ASSERT_DEBUG( mObject != NULL );
 
     // Pointer semantics: A const pointer does not mean const data.
     return const_cast< T& >( *mObject );
@@ -153,10 +156,10 @@ public:
    */
   void Reset()
   {
-    if ( mObject != 0 )
+    if ( mObject != NULL )
     {
       delete mObject;
-      mObject = 0;
+      mObject = NULL;
     }
   }
 
@@ -167,7 +170,7 @@ public:
   T* Release()
   {
     T* tmp = mObject;
-    mObject = 0;
+    mObject = NULL;
     return tmp;
   }
 
@@ -189,11 +192,11 @@ public:
 
   /**
    * Converts an object handle to a BooleanType.
-   * This is useful for checking whether the handle is null.
+   * This is useful for checking whether the handle is NULL.
    */
   operator BooleanType() const
   {
-    return (mObject != 0) ? &OwnerPointer::ThisIsSaferThanReturningVoidStar : 0;
+    return (mObject != NULL) ? &OwnerPointer::ThisIsSaferThanReturningVoidStar : NULL;
   }
 
 private:
@@ -213,7 +216,7 @@ private:
   void Init( OwnerPointer& ownerPointer )
   {
     mObject = ownerPointer.mObject;
-    ownerPointer.mObject = 0;
+    ownerPointer.mObject = NULL;
   }
 
   // data
index 098aa69..96b0975 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstddef>    // NULL
+
 // INTERNAL INCLUDES
 #include <dali/internal/common/message.h>
 
@@ -71,21 +74,21 @@ public:
 
   /**
    * Retrieve the parent node of a NodeAttachment.
-   * @return The parent node, or null if the NodeAttachment has not been added to the scene-graph.
+   * @return The parent node, or NULL if the NodeAttachment has not been added to the scene-graph.
    */
   Node& GetParent()
   {
-    DALI_ASSERT_DEBUG( mParent != 0 );
+    DALI_ASSERT_DEBUG( mParent != NULL );
     return *mParent;
   }
 
   /**
    * Retrieve the parent node of a NodeAttachment.
-   * @return The parent node, or null if the NodeAttachment has not been added to the scene-graph.
+   * @return The parent node, or NULL if the NodeAttachment has not been added to the scene-graph.
    */
   Node& GetParent() const
   {
-    DALI_ASSERT_DEBUG( mParent != 0 );
+    DALI_ASSERT_DEBUG( mParent != NULL );
     return *mParent;
   }
 
@@ -97,12 +100,12 @@ public:
    */
   bool IsRenderable()
   {
-    return (GetRenderable() != 0);
+    return (GetRenderable() != NULL);
   }
 
   /**
    * Convert an attachment to a renderable attachment.
-   * @return A pointer to the renderable attachment, or null.
+   * @return A pointer to the renderable attachment, or NULL.
    */
   virtual RenderableAttachment* GetRenderable() = 0;
 
index de661e2..9e7e13d 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <typeinfo>   // operator typeid
+#include <cstddef>    // NULL
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
@@ -78,14 +79,14 @@ public:
   Any( const Any& any )
   {
     // If container isn't empty then copy the container?
-    if ( 0 != any.mContainer )
+    if ( NULL != any.mContainer )
     {
       mContainer = any.mContainer->mCloneFunc( *any.mContainer );
     }
     else
     {
       // Otherwise mark new container as empty
-      mContainer = 0;
+      mContainer = NULL;
     }
   }
 
@@ -100,7 +101,7 @@ public:
   Any& operator=( const Type& value )
   {
     // If the container is empty then assign the new value
-    if ( 0 == mContainer )
+    if ( NULL == mContainer )
     {
       mContainer = new AnyContainerImpl< Type >( value );
     }
@@ -159,9 +160,9 @@ public:
   const Type& Get() const
   {
 
-    if ( 0 == mContainer )
+    if ( NULL == mContainer )
     {
-      AssertAlways( "Any::Get(). mContainer is null" );
+      AssertAlways( "Any::Get(). mContainer is NULL" );
     }
 
     // Check if the value has the same value than the Any type.
@@ -175,14 +176,14 @@ public:
   /**
    * @brief Return pointer of Type to the value stored
    *
-   * @return pointer to the value or null if no value is contained
+   * @return pointer to the value or NULL if no value is contained
    */
   template<typename Type>
   Type* GetPointer()
   {
-    if( 0 == mContainer )
+    if( NULL == mContainer )
     {
-      return 0;
+      return NULL;
     }
      // Check if the value has the same value than the Any type.
     if( mContainer->GetType() != typeid( Type ) )
@@ -195,14 +196,14 @@ public:
   /**
    * @brief Return pointer of Type to the value stored
    *
-   * @return pointer to the value or null if no value is contained
+   * @return pointer to the value or NULL if no value is contained
    */
   template<typename Type>
   const Type* GetPointer() const
   {
-    if( 0 == mContainer )
+    if( NULL == mContainer )
     {
-      return 0;
+      return NULL;
     }
      // Check if the value has the same value than the Any type.
     if( mContainer->GetType() != typeid( Type ) )
@@ -219,7 +220,7 @@ public:
    */
   bool Empty() const
   {
-    return ( 0 == mContainer ) ? true : false;
+    return ( NULL == mContainer ) ? true : false;
   }
 
   struct AnyContainerBase;    // Forward declaration for typedef
@@ -376,7 +377,7 @@ public:
  */
 
 /**
- * @brief Extract a pointer to the held type of an Any object from a pointer to that Any object (null if empty )
+ * @brief Extract a pointer to the held type of an Any object from a pointer to that Any object (NULL if empty )
  *
  * @param any Pointer to an Any object
  *
@@ -389,7 +390,7 @@ inline Type* AnyCast( Any* any )
 }
 
 /**
- * @brief Extract a const pointer to the held type of an Any object from a pointer to that Any object (null if empty )
+ * @brief Extract a const pointer to the held type of an Any object from a pointer to that Any object (NULL if empty )
  *
  * @param any const Pointer to an Any object
  *
index 7b61117..ca9044d 100644 (file)
@@ -25,8 +25,8 @@ namespace Dali
 // CallbackBase
 
 CallbackBase::CallbackBase()
-: mImpl( 0 ),
-  mFunction( 0 )
+: mImpl( NULL ),
+  mFunction( NULL )
 {
 }
 
@@ -36,7 +36,7 @@ CallbackBase::~CallbackBase()
 }
 
 CallbackBase::CallbackBase( Function function )
-: mImpl( 0 ),
+: mImpl( NULL ),
   mFunction( function )
 {
 }
@@ -47,7 +47,7 @@ CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher di
   mImpl = new CallbackBase::Impl;
   mImpl->mObjectPointer = object;
   mImpl->mMemberFunctionDispatcher = dispatcher;
-  mImpl->mDestructorDispatcher = 0; // object is not owned
+  mImpl->mDestructorDispatcher = NULL; // object is not owned
 }
 
 CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor )
@@ -72,18 +72,18 @@ void CallbackBase::Reset()
     }
 
     delete mImpl;
-    mImpl = 0;
+    mImpl = NULL;
   }
 
-  mFunction = 0;
+  mFunction = NULL;
 }
 
 // CallbackBase::Impl
 
 CallbackBase::Impl::Impl()
-: mObjectPointer( 0 ),
-  mMemberFunctionDispatcher( 0 ),
-  mDestructorDispatcher( 0 )
+: mObjectPointer( NULL ),
+  mMemberFunctionDispatcher( NULL ),
+  mDestructorDispatcher( NULL )
 {
 }
 
index 5dbb60b..576f88d 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstddef>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/signals/functor-delegate.h>
@@ -306,7 +309,7 @@ protected: // Constructors for deriving classes
   typedef void (*Dispatcher)( CallbackBase& base );
 
   /**
-   * @brief Used to destroy mObjectPointer (null if not mObjectPointer is not owned)
+   * @brief Used to destroy mObjectPointer (NULL if not mObjectPointer is not owned)
    */
   typedef void(*Destructor)(void* object);
 
@@ -354,9 +357,9 @@ public: // Data for deriving classes & Dispatchers
   {
     Impl();                               ///< Default constructor
 
-    void* mObjectPointer;                 ///< Object whose member function will be called. Not owned if mDestructorDispatcher is null.
+    void* mObjectPointer;                 ///< Object whose member function will be called. Not owned if mDestructorDispatcher is NULL.
     Dispatcher mMemberFunctionDispatcher; ///< Dispatcher for member functions
-    Destructor mDestructorDispatcher;     ///< Destructor for owned objects. null if mDestructorDispatcher is not owned.
+    Destructor mDestructorDispatcher;     ///< Destructor for owned objects. NULL if mDestructorDispatcher is not owned.
   };
   Impl* mImpl;                            ///< Implementation pointer
 
@@ -1081,7 +1084,7 @@ public:
    */
   CallbackFunctor0( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher0<T>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1121,7 +1124,7 @@ public:
    */
   CallbackFunctor1( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher1<T,P1>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1162,7 +1165,7 @@ public:
    */
   CallbackFunctor2( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher2<T,P1,P2>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1203,7 +1206,7 @@ public:
    */
   CallbackFunctor3( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher3<T,P1,P2,P3>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1245,7 +1248,7 @@ public:
    */
   CallbackFunctorReturn0( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn0<T,R>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1286,7 +1289,7 @@ public:
    */
   CallbackFunctorReturn1( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn1<T,R,P1>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1327,7 +1330,7 @@ public:
    */
   CallbackFunctorReturn2( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn2<T,R,P1,P2>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
@@ -1368,7 +1371,7 @@ public:
    */
   CallbackFunctorReturn3( const T& object )
   : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
-                  0, // uses operator() instead of member function
+                  NULL, // uses operator() instead of member function
                   reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn3<T,R,P1,P2,P3>::Dispatch ),
                   reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
 };
index 6007f69..43dd4fd 100644 (file)
@@ -18,6 +18,9 @@
 // CLASS HEADER
 #include <dali/public-api/signals/signal-slot-connections.h>
 
+// EXTERNAL INCLUDES
+#include <cstddef>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/signals/callback.h>
 
@@ -45,7 +48,7 @@ SlotObserver* SlotConnection::GetSlotObserver()
 }
 
 SignalConnection::SignalConnection( CallbackBase* callback )
-: mSignalObserver( 0 ),
+: mSignalObserver( NULL ),
   mCallback( callback )
 {
 }
@@ -68,12 +71,12 @@ void SignalConnection::Disconnect( SlotObserver* slotObserver )
   {
     // tell the slot the signal wants to disconnect
     mSignalObserver->SignalDisconnected( slotObserver, mCallback );
-    mSignalObserver = 0;
+    mSignalObserver = NULL;
   }
 
   // we own the callback, SignalObserver is expected to delete the SlotConnection on Disconnected so its pointer to our mCallback is no longer used
   delete mCallback;
-  mCallback = 0;
+  mCallback = NULL;
 }
 
 CallbackBase* SignalConnection::GetCallback()