Fix build error on Ubuntu 12.04. Include for ptrdiff_t.
BUG=6337249
Change-Id: I32d9e13bed9a3c4d009167e2330e26440382902a
diff --git a/include/mcld/ADT/BinTree.h b/include/mcld/ADT/BinTree.h
index 0a7fe28..5c1dc0a 100644
--- a/include/mcld/ADT/BinTree.h
+++ b/include/mcld/ADT/BinTree.h
@@ -15,6 +15,7 @@
#include "mcld/ADT/Uncopyable.h"
#include "mcld/ADT/TreeAllocator.h"
+#include <cstddef>
#include <iterator>
#include <memory>
#include <queue>
@@ -79,7 +80,7 @@
virtual ~BFSIterator()
{ }
- void advance() {
+ void advance() {
if (m_Queue.empty()) { // reach the end
m_pNode = m_pNode->right; // should be root
return;
@@ -104,7 +105,7 @@
typedef Traits traits;
typedef typename traits::pointer pointer;
typedef typename traits::reference reference;
-
+
typedef PolicyIteratorBase<value_type, Traits, IteratorType> Self;
typedef Node<value_type> node_type;
typedef typename traits::nonconst_traits nonconst_traits;
@@ -128,7 +129,7 @@
virtual ~PolicyIteratorBase() {}
// ----- operators ----- //
- pointer operator*() const
+ pointer operator*() const
{ return static_cast<node_type*>(IteratorType::m_pNode)->data; }
reference operator->() const
@@ -137,7 +138,7 @@
bool isRoot() const
{ return (IteratorType::m_pNode->right == IteratorType::m_pNode); }
- bool hasData() const
+ bool hasData() const
{ return (!isRoot() && (0 != static_cast<node_type*>(IteratorType::m_pNode)->data)); }
};
@@ -217,7 +218,7 @@
~TreeIterator() {}
// ----- operators ----- //
- pointer operator*() const
+ pointer operator*() const
{ return static_cast<node_type*>(m_pNode)->data; }
reference operator->() const
@@ -226,7 +227,7 @@
bool isRoot() const
{ return (m_pNode->right == m_pNode); }
- bool hasData() const
+ bool hasData() const
{ return (!isRoot() && (0 != static_cast<node_type*>(m_pNode)->data)); }
Self& operator++() {
@@ -259,9 +260,9 @@
* \brief BinaryTreeBase gives root node and memory management.
*
* The memory management of nodes in is hidden by BinaryTreeBase.
- * BinaryTreeBase also provides the basic functions for merging a tree and
+ * BinaryTreeBase also provides the basic functions for merging a tree and
* inserton of a node.
- *
+ *
* @see BinaryTree
*/
template<class DataType>
@@ -278,7 +279,7 @@
// | / \ |
// | Left Right |
// +---/ \-----+
- //
+ //
class TreeImpl : public NodeFactory<DataType>
{
typedef typename NodeFactory<DataType>::iterator iterator;
@@ -478,4 +479,3 @@
} // namespace of mcld
#endif
-
diff --git a/include/mcld/ADT/HashIterator.h b/include/mcld/ADT/HashIterator.h
index 92ccdc5..055d91c 100644
--- a/include/mcld/ADT/HashIterator.h
+++ b/include/mcld/ADT/HashIterator.h
@@ -12,6 +12,8 @@
#include <gtest.h>
#endif
+#include <cstddef>
+
namespace mcld {
/** \class ChainIteratorBase
@@ -151,7 +153,7 @@
unsigned int m_HashValue;
unsigned int m_EndIndex;
};
-
+
/** \class EntryIteratorBase
* \brief EntryIteratorBase walks over hash table by the natural layout of the
* buckets
@@ -223,7 +225,7 @@
reset();
return;
}
- } while(bucket_type::getEmptyBucket() == m_pHashTable->m_Buckets[m_Index].Entry ||
+ } while(bucket_type::getEmptyBucket() == m_pHashTable->m_Buckets[m_Index].Entry ||
bucket_type::getTombstone() == m_pHashTable->m_Buckets[m_Index].Entry);
}
@@ -320,4 +322,3 @@
} // namespace of mcld
#endif
-
diff --git a/include/mcld/ADT/TreeBase.h b/include/mcld/ADT/TreeBase.h
index c518975..e231148 100644
--- a/include/mcld/ADT/TreeBase.h
+++ b/include/mcld/ADT/TreeBase.h
@@ -10,6 +10,8 @@
#define MCLD_TREE_BASE_H
#include "mcld/ADT/TypeTraits.h"
+#include <cstddef>
+
namespace mcld
{
@@ -84,7 +86,7 @@
namespace proxy
{
template<>
- inline void move<TreeIteratorBase::Leftward>(NodeBase *&X)
+ inline void move<TreeIteratorBase::Leftward>(NodeBase *&X)
{ X = X->left; }
template<>
@@ -124,4 +126,3 @@
} // namespace of mcld
#endif
-
diff --git a/include/mcld/Support/Allocators.h b/include/mcld/Support/Allocators.h
index 962c900..426cbc3 100644
--- a/include/mcld/Support/Allocators.h
+++ b/include/mcld/Support/Allocators.h
@@ -15,6 +15,8 @@
#include "mcld/ADT/Uncopyable.h"
#include "mcld/ADT/TypeTraits.h"
#include "mcld/LD/LDContext.h"
+
+#include <cstddef>
#include <cstdlib>
namespace mcld
@@ -436,4 +438,3 @@
} // namespace mcld
#endif
-
diff --git a/include/mcld/Support/Directory.h b/include/mcld/Support/Directory.h
index 8383e9e..117d51d 100644
--- a/include/mcld/Support/Directory.h
+++ b/include/mcld/Support/Directory.h
@@ -12,6 +12,8 @@
#include <gtest.h>
#endif
+#include <cstddef>
+
#include "mcld/ADT/TypeTraits.h"
#include "mcld/Support/FileSystem.h"
#include "mcld/Support/Path.h"
diff --git a/include/mcld/Support/GCFactory.h b/include/mcld/Support/GCFactory.h
index 103188e..eb3f9db 100644
--- a/include/mcld/Support/GCFactory.h
+++ b/include/mcld/Support/GCFactory.h
@@ -15,6 +15,7 @@
#include "mcld/Support/Allocators.h"
#include <assert.h>
+#include <cstddef>
#include <iterator>
namespace mcld
@@ -177,13 +178,13 @@
{ return const_iterator(Alloc::m_pRoot, 0); }
iterator end() {
- return (0 == Alloc::m_pCurrent)?
+ return (0 == Alloc::m_pCurrent)?
begin():
iterator(Alloc::m_pCurrent, Alloc::m_pCurrent->bound);
}
const_iterator end() const {
- return (0 == Alloc::m_pCurrent)?
+ return (0 == Alloc::m_pCurrent)?
begin():
const_iterator(Alloc::m_pCurrent, Alloc::m_pCurrent->bound);
}
@@ -227,4 +228,3 @@
} // namespace of mcld
#endif
-