mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-02-25 23:47:08 +01:00
parent
b14c8c1423
commit
7e0571b444
@ -343,6 +343,7 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
|
||||
* This optimization is used in ValueInternalMap fast allocator.
|
||||
*/
|
||||
Value::Value(ValueType vtype) {
|
||||
static char const empty[] = "";
|
||||
initBasic(vtype);
|
||||
switch (vtype) {
|
||||
case nullValue:
|
||||
@ -355,7 +356,8 @@ Value::Value(ValueType vtype) {
|
||||
value_.real_ = 0.0;
|
||||
break;
|
||||
case stringValue:
|
||||
value_.string_ = 0;
|
||||
// allocated_ == false, so this is safe.
|
||||
value_.string_ = const_cast<char*>(static_cast<char const*>(empty));
|
||||
break;
|
||||
case arrayValue:
|
||||
case objectValue:
|
||||
|
@ -353,7 +353,7 @@ void FastWriter::writeValue(const Value& value) {
|
||||
break;
|
||||
case stringValue:
|
||||
{
|
||||
// Is NULL possible for value.string_?
|
||||
// Is NULL possible for value.string_? No.
|
||||
char const* str;
|
||||
char const* end;
|
||||
bool ok = value.getString(&str, &end);
|
||||
@ -423,7 +423,7 @@ void StyledWriter::writeValue(const Value& value) {
|
||||
break;
|
||||
case stringValue:
|
||||
{
|
||||
// Is NULL possible for value.string_?
|
||||
// Is NULL possible for value.string_? No.
|
||||
char const* str;
|
||||
char const* end;
|
||||
bool ok = value.getString(&str, &end);
|
||||
@ -640,7 +640,7 @@ void StyledStreamWriter::writeValue(const Value& value) {
|
||||
break;
|
||||
case stringValue:
|
||||
{
|
||||
// Is NULL possible for value.string_?
|
||||
// Is NULL possible for value.string_? No.
|
||||
char const* str;
|
||||
char const* end;
|
||||
bool ok = value.getString(&str, &end);
|
||||
@ -921,7 +921,7 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
|
||||
break;
|
||||
case stringValue:
|
||||
{
|
||||
// Is NULL is possible for value.string_?
|
||||
// Is NULL is possible for value.string_? No.
|
||||
char const* str;
|
||||
char const* end;
|
||||
bool ok = value.getString(&str, &end);
|
||||
|
Loading…
x
Reference in New Issue
Block a user