diff options
author | Alexander Tkachev | 2016-07-22 18:27:49 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | cccfe7c247fed9b00c100e64433439386d6ef077 (patch) | |
tree | 91316ef86d15857b03aa5be8bafc1321cadc1b8e /backends/cloud/box | |
parent | 43c940c98579e669826de838eff9dcb372d453f7 (diff) | |
download | scummvm-rg350-cccfe7c247fed9b00c100e64433439386d6ef077.tar.gz scummvm-rg350-cccfe7c247fed9b00c100e64433439386d6ef077.tar.bz2 scummvm-rg350-cccfe7c247fed9b00c100e64433439386d6ef077.zip |
CLOUD: Update BoxListDirectoryByIdRequest
It now uses special CurlJsonRequest static methods to check whether JSON
is an object, has a string or integer parameter.
Diffstat (limited to 'backends/cloud/box')
-rw-r--r-- | backends/cloud/box/boxlistdirectorybyidrequest.cpp | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/backends/cloud/box/boxlistdirectorybyidrequest.cpp b/backends/cloud/box/boxlistdirectorybyidrequest.cpp index 3e518066f2..776ee71d64 100644 --- a/backends/cloud/box/boxlistdirectorybyidrequest.cpp +++ b/backends/cloud/box/boxlistdirectorybyidrequest.cpp @@ -125,63 +125,16 @@ void BoxListDirectoryByIdRequest::responseCallback(Networking::JsonResponse resp Common::JSONArray items = responseObject.getVal("entries")->asArray(); for (uint32 i = 0; i < items.size(); ++i) { - if (!items[i]->isObject()) { - warning("BoxListDirectoryByIdRequest: \"entries\" item is not an object!"); - debug(9, "%s", items[i]->stringify(true).c_str()); - continue; - } + if (!Networking::CurlJsonRequest::jsonIsObject(items[i], "BoxListDirectoryByIdRequest")) continue; Common::JSONObject item = items[i]->asObject(); - if (!item.contains("id") || !item.getVal("id")->isString()) { - warning("BoxListDirectoryByIdRequest: \"entries\" item's \"id\"!"); - if (item.contains("id")) { - debug(9, "%s", item.getVal("id")->stringify(true).c_str()); - } else { - debug(9, "(not available)"); - } - continue; - } - - if (!item.contains("name") || !item.getVal("name")->isString()) { - warning("BoxListDirectoryByIdRequest: \"entries\" item's \"name\"!"); - if (item.contains("name")) { - debug(9, "%s", item.getVal("name")->stringify(true).c_str()); - } else { - debug(9, "(not available)"); - } - continue; - } - - if (!item.contains("type") || !item.getVal("type")->isString()) { - warning("BoxListDirectoryByIdRequest: \"entries\" item's \"type\"!"); - if (item.contains("type")) { - debug(9, "%s", item.getVal("type")->stringify(true).c_str()); - } else { - debug(9, "(not available)"); - } - continue; - } - - if (!item.contains("size") || (!item.getVal("size")->isString() && !item.getVal("size")->isIntegerNumber())) { - warning("BoxListDirectoryByIdRequest: \"entries\" item's \"size\"!"); - if (item.contains("size")) { - debug(9, "%s", item.getVal("size")->stringify(true).c_str()); - } else { - debug(9, "(not available)"); - } - continue; - } - - if (!item.contains("modified_at") || !item.getVal("modified_at")->isString()) { - warning("BoxListDirectoryByIdRequest: \"entries\" item's \"modified_at\"!"); - if (item.contains("modified_at")) { - debug(9, "%s", item.getVal("modified_at")->stringify(true).c_str()); - } else { - debug(9, "(not available)"); - } - continue; - } + if (!Networking::CurlJsonRequest::jsonContainsString(item, "id", "BoxListDirectoryByIdRequest")) continue; + if (!Networking::CurlJsonRequest::jsonContainsString(item, "name", "BoxListDirectoryByIdRequest")) continue; + if (!Networking::CurlJsonRequest::jsonContainsString(item, "type", "BoxListDirectoryByIdRequest")) continue; + if (!Networking::CurlJsonRequest::jsonContainsString(item, "modified_at", "BoxListDirectoryByIdRequest")) continue; + if (!Networking::CurlJsonRequest::jsonContainsString(item, "size", "BoxListDirectoryByIdRequest") && + !Networking::CurlJsonRequest::jsonContainsIntegerNumber(item, "size", "BoxListDirectoryByIdRequest")) continue; Common::String id = item.getVal("id")->asString(); Common::String name = item.getVal("name")->asString(); |