aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Xiao <xiaofeng@google.com>2016-09-23 17:57:41 -0700
committerGitHub <noreply@github.com>2016-09-23 17:57:41 -0700
commit87d61e44fac56b5d2a47975813413aec6f6df05a (patch)
tree43223b6c29a37589be271232369f8a4b698e0bb6
parent907a075d7eb83ddfa49c51c77b0292fe4fcafff6 (diff)
parent5248f61a3482e54bd8cc3d39a9e80ed5752d57a5 (diff)
downloadprotobuf-87d61e44fac56b5d2a47975813413aec6f6df05a.tar.gz
protobuf-87d61e44fac56b5d2a47975813413aec6f6df05a.tar.bz2
protobuf-87d61e44fac56b5d2a47975813413aec6f6df05a.zip
Merge pull request #2175 from xfxyjwf/fix_json
Fix VS test failures.
-rw-r--r--jenkins/docker/Dockerfile2
-rw-r--r--src/google/protobuf/stubs/type_traits.h8
-rw-r--r--src/google/protobuf/util/internal/json_stream_parser_test.cc22
3 files changed, 25 insertions, 7 deletions
diff --git a/jenkins/docker/Dockerfile b/jenkins/docker/Dockerfile
index 989e505b..9c2a834d 100644
--- a/jenkins/docker/Dockerfile
+++ b/jenkins/docker/Dockerfile
@@ -115,7 +115,7 @@ RUN cd /tmp && \
cd protobuf && \
./autogen.sh && \
./configure && \
- make -j7 && \
+ make -j4 && \
cd java && \
$MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
cd ../javanano && \
diff --git a/src/google/protobuf/stubs/type_traits.h b/src/google/protobuf/stubs/type_traits.h
index 0d8127e5..8d48c6aa 100644
--- a/src/google/protobuf/stubs/type_traits.h
+++ b/src/google/protobuf/stubs/type_traits.h
@@ -143,6 +143,14 @@ template<> struct is_integral<unsigned long> : true_type { };
template<> struct is_integral<long long> : true_type { };
template<> struct is_integral<unsigned long long> : true_type { };
#endif
+#if defined(_MSC_VER)
+// With VC, __int8, __int16, and __int32 are synonymous with standard types
+// with the same size, but __int64 has not equivalent (i.e., it's neither
+// long, nor long long and should be treated differnetly).
+// https://msdn.microsoft.com/en-us/library/29dh1w7z.aspx
+template<> struct is_integral<__int64> : true_type { };
+template<> struct is_integral<unsigned __int64> : true_type {};
+#endif
template <class T> struct is_integral<const T> : is_integral<T> { };
template <class T> struct is_integral<volatile T> : is_integral<T> { };
template <class T> struct is_integral<const volatile T> : is_integral<T> { };
diff --git a/src/google/protobuf/util/internal/json_stream_parser_test.cc b/src/google/protobuf/util/internal/json_stream_parser_test.cc
index d162667a..945fc6ca 100644
--- a/src/google/protobuf/util/internal/json_stream_parser_test.cc
+++ b/src/google/protobuf/util/internal/json_stream_parser_test.cc
@@ -315,18 +315,28 @@ TEST_F(JsonStreamParserTest, ObjectKeyTypes) {
}
}
-// - array containing array, object, values (true, false, null, num, string)
-TEST_F(JsonStreamParserTest, ArrayValues) {
+// - array containing primitive values (true, false, null, num, string)
+TEST_F(JsonStreamParserTest, ArrayPrimitiveValues) {
StringPiece str =
- "[true, false, null, 'a', \"an\", [22, -127, 45.3, "
- "-1056.4, 11779497823553162765], {'key': true}]";
+ "[true, false, null, 'one', \"two\"]";
for (int i = 0; i <= str.length(); ++i) {
ow_.StartList("")
->RenderBool("", true)
->RenderBool("", false)
->RenderNull("")
- ->RenderString("", "a")
- ->RenderString("", "an")
+ ->RenderString("", "one")
+ ->RenderString("", "two")
+ ->EndList();
+ DoTest(str, i);
+ }
+}
+
+// - array containing array, object
+TEST_F(JsonStreamParserTest, ArrayComplexValues) {
+ StringPiece str =
+ "[[22, -127, 45.3, -1056.4, 11779497823553162765], {'key': true}]";
+ for (int i = 0; i <= str.length(); ++i) {
+ ow_.StartList("")
->StartList("")
->RenderUint64("", 22)
->RenderInt64("", -127)