Revert "Static analysis fix: replace 0 and NULL with nullptr (#738)"
authorAdrian Bunk <bunk@debian.org>
Sun, 10 May 2020 08:39:29 +0000 (11:39 +0300)
committerRaspbian forward porter <root@raspbian.org>
Thu, 26 Aug 2021 22:24:06 +0000 (23:24 +0100)
This reverts commit db0bda7087a6fac811e78957787fc5037465ac4e.

Gbp-Pq: Name 0001-Revert-Static-analysis-fix-replace-0-and-NULL-with-n.patch

include/yaml-cpp/binary.h
include/yaml-cpp/exceptions.h
include/yaml-cpp/node/detail/impl.h
include/yaml-cpp/node/detail/node_iterator.h
include/yaml-cpp/node/impl.h
include/yaml-cpp/ostream_wrapper.h

index 1050dae98c3cc9fe0b6261737895c24bf8518fde..0267a3ad9fc854e3e3143aa2481856f221f7382c 100644 (file)
@@ -39,7 +39,7 @@ class YAML_CPP_API Binary {
       rhs.clear();
       rhs.resize(m_unownedSize);
       std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin());
-      m_unownedData = nullptr;
+      m_unownedData = 0;
       m_unownedSize = 0;
     } else {
       m_data.swap(rhs);
index eef22833a81349cddb728e45f25d1a27bf652f06..3b1b01a56a8e75f26ae6428b6f8064b7065496d0 100644 (file)
@@ -117,7 +117,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
 
 template <typename T>
 inline const std::string BAD_SUBSCRIPT_WITH_KEY(
-    const T&, typename disable_if<is_numeric<T>>::type* = nullptr) {
+    const T&, typename disable_if<is_numeric<T>>::type* = 0) {
   return BAD_SUBSCRIPT;
 }
 
@@ -129,7 +129,7 @@ inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) {
 
 template <typename T>
 inline const std::string BAD_SUBSCRIPT_WITH_KEY(
-    const T& key, typename enable_if<is_numeric<T>>::type* = nullptr) {
+    const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
   std::stringstream stream;
   stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
   return stream.str();
index 4123b85da54b185dd4f8c0dbb29e0f5fc1ccc6a1..46615a9f4577be4d55e1bf9be1a6c8d23b027472 100644 (file)
@@ -17,7 +17,7 @@ template <typename Key, typename Enable = void>
 struct get_idx {
   static node* get(const std::vector<node*>& /* sequence */,
                    const Key& /* key */, shared_memory_holder /* pMemory */) {
-    return nullptr;
+    return 0;
   }
 };
 
@@ -27,7 +27,7 @@ struct get_idx<Key,
                                        !std::is_same<Key, bool>::value>::type> {
   static node* get(const std::vector<node*>& sequence, const Key& key,
                    shared_memory_holder /* pMemory */) {
-    return key < sequence.size() ? sequence[key] : nullptr;
+    return key < sequence.size() ? sequence[key] : 0;
   }
 
   static node* get(std::vector<node*>& sequence, const Key& key,
@@ -46,13 +46,13 @@ struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
                    shared_memory_holder pMemory) {
     return key >= 0 ? get_idx<std::size_t>::get(
                           sequence, static_cast<std::size_t>(key), pMemory)
-                    : nullptr;
+                    : 0;
   }
   static node* get(std::vector<node*>& sequence, const Key& key,
                    shared_memory_holder pMemory) {
     return key >= 0 ? get_idx<std::size_t>::get(
                           sequence, static_cast<std::size_t>(key), pMemory)
-                    : nullptr;
+                    : 0;
   }
 };
 
@@ -109,11 +109,11 @@ inline node* node_data::get(const Key& key,
       break;
     case NodeType::Undefined:
     case NodeType::Null:
-      return nullptr;
+      return NULL;
     case NodeType::Sequence:
       if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory))
         return pNode;
-      return nullptr;
+      return NULL;
     case NodeType::Scalar:
       throw BadSubscript(key);
   }
@@ -124,7 +124,7 @@ inline node* node_data::get(const Key& key,
     }
   }
 
-  return nullptr;
+  return NULL;
 }
 
 template <typename Key>
index ab6916fea471c467ca95801bf14123fe957e7e9a..088090fe743670df82871238cc9fe2f0704526ec 100644 (file)
@@ -26,9 +26,9 @@ template <typename V>
 struct node_iterator_value : public std::pair<V*, V*> {
   typedef std::pair<V*, V*> kv;
 
-  node_iterator_value() : kv(), pNode(nullptr) {}
+  node_iterator_value() : kv(), pNode(0) {}
   explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {}
-  explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(nullptr) {}
+  explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {}
 
   V& operator*() const { return *pNode; }
   V& operator->() const { return *pNode; }
index 7a3deacf906053e51ed80d808b78a8f42a248cc9..0b0e296ec18877993797ddad1d4e7321df41fd61 100644 (file)
@@ -52,7 +52,7 @@ inline Node::Node(Zombie)
     : m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
 
 inline Node::Node(Zombie, const std::string& key)
-    : m_isValid(false), m_invalidKey(key), m_pMemory{}, m_pNode(nullptr) {}
+    : m_isValid(false), m_invalidKey(key), m_pMemory{}, m_pNode(NULL) {}
 
 inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
     : m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
index cf89741d0935aad2d7b28ad49eb59a1cb0e05326..259801bcb75f4e03f13ae1bbc68efc5afa399da9 100644 (file)
@@ -30,7 +30,7 @@ class YAML_CPP_API ostream_wrapper {
 
   const char* str() const {
     if (m_pStream) {
-      return nullptr;
+      return 0;
     } else {
       m_buffer[m_pos] = '\0';
       return &m_buffer[0];