aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2015-06-02 21:32:41 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2015-06-02 21:32:41 -0700
commitdbcfc5e2021fe70ce9e8d5bfda4e7a2df08a2130 (patch)
tree7e62d53901dadb9c70ec10441d77dcfb5ddf8231
parent4644f99d1af4250dec95339be6a13e149787ab33 (diff)
parent93d6838ab50fc004ef2a854fca59850665b5fb9d (diff)
Merge pull request #444 from xfxyjwf/vs2010_fix
Fix two issues on vs2010.
-rw-r--r--src/google/protobuf/map.h14
-rw-r--r--src/google/protobuf/repeated_field.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index c16fbed2..96d2f201 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -176,14 +176,12 @@ class Map {
template<class NodeType>
void destroy(NodeType* p) {
- if (arena_ == NULL) p->~NodeType();
+ p->~NodeType();
}
#else
void construct(pointer p, const_reference t) { new (p) value_type(t); }
- void destroy(pointer p) {
- if (arena_ == NULL) p->~value_type();
- }
+ void destroy(pointer p) { p->~value_type(); }
#endif
template <typename X>
@@ -201,10 +199,10 @@ class Map {
return arena_ != other.arena_;
}
- // To support Visual Studio 2008
- size_type max_size() const {
- return std::numeric_limits<size_type>::max();
- }
+ // To support Visual Studio 2008
+ size_type max_size() const {
+ return std::numeric_limits<size_type>::max();
+ }
private:
Arena* arena_;
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 5a2fb409..14f46298 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -1125,7 +1125,9 @@ template <typename Element>
inline typename RepeatedField<Element>::iterator RepeatedField<Element>::erase(
const_iterator first, const_iterator last) {
size_type first_offset = first - cbegin();
- Truncate(std::copy(last, cend(), begin() + first_offset) - cbegin());
+ if (first != last) {
+ Truncate(std::copy(last, cend(), begin() + first_offset) - cbegin());
+ }
return begin() + first_offset;
}