diff options
author | miloyip <miloyip@gmail.com> | 2015-04-11 09:48:33 +0300 |
---|---|---|
committer | miloyip <miloyip@gmail.com> | 2015-04-11 09:48:33 +0300 |
commit | 6ee691550f22c419579a457a0d7b1c9bc642f1f2 (patch) | |
tree | 6b367ce9d814325d485bb5de5d796893ae703f15 /include/rapidjson/pointer.h | |
parent | bd435f76abc4f8e1f9f8301f510bbf225312ee18 (diff) |
Move GenericPointer::kInvalidIndex to rapidjson::kPointerInvalidIndex
It is needed to prevent linking error for gcc/clang
Diffstat (limited to 'include/rapidjson/pointer.h')
-rw-r--r-- | include/rapidjson/pointer.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h index 66cbdefc..6ee6abc9 100644 --- a/include/rapidjson/pointer.h +++ b/include/rapidjson/pointer.h @@ -19,6 +19,8 @@ RAPIDJSON_NAMESPACE_BEGIN +static const SizeType kPointerInvalidIndex = ~SizeType(0); + template <typename ValueType, typename Allocator = CrtAllocator> class GenericPointer { public: @@ -28,11 +30,9 @@ public: struct Token { const Ch* name; SizeType length; - SizeType index; //!< A valid index if not equal to kInvalidIndex. + SizeType index; //!< A valid index if not equal to kPointerInvalidIndex. }; - static const SizeType kInvalidIndex = -1; - GenericPointer() : allocator_(), ownAllocator_(), @@ -150,7 +150,7 @@ public: bool exist = true; for (Token *t = tokens_; t != tokens_ + tokenCount_; ++t) { if (v->GetType() != kObjectType && v->GetType() != kArrayType) { - if (t->index == kInvalidIndex) + if (t->index == kPointerInvalidIndex) v->SetObject(); else v->SetArray(); @@ -170,7 +170,7 @@ public: } break; case kArrayType: - if (t->index == kInvalidIndex) + if (t->index == kPointerInvalidIndex) v->SetArray(); // Change to Array if (t->index >= v->Size()) { v->Reserve(t->index + 1, allocator); @@ -207,7 +207,7 @@ public: } break; case kArrayType: - if (t->index == kInvalidIndex || t->index >= v->Size()) + if (t->index == kPointerInvalidIndex || t->index >= v->Size()) return 0; v = &((*v)[t->index]); break; @@ -307,7 +307,7 @@ private: } } - token.index = isNumber ? n : kInvalidIndex; + token.index = isNumber ? n : kPointerInvalidIndex; } RAPIDJSON_ASSERT(name <= nameBuffer_ + length); // Should not overflow buffer |