aboutsummaryrefslogtreecommitdiff
path: root/backends/networking
diff options
context:
space:
mode:
authorEugene Sandulenko2019-10-24 00:02:54 +0200
committerEugene Sandulenko2019-10-24 00:15:33 +0200
commita0c58a53b3db7710c333da66cde3125ea74559b8 (patch)
treebebca4b058ee65b2d81cca823e62973f474563b4 /backends/networking
parent0ad210a5a477c4d4241e03a54c7007ac669a3a3c (diff)
downloadscummvm-rg350-a0c58a53b3db7710c333da66cde3125ea74559b8.tar.gz
scummvm-rg350-a0c58a53b3db7710c333da66cde3125ea74559b8.tar.bz2
scummvm-rg350-a0c58a53b3db7710c333da66cde3125ea74559b8.zip
NETWORKING: Changed PostRequest to accept JSONValue
Diffstat (limited to 'backends/networking')
-rw-r--r--backends/networking/curl/curljsonrequest.h1
-rw-r--r--backends/networking/curl/postrequest.cpp4
-rw-r--r--backends/networking/curl/postrequest.h4
3 files changed, 5 insertions, 4 deletions
diff --git a/backends/networking/curl/curljsonrequest.h b/backends/networking/curl/curljsonrequest.h
index 11c6bc81ea..e462d5890f 100644
--- a/backends/networking/curl/curljsonrequest.h
+++ b/backends/networking/curl/curljsonrequest.h
@@ -31,6 +31,7 @@ namespace Networking {
typedef Response<Common::JSONValue *> JsonResponse;
typedef Common::BaseCallback<JsonResponse> *JsonCallback;
+typedef Common::BaseCallback<Common::JSONValue *> *JSONValueCallback;
#define CURL_JSON_REQUEST_BUFFER_SIZE 512 * 1024
diff --git a/backends/networking/curl/postrequest.cpp b/backends/networking/curl/postrequest.cpp
index 0becc8eef9..1dec36b670 100644
--- a/backends/networking/curl/postrequest.cpp
+++ b/backends/networking/curl/postrequest.cpp
@@ -28,7 +28,7 @@
namespace Networking {
-PostRequest::PostRequest(Common::String url, byte *postData, int postLen, Networking::JsonCallback cb, Networking::ErrorCallback ecb):
+PostRequest::PostRequest(Common::String url, byte *postData, int postLen, Networking::JSONValueCallback cb, Networking::ErrorCallback ecb):
Networking::Request(nullptr, ecb), _url(url), _jsonCallback(cb),
_workingRequest(nullptr), _ignoreCallback(false), _postData(postData), _postLen(postLen) {
start();
@@ -87,7 +87,7 @@ void PostRequest::responseCallback(Networking::JsonResponse response) {
finishSuccess();
if (_jsonCallback)
- (*_jsonCallback)(Networking::JsonResponse(this, json));
+ (*_jsonCallback)(json);
delete json;
}
diff --git a/backends/networking/curl/postrequest.h b/backends/networking/curl/postrequest.h
index 775af31a3f..568979473c 100644
--- a/backends/networking/curl/postrequest.h
+++ b/backends/networking/curl/postrequest.h
@@ -30,7 +30,7 @@ namespace Networking {
class PostRequest: public Networking::Request {
Common::String _url;
- Networking::JsonCallback _jsonCallback;
+ Networking::JSONValueCallback _jsonCallback;
Request *_workingRequest;
bool _ignoreCallback;
Common::String _date;
@@ -43,7 +43,7 @@ class PostRequest: public Networking::Request {
void errorCallback(Networking::ErrorResponse error);
public:
- PostRequest(Common::String url, byte *postData, int postLen, Networking::JsonCallback cb, Networking::ErrorCallback ecb);
+ PostRequest(Common::String url, byte *postData, int postLen, Networking::JSONValueCallback cb, Networking::ErrorCallback ecb);
virtual ~PostRequest();
virtual void handle();