File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -229,10 +229,7 @@ JsonArray JsonObject::getArray(std::string name) {
229
229
*/
230
230
bool JsonObject::getBoolean (std::string name) {
231
231
cJSON *node = cJSON_GetObjectItem (m_node, name.c_str ());
232
- if (node->valueint == 0 ) {
233
- return false ;
234
- }
235
- return true ;
232
+ return cJSON_IsTrue (node);
236
233
} // getBoolean
237
234
238
235
@@ -316,7 +313,7 @@ void JsonObject::setArray(std::string name, JsonArray array) {
316
313
* @return N/A.
317
314
*/
318
315
void JsonObject::setBoolean (std::string name, bool value) {
319
- cJSON_AddItemToObject (m_node, name.c_str (), cJSON_CreateBool ( value));
316
+ cJSON_AddItemToObject (m_node, name.c_str (), value? cJSON_CreateTrue (): cJSON_CreateFalse ( ));
320
317
} // setBoolean
321
318
322
319
You can’t perform that action at this time.
0 commit comments