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
This commit is contained in:
miloyip@gmail.com 2012-11-15 03:46:14 +00:00
parent d419c0ae5a
commit 90f983ced2
2 changed files with 4 additions and 4 deletions

View File

@ -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"

View File

@ -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