diff options
author | Peter Bozsó | 2016-07-21 09:29:54 +0200 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 9254df2d9614b2cc8e35a3abbdc593e54616a322 (patch) | |
tree | a839f73d6e63250bce2fc8cf4eccb0cbac92e555 /backends/cloud | |
parent | 772d8ee42b820a5c19a8d9a9efb215f17606fb8f (diff) | |
download | scummvm-rg350-9254df2d9614b2cc8e35a3abbdc593e54616a322.tar.gz scummvm-rg350-9254df2d9614b2cc8e35a3abbdc593e54616a322.tar.bz2 scummvm-rg350-9254df2d9614b2cc8e35a3abbdc593e54616a322.zip |
CLOUD: Fix code formatting
Diffstat (limited to 'backends/cloud')
20 files changed, 81 insertions, 75 deletions
diff --git a/backends/cloud/box/boxlistdirectorybyidrequest.cpp b/backends/cloud/box/boxlistdirectorybyidrequest.cpp index 537666bc52..5a4e06265f 100644 --- a/backends/cloud/box/boxlistdirectorybyidrequest.cpp +++ b/backends/cloud/box/boxlistdirectorybyidrequest.cpp @@ -37,7 +37,7 @@ namespace Box { BoxListDirectoryByIdRequest::BoxListDirectoryByIdRequest(BoxStorage *storage, Common::String id, Storage::ListDirectoryCallback cb, Networking::ErrorCallback ecb): Networking::Request(nullptr, ecb), _requestedId(id), _storage(storage), _listDirectoryCallback(cb), - _workingRequest(nullptr), _ignoreCallback(false) { + _workingRequest(nullptr), _ignoreCallback(false) { start(); } @@ -91,12 +91,12 @@ void BoxListDirectoryByIdRequest::responseCallback(Networking::JsonResponse resp //TODO: check that error is returned the right way /* if (responseObject.contains("error") || responseObject.contains("error_summary")) { - warning("Box returned error: %s", responseObject.getVal("error_summary")->asString().c_str()); - error.failed = true; - error.response = json->stringify(); - finishError(error); - delete json; - return; + warning("Box returned error: %s", responseObject.getVal("error_summary")->asString().c_str()); + error.failed = true; + error.response = json->stringify(); + finishError(error); + delete json; + return; } */ diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index 873e4fabc1..cd61e042da 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -57,9 +57,9 @@ BoxStorage::BoxStorage(Common::String accessToken, Common::String refreshToken): BoxStorage::BoxStorage(Common::String code) { getAccessToken( - new Common::Callback<BoxStorage, BoolResponse>(this, &BoxStorage::codeFlowComplete), - new Common::Callback<BoxStorage, Networking::ErrorResponse>(this, &BoxStorage::codeFlowFailed), - code + new Common::Callback<BoxStorage, BoolResponse>(this, &BoxStorage::codeFlowComplete), + new Common::Callback<BoxStorage, Networking::ErrorResponse>(this, &BoxStorage::codeFlowFailed), + code ); } @@ -89,9 +89,9 @@ void BoxStorage::getAccessToken(BoolCallback callback, Networking::ErrorCallback request->addPostField("client_secret=" + Common::String(SECRET)); /* if (Cloud::CloudManager::couldUseLocalServer()) { - request->addPostField("&redirect_uri=http%3A%2F%2Flocalhost%3A12345"); + request->addPostField("&redirect_uri=http%3A%2F%2Flocalhost%3A12345"); } else { - request->addPostField("&redirect_uri=https%3A%2F%2Fwww.scummvm.org/c/code"); + request->addPostField("&redirect_uri=https%3A%2F%2Fwww.scummvm.org/c/code"); } */ addRequest(request); diff --git a/backends/cloud/box/boxstorage.h b/backends/cloud/box/boxstorage.h index 89bc470a26..80a572cb31 100644 --- a/backends/cloud/box/boxstorage.h +++ b/backends/cloud/box/boxstorage.h @@ -68,7 +68,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/box/boxuploadrequest.cpp b/backends/cloud/box/boxuploadrequest.cpp index d1f68f1d24..1449aa97e3 100644 --- a/backends/cloud/box/boxuploadrequest.cpp +++ b/backends/cloud/box/boxuploadrequest.cpp @@ -174,11 +174,11 @@ void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) { //TODO: check errors /* if (object.contains("error")) { - warning("Box returned error: %s", json->stringify(true).c_str()); - delete json; - error.response = json->stringify(true); - finishError(error); - return; + warning("Box returned error: %s", json->stringify(true).c_str()); + delete json; + error.response = json->stringify(true); + finishError(error); + return; } */ } diff --git a/backends/cloud/cloudmanager.h b/backends/cloud/cloudmanager.h index 42aa7189b9..aad01338a9 100644 --- a/backends/cloud/cloudmanager.h +++ b/backends/cloud/cloudmanager.h @@ -88,8 +88,8 @@ public: * Replace active Storage. * @note this method automatically saves the changes with ConfMan. * - * @param storage Cloud::Storage to replace active storage with. - * @param index one of Cloud::StorageID enum values to indicate what storage type is replaced. + * @param storage Cloud::Storage to replace active storage with. + * @param index one of Cloud::StorageID enum values to indicate what storage type is replaced. */ void replaceStorage(Storage *storage, uint32 index); @@ -100,54 +100,54 @@ public: * Returns active Storage, which could be used to interact * with cloud storage. * - * @return active Cloud::Storage or null, if there is no active Storage. + * @return active Cloud::Storage or null, if there is no active Storage. */ Cloud::Storage *getCurrentStorage() const; /** * Return active Storage's index. * - * @return active Storage's index. + * @return active Storage's index. */ uint32 getStorageIndex() const; /** * Return Storages names as list. * - * @return a list of Storages names. + * @return a list of Storages names. */ Common::StringArray listStorages() const; /** * Changes the storage to the one with given index. * - * @param new Storage's index. + * @param new Storage's index. */ bool switchStorage(uint32 index); /** * Return username used by Storage. * - * @param Storage's index. - * @returns username or "" if index is invalid (no such Storage). + * @param Storage's index. + * @returns username or "" if index is invalid (no such Storage). */ Common::String getStorageUsername(uint32 index); /** * Return space used by Storage. * - * @param Storage's index. - * @returns used space in bytes or 0 if index is invalid (no such Storage). + * @param Storage's index. + * @returns used space in bytes or 0 if index is invalid (no such Storage). */ uint64 getStorageUsedSpace(uint32 index); /** * Return Storage's last sync date. * - * @param Storage's index. - * @returns last sync date or "" if index is invalid (no such Storage). - It also returns "" if there never was any sync - or if storage is syncing right now. + * @param Storage's index. + * @returns last sync date or "" if index is invalid (no such Storage). + It also returns "" if there never was any sync + or if storage is syncing right now. */ Common::String getStorageLastSync(uint32 index); @@ -155,8 +155,8 @@ public: * Set Storage's username. * Automatically saves changes to the config. * - * @param index Storage's index. - * @param name username to set + * @param index Storage's index. + * @param name username to set */ void setStorageUsername(uint32 index, Common::String name); @@ -164,8 +164,8 @@ public: * Set Storage's used space field. * Automatically saves changes to the config. * - * @param index Storage's index. - * @param used value to set + * @param index Storage's index. + * @param used value to set */ void setStorageUsedSpace(uint32 index, uint64 used); @@ -173,8 +173,8 @@ public: * Set Storage's last sync date. * Automatically saves changes to the config. * - * @param index Storage's index. - * @param date date to set + * @param index Storage's index. + * @param date date to set */ void setStorageLastSync(uint32 index, Common::String date); @@ -182,8 +182,8 @@ public: * Replace Storage which has given index with a * storage created with given code. * - * @param index Storage's index - * @param code OAuth2 code received from user + * @param index Storage's index + * @param code OAuth2 code received from user */ void connectStorage(uint32 index, Common::String code); @@ -264,7 +264,7 @@ public: }; /** Shortcut for accessing the connection manager. */ -#define CloudMan Cloud::CloudManager::instance() +#define CloudMan Cloud::CloudManager::instance() } // End of namespace Cloud diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index 0d308f4131..1f46c51558 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -64,7 +64,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/folderdownloadrequest.cpp b/backends/cloud/folderdownloadrequest.cpp index de60480423..ebcd167506 100644 --- a/backends/cloud/folderdownloadrequest.cpp +++ b/backends/cloud/folderdownloadrequest.cpp @@ -69,7 +69,7 @@ void FolderDownloadRequest::directoryListedCallback(Storage::ListDirectoryRespon _pendingFiles = response.value; // remove all directories - for (Common::Array<StorageFile>::iterator i = _pendingFiles.begin(); i != _pendingFiles.end(); ) + for (Common::Array<StorageFile>::iterator i = _pendingFiles.begin(); i != _pendingFiles.end();) if (i->isDirectory()) _pendingFiles.erase(i); else { diff --git a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp index 7b05d48784..3228dde100 100644 --- a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp +++ b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp @@ -35,7 +35,7 @@ namespace GoogleDrive { GoogleDriveListDirectoryByIdRequest::GoogleDriveListDirectoryByIdRequest(GoogleDriveStorage *storage, Common::String id, Storage::ListDirectoryCallback cb, Networking::ErrorCallback ecb): Networking::Request(nullptr, ecb), _requestedId(id), _storage(storage), _listDirectoryCallback(cb), - _workingRequest(nullptr), _ignoreCallback(false) { + _workingRequest(nullptr), _ignoreCallback(false) { start(); } diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp index fbb5e69881..3d87be36d5 100644 --- a/backends/cloud/googledrive/googledrivestorage.cpp +++ b/backends/cloud/googledrive/googledrivestorage.cpp @@ -57,9 +57,9 @@ GoogleDriveStorage::GoogleDriveStorage(Common::String accessToken, Common::Strin GoogleDriveStorage::GoogleDriveStorage(Common::String code) { getAccessToken( - new Common::Callback<GoogleDriveStorage, BoolResponse>(this, &GoogleDriveStorage::codeFlowComplete), - new Common::Callback<GoogleDriveStorage, Networking::ErrorResponse>(this, &GoogleDriveStorage::codeFlowFailed), - code + new Common::Callback<GoogleDriveStorage, BoolResponse>(this, &GoogleDriveStorage::codeFlowComplete), + new Common::Callback<GoogleDriveStorage, Networking::ErrorResponse>(this, &GoogleDriveStorage::codeFlowFailed), + code ); } diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h index e60719c770..6a834c44ca 100644 --- a/backends/cloud/googledrive/googledrivestorage.h +++ b/backends/cloud/googledrive/googledrivestorage.h @@ -70,7 +70,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/googledrive/googledriveuploadrequest.cpp b/backends/cloud/googledrive/googledriveuploadrequest.cpp index 4a7c30e9a5..90dc8af9d2 100644 --- a/backends/cloud/googledrive/googledriveuploadrequest.cpp +++ b/backends/cloud/googledrive/googledriveuploadrequest.cpp @@ -218,7 +218,7 @@ bool GoogleDriveUploadRequest::handleHttp308(const Networking::NetworkReadStream Common::String headers = stream->responseHeaders(); const char *cstr = headers.c_str(); for (int rangeTry = 0; rangeTry < 2; ++rangeTry) { - const char *needle = (rangeTry==0 ? "Range: 0-" : "Range: bytes=0-"); + const char *needle = (rangeTry == 0 ? "Range: 0-" : "Range: bytes=0-"); uint32 needleLength = (rangeTry == 0 ? 9 : 15); const char *position = strstr(cstr, needle); //if it lost the first part, I refuse to talk with it diff --git a/backends/cloud/id/idcreatedirectoryrequest.cpp b/backends/cloud/id/idcreatedirectoryrequest.cpp index f64133c888..11f65033ae 100644 --- a/backends/cloud/id/idcreatedirectoryrequest.cpp +++ b/backends/cloud/id/idcreatedirectoryrequest.cpp @@ -104,7 +104,7 @@ void IdCreateDirectoryRequest::idResolveFailedCallback(Networking::ErrorResponse Common::String parentId = error.response; for (uint32 i = 0; i < parentId.size(); ++i) if (parentId[i] == '\n') { - parentId.erase(0, i+1); + parentId.erase(0, i + 1); break; } diff --git a/backends/cloud/id/idresolveidrequest.cpp b/backends/cloud/id/idresolveidrequest.cpp index abd64df1db..38478fa149 100644 --- a/backends/cloud/id/idresolveidrequest.cpp +++ b/backends/cloud/id/idresolveidrequest.cpp @@ -101,7 +101,7 @@ void IdResolveIdRequest::listedDirectoryCallback(Storage::FileArrayResponse resp } if (!found) { - if (lastLevel) finishError(Networking::ErrorResponse(this, false, true, Common::String("no such file found in its parent directory\n")+_currentDirectoryId, 404)); + if (lastLevel) finishError(Networking::ErrorResponse(this, false, true, Common::String("no such file found in its parent directory\n") + _currentDirectoryId, 404)); else finishError(Networking::ErrorResponse(this, false, true, "subdirectory not found", 400)); } } diff --git a/backends/cloud/iso8601.h b/backends/cloud/iso8601.h index 6e11322cdb..cdd817bc07 100644 --- a/backends/cloud/iso8601.h +++ b/backends/cloud/iso8601.h @@ -28,8 +28,8 @@ namespace Cloud { namespace ISO8601 { - /** Returns timestamp corresponding to given ISO 8601 date */ - uint32 convertToTimestamp(const Common::String &iso8601Date); +/** Returns timestamp corresponding to given ISO 8601 date */ +uint32 convertToTimestamp(const Common::String &iso8601Date); } // End of namespace ISO8601 } // End of namespace Cloud diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index 7c1849e0da..a26dec37a4 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -58,9 +58,9 @@ OneDriveStorage::OneDriveStorage(Common::String accessToken, Common::String user OneDriveStorage::OneDriveStorage(Common::String code) { getAccessToken( - new Common::Callback<OneDriveStorage, BoolResponse>(this, &OneDriveStorage::codeFlowComplete), - new Common::Callback<OneDriveStorage, Networking::ErrorResponse>(this, &OneDriveStorage::codeFlowFailed), - code + new Common::Callback<OneDriveStorage, BoolResponse>(this, &OneDriveStorage::codeFlowComplete), + new Common::Callback<OneDriveStorage, Networking::ErrorResponse>(this, &OneDriveStorage::codeFlowFailed), + code ); } diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h index 4985f3fd67..59c61074e3 100644 --- a/backends/cloud/onedrive/onedrivestorage.h +++ b/backends/cloud/onedrive/onedrivestorage.h @@ -67,7 +67,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/onedrive/onedriveuploadrequest.cpp b/backends/cloud/onedrive/onedriveuploadrequest.cpp index 2af4d06741..a22dbf06a3 100644 --- a/backends/cloud/onedrive/onedriveuploadrequest.cpp +++ b/backends/cloud/onedrive/onedriveuploadrequest.cpp @@ -68,7 +68,7 @@ void OneDriveUploadRequest::uploadNextPart() { const uint32 UPLOAD_PER_ONE_REQUEST = 10 * 1024 * 1024; if (_uploadUrl == "" && (uint32)_contentsStream->size() > UPLOAD_PER_ONE_REQUEST) { - Common::String url = "https://api.onedrive.com/v1.0/drive/special/approot:/"+ConnMan.urlEncode(_savePath)+":/upload.createSession"; //folder must exist + Common::String url = "https://api.onedrive.com/v1.0/drive/special/approot:/" + ConnMan.urlEncode(_savePath) + ":/upload.createSession"; //folder must exist Networking::JsonCallback callback = new Common::Callback<OneDriveUploadRequest, Networking::JsonResponse>(this, &OneDriveUploadRequest::partUploadedCallback); Networking::ErrorCallback failureCallback = new Common::Callback<OneDriveUploadRequest, Networking::ErrorResponse>(this, &OneDriveUploadRequest::partUploadedErrorCallback); Networking::CurlJsonRequest *request = new OneDriveTokenRefresher(_storage, callback, failureCallback, url.c_str()); @@ -80,7 +80,7 @@ void OneDriveUploadRequest::uploadNextPart() { Common::String url; if (_uploadUrl == "") { - url = "https://api.onedrive.com/v1.0/drive/special/approot:/"+ConnMan.urlEncode(_savePath)+":/content"; + url = "https://api.onedrive.com/v1.0/drive/special/approot:/" + ConnMan.urlEncode(_savePath) + ":/content"; } else { url = _uploadUrl; } @@ -98,14 +98,13 @@ void OneDriveUploadRequest::uploadNextPart() { request->setBuffer(buffer, size); if (_uploadUrl != "") - request->addHeader(Common::String::format("Content-Range: bytes %u-%u/%u", oldPos, _contentsStream->pos()-1, _contentsStream->size())); - else - if (_contentsStream->size() == 0) { - warning("\"Sorry, OneDrive can't upload empty files\""); - finishUpload(StorageFile(_savePath, 0, 0, false)); - delete request; - return; - } + request->addHeader(Common::String::format("Content-Range: bytes %u-%u/%u", oldPos, _contentsStream->pos() - 1, _contentsStream->size())); + else if (_contentsStream->size() == 0) { + warning("\"Sorry, OneDrive can't upload empty files\""); + finishUpload(StorageFile(_savePath, 0, 0, false)); + delete request; + return; + } _workingRequest = ConnMan.addRequest(request); } diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 957b7e655d..e3b3aa2400 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -181,7 +181,8 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er Common::String dir = _storage->savesDirectoryPath(); if (dir.lastChar() == '/') dir.deleteLastChar(); debug(9, "creating %s", dir.c_str()); - _workingRequest = _storage->createDirectory(dir, + _workingRequest = _storage->createDirectory( + dir, new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::directoryCreatedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::directoryCreatedErrorCallback) ); @@ -225,7 +226,9 @@ void SavesSyncRequest::downloadNextFile() { sendCommand(GUI::kSavesSyncProgressCmd, (int)(getDownloadingProgress() * 100)); debug(9, "downloading %s (%d %%)", _currentDownloadingFile.name().c_str(), (int)(getProgress() * 100)); - _workingRequest = _storage->downloadById(_currentDownloadingFile.id(), DefaultSaveFileManager::concatWithSavesPath(_currentDownloadingFile.name()), + _workingRequest = _storage->downloadById( + _currentDownloadingFile.id(), + DefaultSaveFileManager::concatWithSavesPath(_currentDownloadingFile.name()), new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::fileDownloadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileDownloadedErrorCallback) ); @@ -270,14 +273,18 @@ void SavesSyncRequest::uploadNextFile() { _currentUploadingFile = _filesToUpload.back(); _filesToUpload.pop_back(); - debug(9, "uploading %s (%d %%)", _currentUploadingFile.c_str(), (int)(getProgress()*100)); + debug(9, "uploading %s (%d %%)", _currentUploadingFile.c_str(), (int)(getProgress() * 100)); if (_storage->uploadStreamSupported()) { - _workingRequest = _storage->upload(_storage->savesDirectoryPath() + _currentUploadingFile, g_system->getSavefileManager()->openRawFile(_currentUploadingFile), + _workingRequest = _storage->upload( + _storage->savesDirectoryPath() + _currentUploadingFile, + g_system->getSavefileManager()->openRawFile(_currentUploadingFile), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileUploadedErrorCallback) ); } else { - _workingRequest = _storage->upload(_storage->savesDirectoryPath() + _currentUploadingFile, DefaultSaveFileManager::concatWithSavesPath(_currentUploadingFile), + _workingRequest = _storage->upload( + _storage->savesDirectoryPath() + _currentUploadingFile, + DefaultSaveFileManager::concatWithSavesPath(_currentUploadingFile), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileUploadedErrorCallback) ); diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h index 8582a7575a..6a5765f13a 100644 --- a/backends/cloud/storage.h +++ b/backends/cloud/storage.h @@ -111,7 +111,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const = 0; @@ -155,7 +155,7 @@ public: * Calls the <errorCallback> if failed to get information. * * @note on success Storage should also call - * CloudMan.setStorageUsername(). + * CloudMan.setStorageUsername(). */ virtual Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) = 0; diff --git a/backends/cloud/storagefile.cpp b/backends/cloud/storagefile.cpp index 4bee92edce..c1107ea23d 100644 --- a/backends/cloud/storagefile.cpp +++ b/backends/cloud/storagefile.cpp @@ -42,7 +42,7 @@ StorageFile::StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir) { uint32 i = _name.size() - 1; while (true) { if (_name[i] == '/' || _name[i] == '\\') { - _name.erase(0, i+1); + _name.erase(0, i + 1); break; } if (i == 0) break; |