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;
|
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)
|
if (type_ != VAL_TYPE_OBJECT)
|
||||||
return false;
|
return false;
|
||||||
|
@ -526,12 +526,12 @@ bool json::set_value(const char* key, std::string val)
|
||||||
child->clear();
|
child->clear();
|
||||||
child->type_ = VAL_TYPE_STRING;
|
child->type_ = VAL_TYPE_STRING;
|
||||||
child->key() = key ? key : "";
|
child->key() = key ? key : "";
|
||||||
child->strval_ = val;
|
child->strval_ = val ? val : "";
|
||||||
child->release();
|
child->release();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child = new json(key, val.c_str());
|
child = new json(key, val);
|
||||||
arr_val_.push_back(child);
|
arr_val_.push_back(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
bool set_value(const char* key, bool val);
|
bool set_value(const char* key, bool val);
|
||||||
bool set_value(const char* key, int val);
|
bool set_value(const char* key, int val);
|
||||||
bool set_value(const char* key, double 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);
|
bool set_value(const char* key, json* val);
|
||||||
|
|
||||||
// operator+= only for array
|
// operator+= only for array
|
||||||
|
|
Loading…
Reference in New Issue