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"
defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "gmake"
buildoptions "-msse4.2"
buildoptions "-msse4.2 -Werror=cast-qual"
project "gtest"
kind "StaticLib"
......
......@@ -152,7 +152,7 @@ public:
break;
case kCopyStringFlag:
Allocator::Free((void*)data_.s.str);
Allocator::Free(const_cast<Ch*>(data_.s.str));
break;
}
}
......@@ -670,8 +670,8 @@ private:
flags_ = kCopyStringFlag;
data_.s.str = (Ch *)allocator.Malloc((length + 1) * sizeof(Ch));
data_.s.length = length;
memcpy((void*)data_.s.str, s, length * sizeof(Ch));
((Ch*)data_.s.str)[length] = '\0';
memcpy(const_cast<Ch*>(data_.s.str), s, length * sizeof(Ch));
const_cast<Ch*>(data_.s.str)[length] = '\0';
}
//! 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