aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/onedrive
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-20 18:47:34 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitb180c73675846f45abab2190b39e0b9d0d6addbf (patch)
tree3bdd7dc9f23406220022e8b9261ae748362b4de1 /backends/cloud/onedrive
parenta449ddce15c512e809b9aedad334db6b52628e61 (diff)
downloadscummvm-rg350-b180c73675846f45abab2190b39e0b9d0d6addbf.tar.gz
scummvm-rg350-b180c73675846f45abab2190b39e0b9d0d6addbf.tar.bz2
scummvm-rg350-b180c73675846f45abab2190b39e0b9d0d6addbf.zip
CLOUD: Do some refactoring/cleanup
Nothing really major.
Diffstat (limited to 'backends/cloud/onedrive')
-rw-r--r--backends/cloud/onedrive/onedrivestorage.cpp12
-rw-r--r--backends/cloud/onedrive/onedrivestorage.h2
-rw-r--r--backends/cloud/onedrive/onedrivetokenrefresher.cpp6
-rw-r--r--backends/cloud/onedrive/onedriveuploadrequest.cpp3
4 files changed, 11 insertions, 12 deletions
diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp
index e9165943af..39213e82ed 100644
--- a/backends/cloud/onedrive/onedrivestorage.cpp
+++ b/backends/cloud/onedrive/onedrivestorage.cpp
@@ -189,7 +189,7 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo
void OneDriveStorage::fileInfoCallback(Networking::NetworkReadStreamCallback outerCallback, Networking::JsonResponse response) {
if (!response.value) {
warning("fileInfoCallback: NULL");
- if (outerCallback) (*outerCallback)(Networking::NetworkReadStreamResponse(response.request, 0));
+ if (outerCallback) (*outerCallback)(Networking::NetworkReadStreamResponse(response.request, nullptr));
return;
}
@@ -199,12 +199,12 @@ void OneDriveStorage::fileInfoCallback(Networking::NetworkReadStreamCallback out
if (outerCallback)
(*outerCallback)(Networking::NetworkReadStreamResponse(
response.request,
- new Networking::NetworkReadStream(url, 0, "")
+ new Networking::NetworkReadStream(url, nullptr, "")
));
} else {
warning("downloadUrl not found in passed JSON");
debug("%s", response.value->stringify().c_str());
- if (outerCallback) (*outerCallback)(Networking::NetworkReadStreamResponse(response.request, 0));
+ if (outerCallback) (*outerCallback)(Networking::NetworkReadStreamResponse(response.request, nullptr));
}
delete response.value;
}
@@ -244,17 +244,17 @@ OneDriveStorage *OneDriveStorage::loadFromConfig(Common::String keyPrefix) {
if (!ConfMan.hasKey(keyPrefix + "access_token", ConfMan.kCloudDomain)) {
warning("No access_token found");
- return 0;
+ return nullptr;
}
if (!ConfMan.hasKey(keyPrefix + "user_id", ConfMan.kCloudDomain)) {
warning("No user_id found");
- return 0;
+ return nullptr;
}
if (!ConfMan.hasKey(keyPrefix + "refresh_token", ConfMan.kCloudDomain)) {
warning("No refresh_token found");
- return 0;
+ return nullptr;
}
Common::String accessToken = ConfMan.get(keyPrefix + "access_token", ConfMan.kCloudDomain);
diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h
index 8ceaaf107e..60817e6084 100644
--- a/backends/cloud/onedrive/onedrivestorage.h
+++ b/backends/cloud/onedrive/onedrivestorage.h
@@ -104,7 +104,7 @@ public:
*/
void getAccessToken(BoolCallback callback, Networking::ErrorCallback errorCallback = nullptr, Common::String code = "");
- Common::String accessToken() { return _token; }
+ Common::String accessToken() const { return _token; }
};
} // End of namespace OneDrive
diff --git a/backends/cloud/onedrive/onedrivetokenrefresher.cpp b/backends/cloud/onedrive/onedrivetokenrefresher.cpp
index 04e155c084..9afea3d5bd 100644
--- a/backends/cloud/onedrive/onedrivetokenrefresher.cpp
+++ b/backends/cloud/onedrive/onedrivetokenrefresher.cpp
@@ -67,7 +67,7 @@ void OneDriveTokenRefresher::finishJson(Common::JSONValue *json) {
if (result.contains("error")) {
//new token needed => request token & then retry original request
if (_stream) {
- debug("code %ld", _stream->httpResponseCode());
+ debug(9, "code %ld", _stream->httpResponseCode());
}
Common::JSONObject error = result.getVal("error")->asObject();
@@ -76,12 +76,12 @@ void OneDriveTokenRefresher::finishJson(Common::JSONValue *json) {
Common::String code, message;
if (error.contains("code")) {
code = error.getVal("code")->asString();
- debug("code = %s", code.c_str());
+ debug(9, "code = %s", code.c_str());
}
if (error.contains("message")) {
message = error.getVal("message")->asString();
- debug("message = %s", message.c_str());
+ debug(9, "message = %s", message.c_str());
}
//determine whether token refreshing would help in this situation
diff --git a/backends/cloud/onedrive/onedriveuploadrequest.cpp b/backends/cloud/onedrive/onedriveuploadrequest.cpp
index 500f875b9d..569809d16b 100644
--- a/backends/cloud/onedrive/onedriveuploadrequest.cpp
+++ b/backends/cloud/onedrive/onedriveuploadrequest.cpp
@@ -28,7 +28,6 @@
#include "backends/networking/curl/curljsonrequest.h"
#include "backends/networking/curl/networkreadstream.h"
#include "common/json.h"
-#include "common/debug.h"
#include "onedrivetokenrefresher.h"
namespace Cloud {
@@ -135,7 +134,7 @@ void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse respon
if (object.contains("id") && object.contains("name")) {
//finished
- Common::String path = _savePath; //object.getVal("name")->asString();; //object.getVal("id")->asString();
+ Common::String path = _savePath;
uint32 size = object.getVal("size")->asIntegerNumber();
uint32 timestamp = ISO8601::convertToTimestamp(object.getVal("lastModifiedDateTime")->asString());
finishUpload(StorageFile(path, size, timestamp, false));