Commit 90f983ce authored by miloyip@gmail.com's avatar miloyip@gmail.com

Fixed Issue 46: old style cast to 'void*' casts away const in document.h

git-svn-id: https://rapidjson.googlecode.com/svn/trunk@88 c5894555-1306-4e8d-425f-1f6f381ee07c
parent d419c0ae
...@@ -64,7 +64,7 @@ solution "test" ...@@ -64,7 +64,7 @@ solution "test"
defines { "_CRT_SECURE_NO_WARNINGS" } defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "gmake" configuration "gmake"
buildoptions "-msse4.2" buildoptions "-msse4.2 -Werror=cast-qual"
project "gtest" project "gtest"
kind "StaticLib" kind "StaticLib"
......
...@@ -152,7 +152,7 @@ public: ...@@ -152,7 +152,7 @@ public:
break; break;
case kCopyStringFlag: case kCopyStringFlag:
Allocator::Free((void*)data_.s.str); Allocator::Free(const_cast<Ch*>(data_.s.str));
break; break;
} }
} }
...@@ -670,8 +670,8 @@ private: ...@@ -670,8 +670,8 @@ private:
flags_ = kCopyStringFlag; flags_ = kCopyStringFlag;
data_.s.str = (Ch *)allocator.Malloc((length + 1) * sizeof(Ch)); data_.s.str = (Ch *)allocator.Malloc((length + 1) * sizeof(Ch));
data_.s.length = length; data_.s.length = length;
memcpy((void*)data_.s.str, s, length * sizeof(Ch)); memcpy(const_cast<Ch*>(data_.s.str), s, length * sizeof(Ch));
((Ch*)data_.s.str)[length] = '\0'; const_cast<Ch*>(data_.s.str)[length] = '\0';
} }
//! Assignment without calling destructor //! Assignment without calling destructor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment