mirror of
				https://github.com/Tencent/rapidjson.git
				synced 2025-10-28 11:31:57 +01:00 
			
		
		
		
	Fixed compilation errors in Ubuntu 64-bit
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@29 c5894555-1306-4e8d-425f-1f6f381ee07c
This commit is contained in:
		| @@ -67,6 +67,9 @@ solution "test" | ||||
|  | ||||
| 	project "gtest" | ||||
| 		kind "StaticLib" | ||||
| 		 | ||||
| 		defines { "GTEST_HAS_PTHREAD=0" } | ||||
|  | ||||
| 		files {  | ||||
| 			"../thirdparty/gtest/src/gtest-all.cc", | ||||
| 			"../thirdparty/gtest/src/**.h", | ||||
|   | ||||
| @@ -44,7 +44,7 @@ public: | ||||
| 		length_ = (size_t)ftell(fp); | ||||
| 		fseek(fp, 0, SEEK_SET); | ||||
| 		json_ = (char*)malloc(length_ + 1); | ||||
| 		fread(json_, 1, length_, fp); | ||||
| 		ASSERT_EQ(length_, fread(json_, 1, length_, fp)); | ||||
| 		json_[length_] = '\0'; | ||||
| 		fclose(fp); | ||||
|  | ||||
|   | ||||
| @@ -109,7 +109,7 @@ TEST_F(Platform, read) { | ||||
| #else | ||||
| TEST_F(Platform, read) { | ||||
| 	for (int i = 0; i < kTrialCount; i++) { | ||||
| 		int fd = open(filename_, O_BINARY | O_RDONLY); | ||||
| 		int fd = open(filename_, O_RDONLY); | ||||
| 		ASSERT_NE(-1, fd); | ||||
| 		ASSERT_EQ(length_, read(fd, temp_, length_)); | ||||
| 		EXPECT_EQ(checkSum_, CheckSum()); | ||||
| @@ -138,7 +138,7 @@ TEST_F(Platform, MapViewOfFile) { | ||||
| #ifdef _POSIX_MAPPED_FILES | ||||
| TEST_F(Platform, mmap) { | ||||
| 	for (int i = 0; i < kTrialCount; i++) { | ||||
| 		int fd = open(filename_, _O_BINARY | _O_RDONLY); | ||||
| 		int fd = open(filename_, O_RDONLY); | ||||
| 		ASSERT_NE(-1, fd); | ||||
| 		void *p = mmap(NULL, length_, PROT_READ, MAP_PRIVATE, fd, 0); | ||||
| 		ASSERT_TRUE(p != NULL); | ||||
|   | ||||
| @@ -85,7 +85,11 @@ yajl_gen_status GenVal(yajl_gen g, yajl_val v) { | ||||
| 			size_t len; | ||||
| 			//if (YAJL_IS_INTEGER(v)) // buggy | ||||
| 			if (v->u.number.flags & YAJL_NUMBER_INT_VALID) | ||||
| 				len = sprintf(num, "%d", YAJL_GET_INTEGER(v)); | ||||
| #if _MSC_VER | ||||
| 				len = sprintf(num, "%I64d", YAJL_GET_INTEGER(v)); | ||||
| #else | ||||
| 				len = sprintf(num, "%lld", YAJL_GET_INTEGER(v)); | ||||
| #endif | ||||
| 			//else if (YAJL_IS_DOUBLE(v))	// buggy | ||||
| 			else if (v->u.number.flags & YAJL_NUMBER_DOUBLE_VALID) | ||||
| 				len = sprintf(num, "%g", YAJL_GET_DOUBLE(v)); | ||||
|   | ||||
| @@ -193,7 +193,7 @@ TEST(Value, Uint) { | ||||
|  | ||||
| TEST(Value, Int64) { | ||||
| 	// Constructor with int | ||||
| 	Value x(1234LL); | ||||
| 	Value x(int64_t(1234LL)); | ||||
| 	EXPECT_EQ(kNumberType, x.GetType()); | ||||
| 	EXPECT_EQ(1234, x.GetInt()); | ||||
| 	EXPECT_EQ(1234, x.GetUint()); | ||||
| @@ -214,7 +214,7 @@ TEST(Value, Int64) { | ||||
| 	EXPECT_FALSE(x.IsObject()); | ||||
| 	EXPECT_FALSE(x.IsArray()); | ||||
|  | ||||
| 	Value nx(-1234LL); | ||||
| 	Value nx(int64_t(-1234LL)); | ||||
| 	EXPECT_EQ(-1234, nx.GetInt()); | ||||
| 	EXPECT_EQ(-1234, nx.GetInt64()); | ||||
| 	EXPECT_TRUE(nx.IsInt()); | ||||
| @@ -238,7 +238,7 @@ TEST(Value, Int64) { | ||||
|  | ||||
| TEST(Value, Uint64) { | ||||
| 	// Constructor with int | ||||
| 	Value x(1234LL); | ||||
| 	Value x(uint64_t(1234LL)); | ||||
| 	EXPECT_EQ(kNumberType, x.GetType()); | ||||
| 	EXPECT_EQ(1234, x.GetInt()); | ||||
| 	EXPECT_EQ(1234, x.GetUint()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 miloyip@gmail.com
					miloyip@gmail.com