aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/dropbox
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-22 15:38:24 +0300
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitd57fca4665e65bca1cf487fb109d020d1233e800 (patch)
treec5a8b0e88f4c55e0f2e2afb2f78a4cd1f89d66f3 /backends/cloud/dropbox
parentcccfe7c247fed9b00c100e64433439386d6ef077 (diff)
downloadscummvm-rg350-d57fca4665e65bca1cf487fb109d020d1233e800.tar.gz
scummvm-rg350-d57fca4665e65bca1cf487fb109d020d1233e800.tar.bz2
scummvm-rg350-d57fca4665e65bca1cf487fb109d020d1233e800.zip
CLOUD: JANITORIAL: Fix code formatting
Diffstat (limited to 'backends/cloud/dropbox')
-rw-r--r--backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp20
-rw-r--r--backends/cloud/dropbox/dropboxinforequest.cpp9
-rw-r--r--backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp21
-rw-r--r--backends/cloud/dropbox/dropboxstorage.cpp12
-rw-r--r--backends/cloud/dropbox/dropboxuploadrequest.cpp15
5 files changed, 51 insertions, 26 deletions
diff --git a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp
index 6d228224d7..968fb4550a 100644
--- a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp
+++ b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp
@@ -38,13 +38,15 @@ DropboxCreateDirectoryRequest::DropboxCreateDirectoryRequest(Common::String toke
DropboxCreateDirectoryRequest::~DropboxCreateDirectoryRequest() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
delete _boolCallback;
}
void DropboxCreateDirectoryRequest::start() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
_ignoreCallback = false;
Networking::JsonCallback innerCallback = new Common::Callback<DropboxCreateDirectoryRequest, Networking::JsonResponse>(this, &DropboxCreateDirectoryRequest::responseCallback);
@@ -82,8 +84,9 @@ void DropboxCreateDirectoryRequest::responseCallback(Networking::JsonResponse re
}
Common::JSONObject info = json->asObject();
- if (info.contains("id")) finishCreation(true);
- else {
+ if (info.contains("id")) {
+ finishCreation(true);
+ } else {
if (info.contains("error_summary") && info.getVal("error_summary")->isString()) {
Common::String summary = info.getVal("error_summary")->asString();
if (summary.contains("path") && summary.contains("conflict") && summary.contains("folder")) {
@@ -101,8 +104,10 @@ void DropboxCreateDirectoryRequest::responseCallback(Networking::JsonResponse re
void DropboxCreateDirectoryRequest::errorCallback(Networking::ErrorResponse error) {
_workingRequest = nullptr;
- if (_ignoreCallback) return;
- if (error.request) _date = error.request->date();
+ if (_ignoreCallback)
+ return;
+ if (error.request)
+ _date = error.request->date();
finishError(error);
}
@@ -114,7 +119,8 @@ Common::String DropboxCreateDirectoryRequest::date() const { return _date; }
void DropboxCreateDirectoryRequest::finishCreation(bool success) {
Request::finishSuccess();
- if (_boolCallback) (*_boolCallback)(Storage::BoolResponse(this, success));
+ if (_boolCallback)
+ (*_boolCallback)(Storage::BoolResponse(this, success));
}
} // End of namespace Dropbox
diff --git a/backends/cloud/dropbox/dropboxinforequest.cpp b/backends/cloud/dropbox/dropboxinforequest.cpp
index e147ac58e2..37700eaf55 100644
--- a/backends/cloud/dropbox/dropboxinforequest.cpp
+++ b/backends/cloud/dropbox/dropboxinforequest.cpp
@@ -39,13 +39,15 @@ DropboxInfoRequest::DropboxInfoRequest(Common::String token, Storage::StorageInf
DropboxInfoRequest::~DropboxInfoRequest() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
delete _infoCallback;
}
void DropboxInfoRequest::start() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
_ignoreCallback = false;
Networking::JsonCallback innerCallback = new Common::Callback<DropboxInfoRequest, Networking::JsonResponse>(this, &DropboxInfoRequest::userResponseCallback);
@@ -136,7 +138,8 @@ void DropboxInfoRequest::restart() { start(); }
void DropboxInfoRequest::finishInfo(StorageInfo info) {
Request::finishSuccess();
- if (_infoCallback) (*_infoCallback)(Storage::StorageInfoResponse(this, info));
+ if (_infoCallback)
+ (*_infoCallback)(Storage::StorageInfoResponse(this, info));
}
} // End of namespace Dropbox
diff --git a/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp b/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp
index cc82f123b1..def9155f4e 100644
--- a/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp
+++ b/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp
@@ -39,13 +39,15 @@ DropboxListDirectoryRequest::DropboxListDirectoryRequest(Common::String token, C
DropboxListDirectoryRequest::~DropboxListDirectoryRequest() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
delete _listDirectoryCallback;
}
void DropboxListDirectoryRequest::start() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
_files.clear();
_ignoreCallback = false;
@@ -69,9 +71,11 @@ void DropboxListDirectoryRequest::start() {
void DropboxListDirectoryRequest::responseCallback(Networking::JsonResponse response) {
_workingRequest = nullptr;
- if (_ignoreCallback) return;
+ if (_ignoreCallback)
+ return;
- if (response.request) _date = response.request->date();
+ if (response.request)
+ _date = response.request->date();
Networking::ErrorResponse error(this);
Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request;
@@ -138,8 +142,10 @@ void DropboxListDirectoryRequest::responseCallback(Networking::JsonResponse resp
void DropboxListDirectoryRequest::errorCallback(Networking::ErrorResponse error) {
_workingRequest = nullptr;
- if (_ignoreCallback) return;
- if (error.request) _date = error.request->date();
+ if (_ignoreCallback)
+ return;
+ if (error.request)
+ _date = error.request->date();
finishError(error);
}
@@ -151,7 +157,8 @@ Common::String DropboxListDirectoryRequest::date() const { return _date; }
void DropboxListDirectoryRequest::finishListing(Common::Array<StorageFile> &files) {
Request::finishSuccess();
- if (_listDirectoryCallback) (*_listDirectoryCallback)(Storage::ListDirectoryResponse(this, files));
+ if (_listDirectoryCallback)
+ (*_listDirectoryCallback)(Storage::ListDirectoryResponse(this, files));
}
} // End of namespace Dropbox
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp
index d35e29fb05..cd1dff8afb 100644
--- a/backends/cloud/dropbox/dropboxstorage.cpp
+++ b/backends/cloud/dropbox/dropboxstorage.cpp
@@ -61,7 +61,8 @@ DropboxStorage::DropboxStorage(Common::String code) {
DropboxStorage::~DropboxStorage() {}
void DropboxStorage::getAccessToken(Common::String code) {
- if (!KEY || !SECRET) loadKeyAndSecret();
+ if (!KEY || !SECRET)
+ loadKeyAndSecret();
Networking::JsonCallback callback = new Common::Callback<DropboxStorage, Networking::JsonResponse>(this, &DropboxStorage::codeFlowComplete);
Networking::ErrorCallback errorCallback = new Common::Callback<DropboxStorage, Networking::ErrorResponse>(this, &DropboxStorage::codeFlowFailed);
Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(callback, errorCallback, "https://api.dropboxapi.com/oauth2/token");
@@ -134,17 +135,20 @@ Networking::Request *DropboxStorage::streamFileById(Common::String path, Network
request->addHeader("Content-Type: "); //required to be empty (as we do POST, it's usually app/form-url-encoded)
Networking::NetworkReadStreamResponse response = request->execute();
- if (callback) (*callback)(response);
+ if (callback)
+ (*callback)(response);
return response.request; // no leak here, response.request == request
}
Networking::Request *DropboxStorage::createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) {
- if (!errorCallback) errorCallback = getErrorPrintingCallback();
+ if (!errorCallback)
+ errorCallback = getErrorPrintingCallback();
return addRequest(new DropboxCreateDirectoryRequest(_token, path, callback, errorCallback));
}
Networking::Request *DropboxStorage::info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) {
- if (!errorCallback) errorCallback = getErrorPrintingCallback();
+ if (!errorCallback)
+ errorCallback = getErrorPrintingCallback();
return addRequest(new DropboxInfoRequest(_token, callback, errorCallback));
}
diff --git a/backends/cloud/dropbox/dropboxuploadrequest.cpp b/backends/cloud/dropbox/dropboxuploadrequest.cpp
index eaa945ada3..03c3fbc244 100644
--- a/backends/cloud/dropbox/dropboxuploadrequest.cpp
+++ b/backends/cloud/dropbox/dropboxuploadrequest.cpp
@@ -40,14 +40,16 @@ DropboxUploadRequest::DropboxUploadRequest(Common::String token, Common::String
DropboxUploadRequest::~DropboxUploadRequest() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
delete _contentsStream;
delete _uploadCallback;
}
void DropboxUploadRequest::start() {
_ignoreCallback = true;
- if (_workingRequest) _workingRequest->finish();
+ if (_workingRequest)
+ _workingRequest->finish();
if (!_contentsStream) {
warning("DropboxUploadRequest: cannot start because stream is invalid");
finishError(Networking::ErrorResponse(this, false, true, "", -1));
@@ -120,7 +122,8 @@ void DropboxUploadRequest::uploadNextPart() {
void DropboxUploadRequest::partUploadedCallback(Networking::JsonResponse response) {
debug(9, "partUploadedCallback");
_workingRequest = nullptr;
- if (_ignoreCallback) return;
+ if (_ignoreCallback)
+ return;
Networking::ErrorResponse error(this, false, true, "", -1);
Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request;
@@ -179,7 +182,8 @@ void DropboxUploadRequest::partUploadedCallback(Networking::JsonResponse respons
void DropboxUploadRequest::partUploadedErrorCallback(Networking::ErrorResponse error) {
debug("partUploadedErrorCallback");
_workingRequest = nullptr;
- if (_ignoreCallback) return;
+ if (_ignoreCallback)
+ return;
finishError(error);
}
@@ -189,7 +193,8 @@ void DropboxUploadRequest::restart() { start(); }
void DropboxUploadRequest::finishUpload(StorageFile file) {
Request::finishSuccess();
- if (_uploadCallback) (*_uploadCallback)(Storage::UploadResponse(this, file));
+ if (_uploadCallback)
+ (*_uploadCallback)(Storage::UploadResponse(this, file));
}
} // End of namespace Dropbox