fix string value parameter
This commit is contained in:
parent
d464c09d2c
commit
d1f0cbf5a7
|
@ -514,7 +514,7 @@ bool json::set_value(const char* key, double val)
|
|||
|
||||
return true;
|
||||
}
|
||||
bool json::set_value(const char* key, std::string val)
|
||||
bool json::set_value(const char* key, const char* val)
|
||||
{
|
||||
if (type_ != VAL_TYPE_OBJECT)
|
||||
return false;
|
||||
|
@ -526,12 +526,12 @@ bool json::set_value(const char* key, std::string val)
|
|||
child->clear();
|
||||
child->type_ = VAL_TYPE_STRING;
|
||||
child->key() = key ? key : "";
|
||||
child->strval_ = val;
|
||||
child->strval_ = val ? val : "";
|
||||
child->release();
|
||||
}
|
||||
else
|
||||
{
|
||||
child = new json(key, val.c_str());
|
||||
child = new json(key, val);
|
||||
arr_val_.push_back(child);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
bool set_value(const char* key, bool val);
|
||||
bool set_value(const char* key, int val);
|
||||
bool set_value(const char* key, double val);
|
||||
bool set_value(const char* key, std::string val);
|
||||
bool set_value(const char* key, const char* val);
|
||||
bool set_value(const char* key, json* val);
|
||||
|
||||
// operator+= only for array
|
||||
|
|
Loading…
Reference in New Issue