diff options
100 files changed, 344 insertions, 344 deletions
diff --git a/backends/cloud/box/boxlistdirectorybyidrequest.cpp b/backends/cloud/box/boxlistdirectorybyidrequest.cpp index d4606b1851..537666bc52 100644 --- a/backends/cloud/box/boxlistdirectorybyidrequest.cpp +++ b/backends/cloud/box/boxlistdirectorybyidrequest.cpp @@ -87,7 +87,7 @@ void BoxListDirectoryByIdRequest::responseCallback(Networking::JsonResponse resp Common::JSONObject responseObject = json->asObject(); //debug("%s", json->stringify(true).c_str()); - + //TODO: check that error is returned the right way /* if (responseObject.contains("error") || responseObject.contains("error_summary")) { @@ -100,7 +100,7 @@ void BoxListDirectoryByIdRequest::responseCallback(Networking::JsonResponse resp } */ - //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults + //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults if (responseObject.contains("entries") && responseObject.getVal("entries")->isArray()) { Common::JSONArray items = responseObject.getVal("entries")->asArray(); @@ -160,7 +160,7 @@ void BoxListDirectoryByIdRequest::restart() { start(); } Common::String BoxListDirectoryByIdRequest::date() const { return _date; } -void BoxListDirectoryByIdRequest::finishListing(Common::Array<StorageFile> &files) { +void BoxListDirectoryByIdRequest::finishListing(Common::Array<StorageFile> &files) { Request::finishSuccess(); if (_listDirectoryCallback) (*_listDirectoryCallback)(Storage::ListDirectoryResponse(this, files)); } diff --git a/backends/cloud/box/boxlistdirectorybyidrequest.h b/backends/cloud/box/boxlistdirectorybyidrequest.h index ccf8d2e342..13f1ba056c 100644 --- a/backends/cloud/box/boxlistdirectorybyidrequest.h +++ b/backends/cloud/box/boxlistdirectorybyidrequest.h @@ -34,7 +34,7 @@ namespace Box { class BoxStorage; class BoxListDirectoryByIdRequest: public Networking::Request { - Common::String _requestedId; + Common::String _requestedId; BoxStorage *_storage; Storage::ListDirectoryCallback _listDirectoryCallback; @@ -42,7 +42,7 @@ class BoxListDirectoryByIdRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _date; - + void start(); void makeRequest(uint32 offset); void responseCallback(Networking::JsonResponse response); diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index c31c72b49f..6d4b5efd8e 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -152,7 +152,7 @@ void BoxStorage::infoInnerCallback(StorageInfoCallback outerCallback, Networking delete outerCallback; return; } - + Common::JSONObject info = json->asObject(); Common::String uid, name, email; @@ -224,7 +224,7 @@ Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String pare Common::JSONObject parentObject; parentObject.setVal("id", new Common::JSONValue(parentId)); - Common::JSONObject jsonRequestParameters; + Common::JSONObject jsonRequestParameters; jsonRequestParameters.setVal("name", new Common::JSONValue(name)); jsonRequestParameters.setVal("parent", new Common::JSONValue(parentObject)); @@ -248,7 +248,7 @@ Networking::Request *BoxStorage::upload(Common::String path, Common::SeekableRea } bool BoxStorage::uploadStreamSupported() { - return false; + return false; } Networking::Request *BoxStorage::streamFileById(Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback) { diff --git a/backends/cloud/box/boxstorage.h b/backends/cloud/box/boxstorage.h index 1373c2fbeb..89bc470a26 100644 --- a/backends/cloud/box/boxstorage.h +++ b/backends/cloud/box/boxstorage.h @@ -48,7 +48,7 @@ class BoxStorage: public Id::IdStorage { void infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse json); void createDirectoryInnerCallback(BoolCallback outerCallback, Networking::JsonResponse response); -public: +public: /** This constructor uses OAuth code flow to get tokens. */ BoxStorage(Common::String code); virtual ~BoxStorage(); @@ -97,7 +97,7 @@ public: virtual Common::String savesDirectoryPath(); /** - * Load token and user id from configs and return BoxStorage for those. + * Load token and user id from configs and return BoxStorage for those. * @return pointer to the newly created BoxStorage or 0 if some problem occured. */ static BoxStorage *loadFromConfig(Common::String keyPrefix); diff --git a/backends/cloud/box/boxtokenrefresher.cpp b/backends/cloud/box/boxtokenrefresher.cpp index f100e186be..65964f3010 100644 --- a/backends/cloud/box/boxtokenrefresher.cpp +++ b/backends/cloud/box/boxtokenrefresher.cpp @@ -52,7 +52,7 @@ void BoxTokenRefresher::tokenRefreshed(Storage::BoolResponse response) { } setHeaders(_headers); - //successfully received refreshed token, can restart the original request now + //successfully received refreshed token, can restart the original request now retry(0); } @@ -77,7 +77,7 @@ void BoxTokenRefresher::finishJson(Common::JSONValue *json) { Common::String code, message; if (result.contains("code")) { code = result.getVal("code")->asString(); - debug(9, "code = %s", code.c_str()); + debug(9, "code = %s", code.c_str()); } if (result.contains("message")) { @@ -88,13 +88,13 @@ void BoxTokenRefresher::finishJson(Common::JSONValue *json) { //TODO: decide when token refreshment will help //if (code == "unauthenticated") irrecoverable = false; - if (irrecoverable) { + if (irrecoverable) { finishError(Networking::ErrorResponse(this, false, true, json->stringify(true), httpCode)); delete json; return; } - pause(); + pause(); delete json; _parentStorage->getAccessToken(new Common::Callback<BoxTokenRefresher, Storage::BoolResponse>(this, &BoxTokenRefresher::tokenRefreshed)); return; @@ -117,7 +117,7 @@ void BoxTokenRefresher::finishError(Networking::ErrorResponse error) { Request::finishError(error); } -void BoxTokenRefresher::setHeaders(Common::Array<Common::String> &headers) { +void BoxTokenRefresher::setHeaders(Common::Array<Common::String> &headers) { _headers = headers; curl_slist_free_all(_headersList); _headersList = 0; diff --git a/backends/cloud/box/boxtokenrefresher.h b/backends/cloud/box/boxtokenrefresher.h index 7dedefdbe5..c08e8468c3 100644 --- a/backends/cloud/box/boxtokenrefresher.h +++ b/backends/cloud/box/boxtokenrefresher.h @@ -33,13 +33,13 @@ class BoxStorage; class BoxTokenRefresher: public Networking::CurlJsonRequest { BoxStorage *_parentStorage; - Common::Array<Common::String> _headers; - + Common::Array<Common::String> _headers; + void tokenRefreshed(Storage::BoolResponse response); virtual void finishJson(Common::JSONValue *json); virtual void finishError(Networking::ErrorResponse error); -public: +public: BoxTokenRefresher(BoxStorage *parent, Networking::JsonCallback callback, Networking::ErrorCallback ecb, const char *url); virtual ~BoxTokenRefresher(); diff --git a/backends/cloud/box/boxuploadrequest.cpp b/backends/cloud/box/boxuploadrequest.cpp index c81a3ab439..d1f68f1d24 100644 --- a/backends/cloud/box/boxuploadrequest.cpp +++ b/backends/cloud/box/boxuploadrequest.cpp @@ -123,12 +123,12 @@ void BoxUploadRequest::upload() { _workingRequest = ConnMan.addRequest(request); } -void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) { +void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) { _workingRequest = nullptr; if (_ignoreCallback) return; - + Networking::ErrorResponse error(this, false, true, "", -1); - Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; + Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; if (rq) { const Networking::NetworkReadStream *stream = rq->getNetworkReadStream(); if (stream) { @@ -193,7 +193,7 @@ void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) { delete json; } -void BoxUploadRequest::notUploadedCallback(Networking::ErrorResponse error) { +void BoxUploadRequest::notUploadedCallback(Networking::ErrorResponse error) { _workingRequest = nullptr; if (_ignoreCallback) return; finishError(error); diff --git a/backends/cloud/box/boxuploadrequest.h b/backends/cloud/box/boxuploadrequest.h index 3d15aa70b3..1bc8690210 100644 --- a/backends/cloud/box/boxuploadrequest.h +++ b/backends/cloud/box/boxuploadrequest.h @@ -39,7 +39,7 @@ class BoxUploadRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _resolvedId, _parentId; - + void start(); void resolveId(); void idResolvedCallback(Storage::UploadResponse response); diff --git a/backends/cloud/cloudmanager.cpp b/backends/cloud/cloudmanager.cpp index 55dbb2b42d..a4763dba2d 100644 --- a/backends/cloud/cloudmanager.cpp +++ b/backends/cloud/cloudmanager.cpp @@ -42,7 +42,7 @@ const char *const CloudManager::kStoragePrefix = "storage_"; CloudManager::CloudManager() : _currentStorageIndex(0), _activeStorage(nullptr) {} CloudManager::~CloudManager() { - //TODO: do we have to save storages on manager destruction? + //TODO: do we have to save storages on manager destruction? delete _activeStorage; freeStorages(); } diff --git a/backends/cloud/cloudmanager.h b/backends/cloud/cloudmanager.h index 2941ea6331..0146a4118e 100644 --- a/backends/cloud/cloudmanager.h +++ b/backends/cloud/cloudmanager.h @@ -89,7 +89,7 @@ public: * @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 index one of Cloud::StorageID enum values to indicate what storage type is replaced. */ void replaceStorage(Storage *storage, uint32 index); @@ -160,7 +160,7 @@ public: */ void setStorageUsername(uint32 index, Common::String name); - /** + /** * Set Storage's used space field. * Automatically saves changes to the config. * diff --git a/backends/cloud/downloadrequest.cpp b/backends/cloud/downloadrequest.cpp index e8c410ae3e..33ac81138d 100644 --- a/backends/cloud/downloadrequest.cpp +++ b/backends/cloud/downloadrequest.cpp @@ -66,7 +66,7 @@ void DownloadRequest::streamErrorCallback(Networking::ErrorResponse error) { finishError(error); } -void DownloadRequest::handle() { +void DownloadRequest::handle() { if (!_localFile) { warning("DownloadRequest: no file to write"); finishError(Networking::ErrorResponse(this, false, true, "", -1)); @@ -96,12 +96,12 @@ void DownloadRequest::handle() { if (_remoteFileStream->eos()) { if (_remoteFileStream->httpResponseCode() != 200) { warning("HTTP response code is not 200 OK (it's %ld)", _remoteFileStream->httpResponseCode()); - //TODO: do something about it actually + //TODO: do something about it actually } finishDownload(_remoteFileStream->httpResponseCode() == 200); - _localFile->close(); //yes, I know it's closed automatically in ~DumpFile() + _localFile->close(); //yes, I know it's closed automatically in ~DumpFile() } } diff --git a/backends/cloud/downloadrequest.h b/backends/cloud/downloadrequest.h index 138616a04b..7e58098849 100644 --- a/backends/cloud/downloadrequest.h +++ b/backends/cloud/downloadrequest.h @@ -32,8 +32,8 @@ namespace Cloud { #define DOWNLOAD_REQUEST_BUFFER_SIZE 1 * 1024 * 1024 -class DownloadRequest: public Networking::Request { - Storage::BoolCallback _boolCallback; +class DownloadRequest: public Networking::Request { + Storage::BoolCallback _boolCallback; Common::DumpFile *_localFile; Common::String _remoteFileId; Storage *_storage; diff --git a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp index 81ace75dda..6d228224d7 100644 --- a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp +++ b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp @@ -44,7 +44,7 @@ DropboxCreateDirectoryRequest::~DropboxCreateDirectoryRequest() { 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); @@ -74,13 +74,13 @@ void DropboxCreateDirectoryRequest::responseCallback(Networking::JsonResponse re Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; if (rq && rq->getNetworkReadStream()) error.httpResponseCode = rq->getNetworkReadStream()->httpResponseCode(); - + if (!json) { warning("NULL passed instead of JSON"); finishError(error); return; } - + Common::JSONObject info = json->asObject(); if (info.contains("id")) finishCreation(true); else { diff --git a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.h b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.h index 4bdc6dbee6..0ef6a22a04 100644 --- a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.h +++ b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.h @@ -37,7 +37,7 @@ class DropboxCreateDirectoryRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _date; - + void start(); void responseCallback(Networking::JsonResponse response); void errorCallback(Networking::ErrorResponse error); diff --git a/backends/cloud/dropbox/dropboxinforequest.cpp b/backends/cloud/dropbox/dropboxinforequest.cpp index f5a14abe1c..e147ac58e2 100644 --- a/backends/cloud/dropbox/dropboxinforequest.cpp +++ b/backends/cloud/dropbox/dropboxinforequest.cpp @@ -45,7 +45,7 @@ DropboxInfoRequest::~DropboxInfoRequest() { 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); @@ -70,7 +70,7 @@ void DropboxInfoRequest::userResponseCallback(Networking::JsonResponse response) Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; if (rq && rq->getNetworkReadStream()) error.httpResponseCode = rq->getNetworkReadStream()->httpResponseCode(); - + if (!json) { warning("NULL passed instead of JSON"); finishError(error); diff --git a/backends/cloud/dropbox/dropboxinforequest.h b/backends/cloud/dropbox/dropboxinforequest.h index a91d016e60..68a3e135de 100644 --- a/backends/cloud/dropbox/dropboxinforequest.h +++ b/backends/cloud/dropbox/dropboxinforequest.h @@ -36,7 +36,7 @@ class DropboxInfoRequest: public Networking::Request { Storage::StorageInfoCallback _infoCallback; Request *_workingRequest; bool _ignoreCallback; - + void start(); void userResponseCallback(Networking::JsonResponse response); void quotaResponseCallback(Networking::JsonResponse response); diff --git a/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp b/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp index dcbca3131e..cc82f123b1 100644 --- a/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp +++ b/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp @@ -81,7 +81,7 @@ void DropboxListDirectoryRequest::responseCallback(Networking::JsonResponse resp Common::JSONValue *json = response.value; if (json) { Common::JSONObject responseObjecct = json->asObject(); - + if (responseObjecct.contains("error") || responseObjecct.contains("error_summary")) { warning("Dropbox returned error: %s", responseObjecct.getVal("error_summary")->asString().c_str()); error.failed = true; @@ -91,7 +91,7 @@ void DropboxListDirectoryRequest::responseCallback(Networking::JsonResponse resp return; } - //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults + //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults if (responseObjecct.contains("entries")) { Common::JSONArray items = responseObjecct.getVal("entries")->asArray(); @@ -110,7 +110,7 @@ void DropboxListDirectoryRequest::responseCallback(Networking::JsonResponse resp bool hasMore = (responseObjecct.contains("has_more") && responseObjecct.getVal("has_more")->asBool()); - if (hasMore) { + if (hasMore) { Networking::JsonCallback callback = new Common::Callback<DropboxListDirectoryRequest, Networking::JsonResponse>(this, &DropboxListDirectoryRequest::responseCallback); Networking::ErrorCallback failureCallback = new Common::Callback<DropboxListDirectoryRequest, Networking::ErrorResponse>(this, &DropboxListDirectoryRequest::errorCallback); Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(callback, failureCallback, "https://api.dropboxapi.com/2/files/list_folder/continue"); @@ -124,9 +124,9 @@ void DropboxListDirectoryRequest::responseCallback(Networking::JsonResponse resp request->addPostField(Common::JSON::stringify(&value)); _workingRequest = ConnMan.addRequest(request); - } else { + } else { finishListing(_files); - } + } } else { warning("null, not json"); error.failed = true; @@ -149,7 +149,7 @@ void DropboxListDirectoryRequest::restart() { start(); } Common::String DropboxListDirectoryRequest::date() const { return _date; } -void DropboxListDirectoryRequest::finishListing(Common::Array<StorageFile> &files) { +void DropboxListDirectoryRequest::finishListing(Common::Array<StorageFile> &files) { Request::finishSuccess(); if (_listDirectoryCallback) (*_listDirectoryCallback)(Storage::ListDirectoryResponse(this, files)); } diff --git a/backends/cloud/dropbox/dropboxlistdirectoryrequest.h b/backends/cloud/dropbox/dropboxlistdirectoryrequest.h index 62dde71f76..5c0d8dfa21 100644 --- a/backends/cloud/dropbox/dropboxlistdirectoryrequest.h +++ b/backends/cloud/dropbox/dropboxlistdirectoryrequest.h @@ -41,7 +41,7 @@ class DropboxListDirectoryRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _date; - + void start(); void responseCallback(Networking::JsonResponse response); void errorCallback(Networking::ErrorResponse error); diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp index 7e3521f40e..7ef07a5a65 100644 --- a/backends/cloud/dropbox/dropboxstorage.cpp +++ b/backends/cloud/dropbox/dropboxstorage.cpp @@ -87,7 +87,7 @@ void DropboxStorage::codeFlowComplete(Networking::JsonResponse response) { CloudMan.removeStorage(this); } else { _token = result.getVal("access_token")->asString(); - _uid = result.getVal("uid")->asString(); + _uid = result.getVal("uid")->asString(); ConfMan.removeKey("dropbox_code", ConfMan.kCloudDomain); CloudMan.replaceStorage(this, kStorageDropboxId); ConfMan.flushToDisk(); diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index 9dd28ba810..0d308f4131 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -72,9 +72,9 @@ public: /** Returns ListDirectoryStatus struct with list of files. */ virtual Networking::Request *listDirectory(Common::String path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive = false); - + /** Returns UploadStatus struct with info about uploaded file. */ - virtual Networking::Request *upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback); + virtual Networking::Request *upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback); /** Returns pointer to Networking::NetworkReadStream. */ virtual Networking::Request *streamFileById(Common::String path, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback); @@ -92,7 +92,7 @@ public: virtual Common::String savesDirectoryPath(); /** - * Load token and user id from configs and return DropboxStorage for those. + * Load token and user id from configs and return DropboxStorage for those. * @return pointer to the newly created DropboxStorage or 0 if some problem occured. */ static DropboxStorage *loadFromConfig(Common::String keyPrefix); diff --git a/backends/cloud/dropbox/dropboxuploadrequest.cpp b/backends/cloud/dropbox/dropboxuploadrequest.cpp index 29b7f60c8a..eaa945ada3 100644 --- a/backends/cloud/dropbox/dropboxuploadrequest.cpp +++ b/backends/cloud/dropbox/dropboxuploadrequest.cpp @@ -63,9 +63,9 @@ void DropboxUploadRequest::start() { uploadNextPart(); } -void DropboxUploadRequest::uploadNextPart() { +void DropboxUploadRequest::uploadNextPart() { const uint32 UPLOAD_PER_ONE_REQUEST = 10 * 1024 * 1024; - + Common::String url = "https://content.dropboxapi.com/2/files/upload_session/"; Common::JSONObject jsonRequestParameters; @@ -82,8 +82,8 @@ void DropboxUploadRequest::uploadNextPart() { } } else { if ((uint32)(_contentsStream->size() - _contentsStream->pos()) <= UPLOAD_PER_ONE_REQUEST) { - url += "finish"; - Common::JSONObject jsonCursor, jsonCommit; + url += "finish"; + Common::JSONObject jsonCursor, jsonCommit; jsonCursor.setVal("session_id", new Common::JSONValue(_sessionId)); jsonCursor.setVal("offset", new Common::JSONValue((long long int)_contentsStream->pos())); jsonCommit.setVal("path", new Common::JSONValue(_savePath)); @@ -98,22 +98,22 @@ void DropboxUploadRequest::uploadNextPart() { jsonCursor.setVal("session_id", new Common::JSONValue(_sessionId)); jsonCursor.setVal("offset", new Common::JSONValue((long long int)_contentsStream->pos())); jsonRequestParameters.setVal("cursor", new Common::JSONValue(jsonCursor)); - jsonRequestParameters.setVal("close", new Common::JSONValue(false)); + jsonRequestParameters.setVal("close", new Common::JSONValue(false)); } } - + Common::JSONValue value(jsonRequestParameters); Networking::JsonCallback callback = new Common::Callback<DropboxUploadRequest, Networking::JsonResponse>(this, &DropboxUploadRequest::partUploadedCallback); Networking::ErrorCallback failureCallback = new Common::Callback<DropboxUploadRequest, Networking::ErrorResponse>(this, &DropboxUploadRequest::partUploadedErrorCallback); Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(callback, failureCallback, url); request->addHeader("Authorization: Bearer " + _token); - request->addHeader("Content-Type: application/octet-stream"); - request->addHeader("Dropbox-API-Arg: " + Common::JSON::stringify(&value)); + request->addHeader("Content-Type: application/octet-stream"); + request->addHeader("Dropbox-API-Arg: " + Common::JSON::stringify(&value)); byte *buffer = new byte[UPLOAD_PER_ONE_REQUEST]; uint32 size = _contentsStream->read(buffer, UPLOAD_PER_ONE_REQUEST); request->setBuffer(buffer, size); - + _workingRequest = ConnMan.addRequest(request); } @@ -137,7 +137,7 @@ void DropboxUploadRequest::partUploadedCallback(Networking::JsonResponse respons //debug("%s", json->stringify(true).c_str()); if (object.contains("error") || object.contains("error_summary")) { - warning("Dropbox returned error: %s", object.getVal("error_summary")->asString().c_str()); + warning("Dropbox returned error: %s", object.getVal("error_summary")->asString().c_str()); error.response = json->stringify(true); finishError(error); delete json; @@ -162,14 +162,14 @@ void DropboxUploadRequest::partUploadedCallback(Networking::JsonResponse respons } } - if (!needsFinishRequest && (_contentsStream->eos() || _contentsStream->pos() >= _contentsStream->size() - 1)) { + if (!needsFinishRequest && (_contentsStream->eos() || _contentsStream->pos() >= _contentsStream->size() - 1)) { warning("no file info to return"); finishUpload(StorageFile(_savePath, 0, 0, false)); } else { uploadNextPart(); } } else { - warning("null, not json"); + warning("null, not json"); finishError(error); } diff --git a/backends/cloud/dropbox/dropboxuploadrequest.h b/backends/cloud/dropbox/dropboxuploadrequest.h index 8d9a3e2650..5adf5a6df2 100644 --- a/backends/cloud/dropbox/dropboxuploadrequest.h +++ b/backends/cloud/dropbox/dropboxuploadrequest.h @@ -39,7 +39,7 @@ class DropboxUploadRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _sessionId; - + void start(); void uploadNextPart(); void partUploadedCallback(Networking::JsonResponse response); diff --git a/backends/cloud/folderdownloadrequest.cpp b/backends/cloud/folderdownloadrequest.cpp index 9e05202bf7..de60480423 100644 --- a/backends/cloud/folderdownloadrequest.cpp +++ b/backends/cloud/folderdownloadrequest.cpp @@ -46,7 +46,7 @@ FolderDownloadRequest::~FolderDownloadRequest() { void FolderDownloadRequest::start() { //cleanup _ignoreCallback = true; - if (_workingRequest) _workingRequest->finish(); + if (_workingRequest) _workingRequest->finish(); _currentFile = StorageFile(); _pendingFiles.clear(); _failedFiles.clear(); @@ -108,7 +108,7 @@ void FolderDownloadRequest::downloadNextFile() { finishDownload(_failedFiles); return; } - + _currentFile = _pendingFiles.back(); _pendingFiles.pop_back(); } while (_currentFile.isDirectory()); //TODO: may be create these directories (in case those are empty) @@ -124,7 +124,7 @@ void FolderDownloadRequest::downloadNextFile() { } else { warning("Can't process the following paths:"); warning("remote directory: %s", _remoteDirectoryPath.c_str()); - warning("remote file under that directory: %s", remotePath.c_str()); + warning("remote file under that directory: %s", remotePath.c_str()); } if (_localDirectoryPath != "") { if (_localDirectoryPath.lastChar() == '/' || _localDirectoryPath.lastChar() == '\\') diff --git a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp index 36bc390da0..7b05d48784 100644 --- a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp +++ b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp @@ -82,7 +82,7 @@ void GoogleDriveListDirectoryByIdRequest::responseCallback(Networking::JsonRespo Common::JSONObject responseObject = json->asObject(); ///debug("%s", json->stringify(true).c_str()); - + if (responseObject.contains("error") || responseObject.contains("error_summary")) { warning("GoogleDrive returned error: %s", responseObject.getVal("error_summary")->asString().c_str()); error.failed = true; @@ -92,7 +92,7 @@ void GoogleDriveListDirectoryByIdRequest::responseCallback(Networking::JsonRespo return; } - //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults + //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults if (responseObject.contains("files") && responseObject.getVal("files")->isArray()) { Common::JSONArray items = responseObject.getVal("files")->asArray(); @@ -117,9 +117,9 @@ void GoogleDriveListDirectoryByIdRequest::responseCallback(Networking::JsonRespo if (hasMore) { Common::String token = responseObject.getVal("nextPageToken")->asString(); makeRequest(token); - } else { + } else { finishListing(_files); - } + } } else { warning("null, not json"); error.failed = true; @@ -142,7 +142,7 @@ void GoogleDriveListDirectoryByIdRequest::restart() { start(); } Common::String GoogleDriveListDirectoryByIdRequest::date() const { return _date; } -void GoogleDriveListDirectoryByIdRequest::finishListing(Common::Array<StorageFile> &files) { +void GoogleDriveListDirectoryByIdRequest::finishListing(Common::Array<StorageFile> &files) { Request::finishSuccess(); if (_listDirectoryCallback) (*_listDirectoryCallback)(Storage::ListDirectoryResponse(this, files)); } diff --git a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.h b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.h index ecde880323..e94c6b1f4e 100644 --- a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.h +++ b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.h @@ -34,7 +34,7 @@ namespace GoogleDrive { class GoogleDriveStorage; class GoogleDriveListDirectoryByIdRequest: public Networking::Request { - Common::String _requestedId; + Common::String _requestedId; GoogleDriveStorage *_storage; Storage::ListDirectoryCallback _listDirectoryCallback; @@ -42,7 +42,7 @@ class GoogleDriveListDirectoryByIdRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _date; - + void start(); void makeRequest(Common::String pageToken); void responseCallback(Networking::JsonResponse response); diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp index 77ac8989f1..2d9f33cfce 100644 --- a/backends/cloud/googledrive/googledrivestorage.cpp +++ b/backends/cloud/googledrive/googledrivestorage.cpp @@ -138,7 +138,7 @@ void GoogleDriveStorage::codeFlowFailed(Networking::ErrorResponse error) { CloudMan.removeStorage(this); } -void GoogleDriveStorage::saveConfig(Common::String keyPrefix) { +void GoogleDriveStorage::saveConfig(Common::String keyPrefix) { ConfMan.set(keyPrefix + "access_token", _token, ConfMan.kCloudDomain); ConfMan.set(keyPrefix + "refresh_token", _refreshToken, ConfMan.kCloudDomain); } @@ -173,11 +173,11 @@ void GoogleDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Ne //"usageInDrive":"6332462","limit":"18253611008","usage":"6332462","usageInDriveTrash":"0" Common::JSONObject storageQuota = info.getVal("storageQuota")->asObject(); Common::String usage = storageQuota.getVal("usage")->asString(); - Common::String limit = storageQuota.getVal("limit")->asString(); + Common::String limit = storageQuota.getVal("limit")->asString(); quotaUsed = usage.asUint64(); quotaAllocated = limit.asUint64(); } - + CloudMan.setStorageUsername(kStorageGoogleDriveId, email); if (outerCallback) { @@ -197,7 +197,7 @@ void GoogleDriveStorage::createDirectoryInnerCallback(BoolCallback outerCallback } if (outerCallback) { - Common::JSONObject info = json->asObject(); + Common::JSONObject info = json->asObject(); (*outerCallback)(BoolResponse(nullptr, info.contains("id"))); delete outerCallback; } @@ -212,7 +212,7 @@ Networking::Request *GoogleDriveStorage::listDirectoryById(Common::String id, Li } Networking::Request *GoogleDriveStorage::upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) { - return addRequest(new GoogleDriveUploadRequest(this, path, contents, callback, errorCallback)); + return addRequest(new GoogleDriveUploadRequest(this, path, contents, callback, errorCallback)); } Networking::Request *GoogleDriveStorage::streamFileById(Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback) { @@ -221,7 +221,7 @@ Networking::Request *GoogleDriveStorage::streamFileById(Common::String id, Netwo Common::String header = "Authorization: Bearer " + _token; curl_slist *headersList = curl_slist_append(nullptr, header.c_str()); Networking::NetworkReadStream *stream = new Networking::NetworkReadStream(url.c_str(), headersList, ""); - (*callback)(Networking::NetworkReadStreamResponse(nullptr, stream)); + (*callback)(Networking::NetworkReadStreamResponse(nullptr, stream)); } delete callback; delete errorCallback; @@ -237,8 +237,8 @@ void GoogleDriveStorage::printInfo(StorageInfoResponse response) { Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) { if (!errorCallback) errorCallback = getErrorPrintingCallback(); - - Common::String url = "https://www.googleapis.com/drive/v3/files"; + + Common::String url = "https://www.googleapis.com/drive/v3/files"; Networking::JsonCallback innerCallback = new Common::CallbackBridge<GoogleDriveStorage, BoolResponse, Networking::JsonResponse>(this, &GoogleDriveStorage::createDirectoryInnerCallback, callback); Networking::CurlJsonRequest *request = new GoogleDriveTokenRefresher(this, innerCallback, errorCallback, url.c_str()); request->addHeader("Authorization: Bearer " + accessToken()); @@ -263,7 +263,7 @@ Networking::Request *GoogleDriveStorage::info(StorageInfoCallback callback, Netw Networking::JsonCallback innerCallback = new Common::CallbackBridge<GoogleDriveStorage, StorageInfoResponse, Networking::JsonResponse>(this, &GoogleDriveStorage::infoInnerCallback, callback); Networking::CurlJsonRequest *request = new GoogleDriveTokenRefresher(this, innerCallback, errorCallback, "https://www.googleapis.com/drive/v3/about?fields=storageQuota,user"); request->addHeader("Authorization: Bearer " + _token); - return addRequest(request); + return addRequest(request); } Common::String GoogleDriveStorage::savesDirectoryPath() { return "scummvm/saves/"; } diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h index 4c164dd91d..e60719c770 100644 --- a/backends/cloud/googledrive/googledrivestorage.h +++ b/backends/cloud/googledrive/googledrivestorage.h @@ -95,7 +95,7 @@ public: virtual Common::String savesDirectoryPath(); /** - * Load token and user id from configs and return GoogleDriveStorage for those. + * Load token and user id from configs and return GoogleDriveStorage for those. * @return pointer to the newly created GoogleDriveStorage or 0 if some problem occured. */ static GoogleDriveStorage *loadFromConfig(Common::String keyPrefix); diff --git a/backends/cloud/googledrive/googledrivetokenrefresher.cpp b/backends/cloud/googledrive/googledrivetokenrefresher.cpp index 9e26e62149..b876bc2995 100644 --- a/backends/cloud/googledrive/googledrivetokenrefresher.cpp +++ b/backends/cloud/googledrive/googledrivetokenrefresher.cpp @@ -52,7 +52,7 @@ void GoogleDriveTokenRefresher::tokenRefreshed(Storage::BoolResponse response) { } setHeaders(_headers); - //successfully received refreshed token, can restart the original request now + //successfully received refreshed token, can restart the original request now retry(0); } @@ -65,13 +65,13 @@ void GoogleDriveTokenRefresher::finishJson(Common::JSONValue *json) { Common::JSONObject result = json->asObject(); if (result.contains("error")) { - //new token needed => request token & then retry original request + //new token needed => request token & then retry original request if (_stream) { debug(9, "code %ld", _stream->httpResponseCode()); } Common::JSONObject error = result.getVal("error")->asObject(); - bool irrecoverable = true; + bool irrecoverable = true; uint32 code = -1; Common::String message; @@ -88,13 +88,13 @@ void GoogleDriveTokenRefresher::finishJson(Common::JSONValue *json) { if (code == 401 || message == "Invalid Credentials") irrecoverable = false; - if (irrecoverable) { + if (irrecoverable) { finishError(Networking::ErrorResponse(this, false, true, json->stringify(true), -1)); //TODO: httpCode delete json; return; } - pause(); + pause(); delete json; _parentStorage->getAccessToken(new Common::Callback<GoogleDriveTokenRefresher, Storage::BoolResponse>(this, &GoogleDriveTokenRefresher::tokenRefreshed)); return; @@ -104,7 +104,7 @@ void GoogleDriveTokenRefresher::finishJson(Common::JSONValue *json) { CurlJsonRequest::finishJson(json); } -void GoogleDriveTokenRefresher::setHeaders(Common::Array<Common::String> &headers) { +void GoogleDriveTokenRefresher::setHeaders(Common::Array<Common::String> &headers) { _headers = headers; curl_slist_free_all(_headersList); _headersList = 0; diff --git a/backends/cloud/googledrive/googledrivetokenrefresher.h b/backends/cloud/googledrive/googledrivetokenrefresher.h index 3bc5fbd784..6cb3e41849 100644 --- a/backends/cloud/googledrive/googledrivetokenrefresher.h +++ b/backends/cloud/googledrive/googledrivetokenrefresher.h @@ -33,12 +33,12 @@ class GoogleDriveStorage; class GoogleDriveTokenRefresher: public Networking::CurlJsonRequest { GoogleDriveStorage *_parentStorage; - Common::Array<Common::String> _headers; - + Common::Array<Common::String> _headers; + void tokenRefreshed(Storage::BoolResponse response); virtual void finishJson(Common::JSONValue *json); -public: +public: GoogleDriveTokenRefresher(GoogleDriveStorage *parent, Networking::JsonCallback callback, Networking::ErrorCallback ecb, const char *url); virtual ~GoogleDriveTokenRefresher(); diff --git a/backends/cloud/googledrive/googledriveuploadrequest.cpp b/backends/cloud/googledrive/googledriveuploadrequest.cpp index b63e989df8..4a7c30e9a5 100644 --- a/backends/cloud/googledrive/googledriveuploadrequest.cpp +++ b/backends/cloud/googledrive/googledriveuploadrequest.cpp @@ -164,7 +164,7 @@ void GoogleDriveUploadRequest::startUploadCallback(Networking::JsonResponse resp } } - Common::JSONValue *json = response.value; + Common::JSONValue *json = response.value; delete json; finishError(error); @@ -179,11 +179,11 @@ void GoogleDriveUploadRequest::startUploadErrorCallback(Networking::ErrorRespons void GoogleDriveUploadRequest::uploadNextPart() { const uint32 UPLOAD_PER_ONE_REQUEST = 10 * 1024 * 1024; Common::String url = _uploadUrl; - + Networking::JsonCallback callback = new Common::Callback<GoogleDriveUploadRequest, Networking::JsonResponse>(this, &GoogleDriveUploadRequest::partUploadedCallback); Networking::ErrorCallback failureCallback = new Common::Callback<GoogleDriveUploadRequest, Networking::ErrorResponse>(this, &GoogleDriveUploadRequest::partUploadedErrorCallback); Networking::CurlJsonRequest *request = new GoogleDriveTokenRefresher(_storage, callback, failureCallback, url.c_str()); - request->addHeader("Authorization: Bearer " + _storage->accessToken()); + request->addHeader("Authorization: Bearer " + _storage->accessToken()); request->usePut(); uint32 oldPos = _contentsStream->pos(); @@ -206,17 +206,17 @@ void GoogleDriveUploadRequest::uploadNextPart() { else request->addHeader(Common::String::format("Content-Range: bytes %u-%u/%u", oldPos, _contentsStream->pos() - 1, _contentsStream->size())); } - + _workingRequest = ConnMan.addRequest(request); } bool GoogleDriveUploadRequest::handleHttp308(const Networking::NetworkReadStream *stream) { //308 Resume Incomplete, with Range: X-Y header if (!stream) return false; - if (stream->httpResponseCode() != 308) return false; //seriously - + if (stream->httpResponseCode() != 308) return false; //seriously + Common::String headers = stream->responseHeaders(); - const char *cstr = headers.c_str(); + const char *cstr = headers.c_str(); for (int rangeTry = 0; rangeTry < 2; ++rangeTry) { const char *needle = (rangeTry==0 ? "Range: 0-" : "Range: bytes=0-"); uint32 needleLength = (rangeTry == 0 ? 9 : 15); @@ -239,12 +239,12 @@ bool GoogleDriveUploadRequest::handleHttp308(const Networking::NetworkReadStream return false; } -void GoogleDriveUploadRequest::partUploadedCallback(Networking::JsonResponse response) { +void GoogleDriveUploadRequest::partUploadedCallback(Networking::JsonResponse response) { _workingRequest = nullptr; if (_ignoreCallback) return; - + Networking::ErrorResponse error(this, false, true, "", -1); - Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; + Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; if (rq) { const Networking::NetworkReadStream *stream = rq->getNetworkReadStream(); if (stream) { @@ -301,16 +301,16 @@ void GoogleDriveUploadRequest::partUploadedCallback(Networking::JsonResponse res delete json; } -void GoogleDriveUploadRequest::partUploadedErrorCallback(Networking::ErrorResponse error) { +void GoogleDriveUploadRequest::partUploadedErrorCallback(Networking::ErrorResponse error) { _workingRequest = nullptr; if (_ignoreCallback) return; - + Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)error.request; if (rq) { const Networking::NetworkReadStream *stream = rq->getNetworkReadStream(); if (stream) { - long code = stream->httpResponseCode(); - if (code == 308 && handleHttp308(stream)) { + long code = stream->httpResponseCode(); + if (code == 308 && handleHttp308(stream)) { return; } } diff --git a/backends/cloud/googledrive/googledriveuploadrequest.h b/backends/cloud/googledrive/googledriveuploadrequest.h index 8cc40795e9..73acab5bbd 100644 --- a/backends/cloud/googledrive/googledriveuploadrequest.h +++ b/backends/cloud/googledrive/googledriveuploadrequest.h @@ -42,7 +42,7 @@ class GoogleDriveUploadRequest: public Networking::Request { Common::String _resolvedId, _parentId; Common::String _uploadUrl; uint64 _serverReceivedBytes; - + void start(); void resolveId(); void idResolvedCallback(Storage::UploadResponse response); diff --git a/backends/cloud/id/idcreatedirectoryrequest.cpp b/backends/cloud/id/idcreatedirectoryrequest.cpp index 7968a4b126..f64133c888 100644 --- a/backends/cloud/id/idcreatedirectoryrequest.cpp +++ b/backends/cloud/id/idcreatedirectoryrequest.cpp @@ -56,7 +56,7 @@ void IdCreateDirectoryRequest::start() { _workingRequest = _storage->createDirectory("ScummVM", callback, failureCallback); return; } - + resolveId(); } @@ -97,9 +97,9 @@ void IdCreateDirectoryRequest::idResolveFailedCallback(Networking::ErrorResponse _workingRequest = nullptr; if (_ignoreCallback) return; if (error.request) _date = error.request->date(); - + //not resolved => folder not exists - if (error.response.contains("no such file found in its parent directory")) { + if (error.response.contains("no such file found in its parent directory")) { //parent's id after the '\n' Common::String parentId = error.response; for (uint32 i = 0; i < parentId.size(); ++i) diff --git a/backends/cloud/id/iddownloadrequest.cpp b/backends/cloud/id/iddownloadrequest.cpp index 7166a1e026..edd2d26ece 100644 --- a/backends/cloud/id/iddownloadrequest.cpp +++ b/backends/cloud/id/iddownloadrequest.cpp @@ -48,7 +48,7 @@ void IdDownloadRequest::start() { //find file's id Storage::UploadCallback innerCallback = new Common::Callback<IdDownloadRequest, Storage::UploadResponse>(this, &IdDownloadRequest::idResolvedCallback); - Networking::ErrorCallback innerErrorCallback = new Common::Callback<IdDownloadRequest, Networking::ErrorResponse>(this, &IdDownloadRequest::idResolveFailedCallback); + Networking::ErrorCallback innerErrorCallback = new Common::Callback<IdDownloadRequest, Networking::ErrorResponse>(this, &IdDownloadRequest::idResolveFailedCallback); _workingRequest = _storage->resolveFileId(_requestedFile, innerCallback, innerErrorCallback); } diff --git a/backends/cloud/id/idlistdirectoryrequest.cpp b/backends/cloud/id/idlistdirectoryrequest.cpp index 012065dc77..6c70ed56a2 100644 --- a/backends/cloud/id/idlistdirectoryrequest.cpp +++ b/backends/cloud/id/idlistdirectoryrequest.cpp @@ -83,7 +83,7 @@ void IdListDirectoryRequest::listNextDirectory() { _directoriesQueue.pop_back(); Storage::FileArrayCallback callback = new Common::Callback<IdListDirectoryRequest, Storage::FileArrayResponse>(this, &IdListDirectoryRequest::listedDirectoryCallback); - Networking::ErrorCallback failureCallback = new Common::Callback<IdListDirectoryRequest, Networking::ErrorResponse>(this, &IdListDirectoryRequest::listedDirectoryErrorCallback); + Networking::ErrorCallback failureCallback = new Common::Callback<IdListDirectoryRequest, Networking::ErrorResponse>(this, &IdListDirectoryRequest::listedDirectoryErrorCallback); _workingRequest = _storage->listDirectoryById(_currentDirectory.id(), callback, failureCallback); } diff --git a/backends/cloud/id/idresolveidrequest.cpp b/backends/cloud/id/idresolveidrequest.cpp index fc61137088..abd64df1db 100644 --- a/backends/cloud/id/idresolveidrequest.cpp +++ b/backends/cloud/id/idresolveidrequest.cpp @@ -47,7 +47,7 @@ void IdResolveIdRequest::start() { _currentDirectory = ""; _currentDirectoryId = _storage->getRootDirectoryId(); _ignoreCallback = false; - + listNextDirectory(StorageFile(_currentDirectoryId, 0, 0, true)); } @@ -62,10 +62,10 @@ void IdResolveIdRequest::listNextDirectory(StorageFile fileToReturn) { _workingRequest = _storage->listDirectoryById(_currentDirectoryId, callback, failureCallback); } -void IdResolveIdRequest::listedDirectoryCallback(Storage::FileArrayResponse response) { +void IdResolveIdRequest::listedDirectoryCallback(Storage::FileArrayResponse response) { _workingRequest = nullptr; if (_ignoreCallback) return; - + Common::String currentLevelName = _requestedPath; ///debug("'%s'", currentLevelName.c_str()); if (_currentDirectory.size()) currentLevelName.erase(0, _currentDirectory.size()); diff --git a/backends/cloud/id/idresolveidrequest.h b/backends/cloud/id/idresolveidrequest.h index 94d4af5030..e735e96385 100644 --- a/backends/cloud/id/idresolveidrequest.h +++ b/backends/cloud/id/idresolveidrequest.h @@ -33,7 +33,7 @@ namespace Id { class IdStorage; class IdResolveIdRequest: public Networking::Request { - Common::String _requestedPath; + Common::String _requestedPath; IdStorage *_storage; Storage::UploadCallback _uploadCallback; Common::String _currentDirectory; diff --git a/backends/cloud/id/idstorage.h b/backends/cloud/id/idstorage.h index ccadc0e455..7e64fd4a37 100644 --- a/backends/cloud/id/idstorage.h +++ b/backends/cloud/id/idstorage.h @@ -50,7 +50,7 @@ protected: void printFile(UploadResponse response); ListDirectoryCallback getPrintFilesCallback(); - + public: virtual ~IdStorage(); diff --git a/backends/cloud/id/idstreamfilerequest.cpp b/backends/cloud/id/idstreamfilerequest.cpp index 08060b9e40..cc1ce2c54f 100644 --- a/backends/cloud/id/idstreamfilerequest.cpp +++ b/backends/cloud/id/idstreamfilerequest.cpp @@ -47,7 +47,7 @@ void IdStreamFileRequest::start() { //find file's id Storage::UploadCallback innerCallback = new Common::Callback<IdStreamFileRequest, Storage::UploadResponse>(this, &IdStreamFileRequest::idResolvedCallback); - Networking::ErrorCallback innerErrorCallback = new Common::Callback<IdStreamFileRequest, Networking::ErrorResponse>(this, &IdStreamFileRequest::idResolveFailedCallback); + Networking::ErrorCallback innerErrorCallback = new Common::Callback<IdStreamFileRequest, Networking::ErrorResponse>(this, &IdStreamFileRequest::idResolveFailedCallback); _workingRequest = _storage->resolveFileId(_requestedFile, innerCallback, innerErrorCallback); } diff --git a/backends/cloud/iso8601.cpp b/backends/cloud/iso8601.cpp index 1675c7ce54..b2483fd7f9 100644 --- a/backends/cloud/iso8601.cpp +++ b/backends/cloud/iso8601.cpp @@ -44,9 +44,9 @@ int find(const char *cstr, uint32 startPosition, char needle) { namespace Cloud { namespace ISO8601 { -uint32 convertToTimestamp(const Common::String &iso8601Date) { +uint32 convertToTimestamp(const Common::String &iso8601Date) { //2015-05-12T15:50:38Z - const char *cstr = iso8601Date.c_str(); + const char *cstr = iso8601Date.c_str(); int firstHyphen = find(cstr, 0, '-'); int secondHyphen = find(cstr, firstHyphen + 1, '-'); int tSeparator = find(cstr, secondHyphen + 1, 'T'); @@ -54,7 +54,7 @@ uint32 convertToTimestamp(const Common::String &iso8601Date) { int secondColon = find(cstr, firstColon + 1, ':'); int zSeparator = find(cstr, secondColon + 1, 'Z'); if (zSeparator == -1) zSeparator = find(cstr, secondColon + 1, '-'); // Box's RFC 3339 - //now note '+1' which means if there ever was '-1' result of find(), we still did a valid find() from 0th char + //now note '+1' which means if there ever was '-1' result of find(), we still did a valid find() from 0th char Common::String year = getSubstring(iso8601Date, 0, firstHyphen); Common::String month = getSubstring(iso8601Date, firstHyphen + 1, secondHyphen); diff --git a/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp b/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp index 617346529b..c934f2e684 100644 --- a/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp +++ b/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp @@ -45,7 +45,7 @@ OneDriveCreateDirectoryRequest::~OneDriveCreateDirectoryRequest() { void OneDriveCreateDirectoryRequest::start() { _ignoreCallback = true; - if (_workingRequest) _workingRequest->finish(); + if (_workingRequest) _workingRequest->finish(); _ignoreCallback = false; Common::String name = _path, parent = _path; @@ -54,7 +54,7 @@ void OneDriveCreateDirectoryRequest::start() { while (true) { parent.deleteLastChar(); if (name[i] == '/' || name[i] == '\\') { - name.erase(0, i + 1); + name.erase(0, i + 1); break; } if (i == 0) break; @@ -62,9 +62,9 @@ void OneDriveCreateDirectoryRequest::start() { } } - Common::String url = "https://api.onedrive.com/v1.0/drive/special/approot"; + Common::String url = "https://api.onedrive.com/v1.0/drive/special/approot"; if (parent != "") url += ":/" + ConnMan.urlEncode(parent) + ":"; - url += "/children"; + url += "/children"; Networking::JsonCallback innerCallback = new Common::Callback<OneDriveCreateDirectoryRequest, Networking::JsonResponse>(this, &OneDriveCreateDirectoryRequest::responseCallback); Networking::ErrorCallback errorCallback = new Common::Callback<OneDriveCreateDirectoryRequest, Networking::ErrorResponse>(this, &OneDriveCreateDirectoryRequest::errorCallback); Networking::CurlJsonRequest *request = new OneDriveTokenRefresher(_storage, innerCallback, errorCallback, url.c_str()); @@ -93,13 +93,13 @@ void OneDriveCreateDirectoryRequest::responseCallback(Networking::JsonResponse r Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; if (rq && rq->getNetworkReadStream()) error.httpResponseCode = rq->getNetworkReadStream()->httpResponseCode(); - + if (!json) { warning("NULL passed instead of JSON"); finishError(error); return; } - + Common::JSONObject info = json->asObject(); if (info.contains("id")) finishCreation(true); else { diff --git a/backends/cloud/onedrive/onedrivecreatedirectoryrequest.h b/backends/cloud/onedrive/onedrivecreatedirectoryrequest.h index 83c72c4e0a..acaca2bf00 100644 --- a/backends/cloud/onedrive/onedrivecreatedirectoryrequest.h +++ b/backends/cloud/onedrive/onedrivecreatedirectoryrequest.h @@ -39,7 +39,7 @@ class OneDriveCreateDirectoryRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _date; - + void start(); void responseCallback(Networking::JsonResponse response); void errorCallback(Networking::ErrorResponse error); diff --git a/backends/cloud/onedrive/onedrivelistdirectoryrequest.cpp b/backends/cloud/onedrive/onedrivelistdirectoryrequest.cpp index baccdf418e..d0b2714989 100644 --- a/backends/cloud/onedrive/onedrivelistdirectoryrequest.cpp +++ b/backends/cloud/onedrive/onedrivelistdirectoryrequest.cpp @@ -77,7 +77,7 @@ void OneDriveListDirectoryRequest::listNextDirectory() { makeRequest(url); } -void OneDriveListDirectoryRequest::makeRequest(Common::String url) { +void OneDriveListDirectoryRequest::makeRequest(Common::String url) { Networking::JsonCallback callback = new Common::Callback<OneDriveListDirectoryRequest, Networking::JsonResponse>(this, &OneDriveListDirectoryRequest::listedDirectoryCallback); Networking::ErrorCallback failureCallback = new Common::Callback<OneDriveListDirectoryRequest, Networking::ErrorResponse>(this, &OneDriveListDirectoryRequest::listedDirectoryErrorCallback); Networking::CurlJsonRequest *request = new OneDriveTokenRefresher(_storage, callback, failureCallback, url.c_str()); @@ -107,18 +107,18 @@ void OneDriveListDirectoryRequest::listedDirectoryCallback(Networking::JsonRespo return; } - Common::JSONObject object = json->asObject(); - + Common::JSONObject object = json->asObject(); + //TODO: check that ALL keys exist AND HAVE RIGHT TYPE to avoid segfaults Common::JSONArray items = object.getVal("value")->asArray(); for (uint32 i = 0; i < items.size(); ++i) { - Common::JSONObject item = items[i]->asObject(); + Common::JSONObject item = items[i]->asObject(); Common::String path = _currentDirectory + item.getVal("name")->asString(); - bool isDirectory = item.contains("folder"); + bool isDirectory = item.contains("folder"); uint32 size = item.getVal("size")->asIntegerNumber(); - uint32 timestamp = ISO8601::convertToTimestamp(item.getVal("lastModifiedDateTime")->asString()); + uint32 timestamp = ISO8601::convertToTimestamp(item.getVal("lastModifiedDateTime")->asString()); StorageFile file(path, size, timestamp, isDirectory); _files.push_back(file); diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index 39213e82ed..5fc10b748c 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -154,7 +154,7 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo delete outerCallback; return; } - + Common::JSONObject info = json->asObject(); Common::String uid, name, email; diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h index 60817e6084..4985f3fd67 100644 --- a/backends/cloud/onedrive/onedrivestorage.h +++ b/backends/cloud/onedrive/onedrivestorage.h @@ -47,7 +47,7 @@ class OneDriveStorage: public Cloud::Storage { void infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse json); void fileInfoCallback(Networking::NetworkReadStreamCallback outerCallback, Networking::JsonResponse response); -public: +public: /** This constructor uses OAuth code flow to get tokens. */ OneDriveStorage(Common::String code); virtual ~OneDriveStorage(); @@ -92,7 +92,7 @@ public: virtual Common::String savesDirectoryPath(); /** - * Load token and user id from configs and return OneDriveStorage for those. + * Load token and user id from configs and return OneDriveStorage for those. * @return pointer to the newly created OneDriveStorage or 0 if some problem occured. */ static OneDriveStorage *loadFromConfig(Common::String keyPrefix); diff --git a/backends/cloud/onedrive/onedrivetokenrefresher.cpp b/backends/cloud/onedrive/onedrivetokenrefresher.cpp index 9afea3d5bd..88b5154d8a 100644 --- a/backends/cloud/onedrive/onedrivetokenrefresher.cpp +++ b/backends/cloud/onedrive/onedrivetokenrefresher.cpp @@ -52,7 +52,7 @@ void OneDriveTokenRefresher::tokenRefreshed(Storage::BoolResponse response) { } setHeaders(_headers); - //successfully received refreshed token, can restart the original request now + //successfully received refreshed token, can restart the original request now retry(0); } @@ -65,7 +65,7 @@ void OneDriveTokenRefresher::finishJson(Common::JSONValue *json) { Common::JSONObject result = json->asObject(); if (result.contains("error")) { - //new token needed => request token & then retry original request + //new token needed => request token & then retry original request if (_stream) { debug(9, "code %ld", _stream->httpResponseCode()); } @@ -76,7 +76,7 @@ void OneDriveTokenRefresher::finishJson(Common::JSONValue *json) { Common::String code, message; if (error.contains("code")) { code = error.getVal("code")->asString(); - debug(9, "code = %s", code.c_str()); + debug(9, "code = %s", code.c_str()); } if (error.contains("message")) { @@ -92,13 +92,13 @@ void OneDriveTokenRefresher::finishJson(Common::JSONValue *json) { if (code == "unauthenticated") irrecoverable = false; - if (irrecoverable) { + if (irrecoverable) { finishError(Networking::ErrorResponse(this, false, true, json->stringify(true), -1)); //TODO: httpCode delete json; return; } - pause(); + pause(); delete json; _parentStorage->getAccessToken(new Common::Callback<OneDriveTokenRefresher, Storage::BoolResponse>(this, &OneDriveTokenRefresher::tokenRefreshed)); return; @@ -108,7 +108,7 @@ void OneDriveTokenRefresher::finishJson(Common::JSONValue *json) { CurlJsonRequest::finishJson(json); } -void OneDriveTokenRefresher::setHeaders(Common::Array<Common::String> &headers) { +void OneDriveTokenRefresher::setHeaders(Common::Array<Common::String> &headers) { _headers = headers; curl_slist_free_all(_headersList); _headersList = 0; diff --git a/backends/cloud/onedrive/onedrivetokenrefresher.h b/backends/cloud/onedrive/onedrivetokenrefresher.h index 4be1fa726b..77e34d4e03 100644 --- a/backends/cloud/onedrive/onedrivetokenrefresher.h +++ b/backends/cloud/onedrive/onedrivetokenrefresher.h @@ -33,12 +33,12 @@ class OneDriveStorage; class OneDriveTokenRefresher: public Networking::CurlJsonRequest { OneDriveStorage *_parentStorage; - Common::Array<Common::String> _headers; - + Common::Array<Common::String> _headers; + void tokenRefreshed(Storage::BoolResponse response); virtual void finishJson(Common::JSONValue *json); -public: +public: OneDriveTokenRefresher(OneDriveStorage *parent, Networking::JsonCallback callback, Networking::ErrorCallback ecb, const char *url); virtual ~OneDriveTokenRefresher(); diff --git a/backends/cloud/onedrive/onedriveuploadrequest.cpp b/backends/cloud/onedrive/onedriveuploadrequest.cpp index 569809d16b..2af4d06741 100644 --- a/backends/cloud/onedrive/onedriveuploadrequest.cpp +++ b/backends/cloud/onedrive/onedriveuploadrequest.cpp @@ -64,7 +64,7 @@ void OneDriveUploadRequest::start() { uploadNextPart(); } -void OneDriveUploadRequest::uploadNextPart() { +void OneDriveUploadRequest::uploadNextPart() { const uint32 UPLOAD_PER_ONE_REQUEST = 10 * 1024 * 1024; if (_uploadUrl == "" && (uint32)_contentsStream->size() > UPLOAD_PER_ONE_REQUEST) { @@ -79,16 +79,16 @@ void OneDriveUploadRequest::uploadNextPart() { } Common::String url; - if (_uploadUrl == "") { + if (_uploadUrl == "") { url = "https://api.onedrive.com/v1.0/drive/special/approot:/"+ConnMan.urlEncode(_savePath)+":/content"; - } else { + } else { url = _uploadUrl; } - + 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()); - request->addHeader("Authorization: Bearer " + _storage->accessToken()); + request->addHeader("Authorization: Bearer " + _storage->accessToken()); request->usePut(); uint32 oldPos = _contentsStream->pos(); @@ -106,18 +106,18 @@ void OneDriveUploadRequest::uploadNextPart() { delete request; return; } - + _workingRequest = ConnMan.addRequest(request); } -void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse response) { +void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse response) { _workingRequest = nullptr; if (_ignoreCallback) return; - + Networking::ErrorResponse error(this, false, true, "", -1); Networking::CurlJsonRequest *rq = (Networking::CurlJsonRequest *)response.request; if (rq && rq->getNetworkReadStream()) - error.httpResponseCode = rq->getNetworkReadStream()->httpResponseCode(); + error.httpResponseCode = rq->getNetworkReadStream()->httpResponseCode(); Common::JSONValue *json = response.value; if (json) { @@ -133,7 +133,7 @@ void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse respon } if (object.contains("id") && object.contains("name")) { - //finished + //finished Common::String path = _savePath; uint32 size = object.getVal("size")->asIntegerNumber(); uint32 timestamp = ISO8601::convertToTimestamp(object.getVal("lastModifiedDateTime")->asString()); @@ -145,7 +145,7 @@ void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse respon if (object.contains("uploadUrl")) _uploadUrl = object.getVal("uploadUrl")->asString(); else - warning("no uploadUrl found in OneDrive's response"); + warning("no uploadUrl found in OneDrive's response"); } } @@ -156,14 +156,14 @@ void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse respon uploadNextPart(); } } else { - warning("null, not json"); + warning("null, not json"); finishError(error); } delete json; } -void OneDriveUploadRequest::partUploadedErrorCallback(Networking::ErrorResponse error) { +void OneDriveUploadRequest::partUploadedErrorCallback(Networking::ErrorResponse error) { _workingRequest = nullptr; if (_ignoreCallback) return; finishError(error); diff --git a/backends/cloud/onedrive/onedriveuploadrequest.h b/backends/cloud/onedrive/onedriveuploadrequest.h index f613c415e1..4e2cb24a7f 100644 --- a/backends/cloud/onedrive/onedriveuploadrequest.h +++ b/backends/cloud/onedrive/onedriveuploadrequest.h @@ -40,7 +40,7 @@ class OneDriveUploadRequest: public Networking::Request { Request *_workingRequest; bool _ignoreCallback; Common::String _uploadUrl; - + void start(); void uploadNextPart(); void partUploadedCallback(Networking::JsonResponse response); diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 014e6a0ae6..957b7e655d 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -48,7 +48,7 @@ SavesSyncRequest::~SavesSyncRequest() { void SavesSyncRequest::start() { //cleanup _ignoreCallback = true; - if (_workingRequest) _workingRequest->finish(); + if (_workingRequest) _workingRequest->finish(); _currentDownloadingFile = StorageFile(); _currentUploadingFile = ""; _filesToDownload.clear(); @@ -78,7 +78,7 @@ void SavesSyncRequest::directoryListedCallback(Storage::ListDirectoryResponse re if (response.request) _date = response.request->date(); Common::HashMap<Common::String, bool> localFileNotAvailableInCloud; - for (Common::HashMap<Common::String, uint32>::iterator i = _localFilesTimestamps.begin(); i != _localFilesTimestamps.end(); ++i) { + for (Common::HashMap<Common::String, uint32>::iterator i = _localFilesTimestamps.begin(); i != _localFilesTimestamps.end(); ++i) { localFileNotAvailableInCloud[i->_key] = true; } @@ -96,7 +96,7 @@ void SavesSyncRequest::directoryListedCallback(Storage::ListDirectoryResponse re _filesToDownload.push_back(file); else { localFileNotAvailableInCloud[name] = false; - + if (_localFilesTimestamps[name] == file.timestamp()) continue; @@ -145,7 +145,7 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er //Dropbox-related error: if (object.contains("error_summary")) { Common::String summary = object.getVal("error_summary")->asString(); - if (summary.contains("not_found")) { + if (summary.contains("not_found")) { irrecoverable = false; } } @@ -223,7 +223,7 @@ void SavesSyncRequest::downloadNextFile() { _filesToDownload.pop_back(); 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()), new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::fileDownloadedCallback), @@ -258,7 +258,7 @@ void SavesSyncRequest::fileDownloadedErrorCallback(Networking::ErrorResponse err if (_ignoreCallback) return; //stop syncing if download failed - finishError(error); + finishError(error); } void SavesSyncRequest::uploadNextFile() { @@ -269,8 +269,8 @@ 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), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), @@ -288,7 +288,7 @@ void SavesSyncRequest::uploadNextFile() { void SavesSyncRequest::fileUploadedCallback(Storage::UploadResponse response) { _workingRequest = nullptr; if (_ignoreCallback) return; - + //update local timestamp for the uploaded file _localFilesTimestamps = DefaultSaveFileManager::loadTimestamps(); _localFilesTimestamps[_currentUploadingFile] = response.value.timestamp(); @@ -345,7 +345,7 @@ void SavesSyncRequest::finishError(Networking::ErrorResponse error) { debug("SavesSync::finishError"); //if we were downloading a file - remember the name //and make the Request close() it, so we can delete it - Common::String name = _currentDownloadingFile.name(); + Common::String name = _currentDownloadingFile.name(); if (_workingRequest) { _ignoreCallback = true; _workingRequest->finish(); diff --git a/backends/cloud/savessyncrequest.h b/backends/cloud/savessyncrequest.h index 304c44407c..e891e93969 100644 --- a/backends/cloud/savessyncrequest.h +++ b/backends/cloud/savessyncrequest.h @@ -57,7 +57,7 @@ class SavesSyncRequest: public Networking::Request, public GUI::CommandSender { void uploadNextFile(); virtual void finishError(Networking::ErrorResponse error); void finishSync(bool success); - + public: SavesSyncRequest(Storage *storage, Storage::BoolCallback callback, Networking::ErrorCallback ecb); virtual ~SavesSyncRequest(); diff --git a/backends/cloud/storage.cpp b/backends/cloud/storage.cpp index 100d72b5be..dc403dfb30 100644 --- a/backends/cloud/storage.cpp +++ b/backends/cloud/storage.cpp @@ -132,7 +132,7 @@ SavesSyncRequest *Storage::syncSaves(BoolCallback callback, Networking::ErrorCal if (!errorCallback) errorCallback = new Common::Callback<Storage, Networking::ErrorResponse>(this, &Storage::savesSyncDefaultErrorCallback); _savesSyncRequest = new SavesSyncRequest(this, callback, errorCallback); _syncRestartRequestsed = false; - _runningRequestsMutex.unlock(); + _runningRequestsMutex.unlock(); return (SavesSyncRequest *)addRequest(_savesSyncRequest); //who knows what that ConnMan could return in the future } diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h index eaa6e9cea0..8582a7575a 100644 --- a/backends/cloud/storage.h +++ b/backends/cloud/storage.h @@ -110,7 +110,7 @@ public: virtual void saveConfig(Common::String keyPrefix) = 0; /** - * Return unique storage name. + * Return unique storage name. * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const = 0; @@ -125,7 +125,7 @@ public: /** Returns ListDirectoryResponse with list of files. */ virtual Networking::Request *listDirectory(Common::String path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive = false) = 0; - + /** Returns StorageFile with info about uploaded file. */ virtual Networking::Request *upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) = 0; virtual Networking::Request *upload(Common::String remotePath, Common::String localPath, UploadCallback callback, Networking::ErrorCallback errorCallback); diff --git a/backends/cloud/storageinfo.h b/backends/cloud/storageinfo.h index e0666bc190..469f0402c0 100644 --- a/backends/cloud/storageinfo.h +++ b/backends/cloud/storageinfo.h @@ -32,7 +32,7 @@ namespace Cloud { * It's disk quota usage, owner name, and such. */ -class StorageInfo { +class StorageInfo { Common::String _uid, _name, _email; uint64 _usedBytes, _allocatedBytes; diff --git a/backends/networking/browser/openurl-android.cpp b/backends/networking/browser/openurl-android.cpp index 98fc803c0d..64e683238b 100644 --- a/backends/networking/browser/openurl-android.cpp +++ b/backends/networking/browser/openurl-android.cpp @@ -26,7 +26,7 @@ namespace Networking { namespace Browser { -bool openUrl(const Common::String &url) { +bool openUrl(const Common::String &url) { return JNI::openUrl(url.c_str()); } diff --git a/backends/networking/browser/openurl-posix.cpp b/backends/networking/browser/openurl-posix.cpp index 562c1ad53b..0e56119b4f 100644 --- a/backends/networking/browser/openurl-posix.cpp +++ b/backends/networking/browser/openurl-posix.cpp @@ -29,7 +29,7 @@ namespace Networking { namespace Browser { -namespace { +namespace { bool launch(const Common::String client, const Common::String &url) { // FIXME: system's input must be heavily escaped // well, when url's specified by user @@ -41,10 +41,10 @@ bool launch(const Common::String client, const Common::String &url) { bool openUrl(const Common::String &url) { // inspired by Qt's "qdesktopservices_x11.cpp" - + // try "standards" if (launch("xdg-open", url)) - return true; + return true; if (launch(getenv("DEFAULT_BROWSER"), url)) return true; if (launch(getenv("BROWSER"), url)) @@ -67,7 +67,7 @@ bool openUrl(const Common::String &url) { return true; if (launch("opera", url)) return true; - + warning("Networking::Browser::openUrl() (POSIX) failed to open URL"); return false; } diff --git a/backends/networking/curl/cloudicon.cpp b/backends/networking/curl/cloudicon.cpp index 554fc79a3f..5178522583 100644 --- a/backends/networking/curl/cloudicon.cpp +++ b/backends/networking/curl/cloudicon.cpp @@ -44,8 +44,8 @@ CloudIcon::~CloudIcon() {} bool CloudIcon::draw() { bool stop = false; initIcons(); - - if (CloudMan.isWorking() || _disabledFrames > 0) { + + if (CloudMan.isWorking() || _disabledFrames > 0) { if (g_system) { if (!_wasVisible) { g_system->clearOSD(); @@ -109,8 +109,8 @@ void CloudIcon::initIcons() { _iconsInited = true; } -void CloudIcon::loadIcon(Graphics::TransparentSurface &icon, byte *data, uint32 size) { - Image::PNGDecoder decoder; +void CloudIcon::loadIcon(Graphics::TransparentSurface &icon, byte *data, uint32 size) { + Image::PNGDecoder decoder; Common::MemoryReadStream stream(data, size); if (!decoder.loadStream(stream)) error("CloudIcon::loadIcon: error decoding PNG"); diff --git a/backends/networking/curl/connectionmanager.cpp b/backends/networking/curl/connectionmanager.cpp index 6affad7c1d..cb0e24645e 100644 --- a/backends/networking/curl/connectionmanager.cpp +++ b/backends/networking/curl/connectionmanager.cpp @@ -54,7 +54,7 @@ ConnectionManager::~ConnectionManager() { delete request; if (callback) (*callback)(request); } - _requests.clear(); + _requests.clear(); //cleanup curl_multi_cleanup(_multi); @@ -68,9 +68,9 @@ void ConnectionManager::registerEasyHandle(CURL *easy) const { } Request *ConnectionManager::addRequest(Request *request, RequestCallback callback) { - _addedRequestsMutex.lock(); + _addedRequestsMutex.lock(); _addedRequests.push_back(RequestWithCallback(request, callback)); - if (!_timerStarted) startTimer(); + if (!_timerStarted) startTimer(); _addedRequestsMutex.unlock(); return request; } @@ -130,7 +130,7 @@ void ConnectionManager::handle() { ++_frame; if (_frame % CLOUD_PERIOD == 0) interateRequests(); if (_frame % CURL_PERIOD == 0) processTransfers(); - + if (_icon.draw() && _requests.empty() && !hasAddedRequests()) stopTimer(); _handleMutex.unlock(); @@ -148,7 +148,7 @@ void ConnectionManager::interateRequests() { //call handle() of all running requests (so they can do their work) debug(9, "handling %d request(s)", _requests.size()); for (Common::Array<RequestWithCallback>::iterator i = _requests.begin(); i != _requests.end();) { - Request *request = i->request; + Request *request = i->request; if (request) { if (request->state() == PROCESSING) request->handle(); else if (request->state() == RETRY) request->handleRetry(); @@ -161,7 +161,7 @@ void ConnectionManager::interateRequests() { continue; } - ++i; + ++i; } } diff --git a/backends/networking/curl/connectionmanager.h b/backends/networking/curl/connectionmanager.h index b4ecbc9d73..5fd19d78b5 100644 --- a/backends/networking/curl/connectionmanager.h +++ b/backends/networking/curl/connectionmanager.h @@ -71,17 +71,17 @@ class ConnectionManager : public Common::Singleton<ConnectionManager> { struct RequestWithCallback { Request *request; RequestCallback onDeleteCallback; - + RequestWithCallback(Request *rq = nullptr, RequestCallback cb = nullptr): request(rq), onDeleteCallback(cb) {} }; - CURLM *_multi; + CURLM *_multi; bool _timerStarted; Common::Array<RequestWithCallback> _requests, _addedRequests; Common::Mutex _handleMutex, _addedRequestsMutex; CloudIcon _icon; uint32 _frame; - + void startTimer(int interval = TIMER_INTERVAL); void stopTimer(); void handle(); diff --git a/backends/networking/curl/curljsonrequest.h b/backends/networking/curl/curljsonrequest.h index 5a51065ca9..7858c89b80 100644 --- a/backends/networking/curl/curljsonrequest.h +++ b/backends/networking/curl/curljsonrequest.h @@ -50,7 +50,7 @@ public: CurlJsonRequest(JsonCallback cb, ErrorCallback ecb, Common::String url); virtual ~CurlJsonRequest(); - virtual void handle(); + virtual void handle(); virtual void restart(); }; diff --git a/backends/networking/curl/curlrequest.cpp b/backends/networking/curl/curlrequest.cpp index 05dfc4a362..4420b6f524 100644 --- a/backends/networking/curl/curlrequest.cpp +++ b/backends/networking/curl/curlrequest.cpp @@ -48,7 +48,7 @@ NetworkReadStream *CurlRequest::makeStream() { } void CurlRequest::handle() { - if (!_stream) _stream = makeStream(); + if (!_stream) _stream = makeStream(); if (_stream && _stream->eos()) { if (_stream->httpResponseCode() != 200) { @@ -68,7 +68,7 @@ void CurlRequest::restart() { //with no stream available next handle() will create another one } -Common::String CurlRequest::date() const { +Common::String CurlRequest::date() const { if (_stream) { Common::String headers = _stream->responseHeaders(); const char *cstr = headers.c_str(); @@ -114,7 +114,7 @@ void CurlRequest::addPostField(Common::String keyValuePair) { void CurlRequest::addFormField(Common::String name, Common::String value) { if (_bytesBuffer) warning("CurlRequest: added POST form fields would be ignored, because there is buffer present"); - + if (_formFields.contains(name)) warning("CurlRequest: form field '%s' already had a value", name.c_str()); diff --git a/backends/networking/curl/networkreadstream.cpp b/backends/networking/curl/networkreadstream.cpp index 9b34aaa3d5..d5f6288a26 100644 --- a/backends/networking/curl/networkreadstream.cpp +++ b/backends/networking/curl/networkreadstream.cpp @@ -29,13 +29,13 @@ namespace Networking { -static size_t curlDataCallback(char *d, size_t n, size_t l, void *p) { +static size_t curlDataCallback(char *d, size_t n, size_t l, void *p) { NetworkReadStream *stream = (NetworkReadStream *)p; if (stream) return stream->write(d, n*l); return 0; } -static size_t curlReadDataCallback(char *d, size_t n, size_t l, void *p) { +static size_t curlReadDataCallback(char *d, size_t n, size_t l, void *p) { NetworkReadStream *stream = (NetworkReadStream *)p; if (stream) return stream->fillWithSendingContents(d, n*l); return 0; @@ -79,7 +79,7 @@ void NetworkReadStream::init(const char *url, curl_slist *headersList, const byt curl_easy_setopt(_easy, CURLOPT_READFUNCTION, curlReadDataCallback); _sendingContentsBuffer = buffer; _sendingContentsSize = bufferSize; - } else if (usingPatch) { + } else if (usingPatch) { curl_easy_setopt(_easy, CURLOPT_CUSTOMREQUEST, "PATCH"); } else { if (post || bufferSize != 0) { @@ -110,7 +110,7 @@ void NetworkReadStream::init(const char *url, curl_slist *headersList, Common::H curl_easy_setopt(_easy, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(_easy, CURLOPT_XFERINFOFUNCTION, curlProgressCallback); curl_easy_setopt(_easy, CURLOPT_XFERINFODATA, this); - + // set POST multipart upload form fields/files struct curl_httppost *formpost = NULL; struct curl_httppost *lastptr = NULL; diff --git a/backends/networking/curl/networkreadstream.h b/backends/networking/curl/networkreadstream.h index a3221011ec..0138da183b 100644 --- a/backends/networking/curl/networkreadstream.h +++ b/backends/networking/curl/networkreadstream.h @@ -34,7 +34,7 @@ struct curl_slist; namespace Networking { -class NetworkReadStream: public Common::MemoryReadWriteStream { +class NetworkReadStream: public Common::MemoryReadWriteStream { CURL *_easy; bool _eos, _requestComplete; const byte *_sendingContentsBuffer; diff --git a/backends/networking/sdl_net/client.cpp b/backends/networking/sdl_net/client.cpp index 9d49480334..6cef5ffc93 100644 --- a/backends/networking/sdl_net/client.cpp +++ b/backends/networking/sdl_net/client.cpp @@ -111,7 +111,7 @@ bool Client::readBlockContent(Common::WriteStream *stream) { return _reader.readBlockContent(stream); } -void Client::setHandler(ClientHandler *handler) { +void Client::setHandler(ClientHandler *handler) { if (_handler) { if (_previousHandler) delete _previousHandler; _previousHandler = _handler; //can't just delete it, as setHandler() could've been called by handler itself diff --git a/backends/networking/sdl_net/handlers/downloadfilehandler.cpp b/backends/networking/sdl_net/handlers/downloadfilehandler.cpp index ff45517979..20577de951 100644 --- a/backends/networking/sdl_net/handlers/downloadfilehandler.cpp +++ b/backends/networking/sdl_net/handlers/downloadfilehandler.cpp @@ -67,9 +67,9 @@ void DownloadFileHandler::handle(Client &client) { GetClientHandler *handler = new GetClientHandler(stream); handler->setResponseCode(200); - handler->setHeader("Content-Type", "application/force-download"); + handler->setHeader("Content-Type", "application/force-download"); handler->setHeader("Content-Disposition", "attachment; filename=\"" + node->getDisplayName() + "\""); - handler->setHeader("Content-Transfer-Encoding", "binary"); + handler->setHeader("Content-Transfer-Encoding", "binary"); client.setHandler(handler); } diff --git a/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp b/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp index df4482166a..7d48458d5e 100644 --- a/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp @@ -53,7 +53,7 @@ void FilesAjaxPageHandler::handle(Client &client) { HandlerUtils::setFilesManagerErrorMessageHandler(client, _("The page is not available without the resources.")); return; } - + Common::String response = HandlerUtils::readEverythingFromStream(stream); Common::String path = client.queryParameter("path"); diff --git a/backends/networking/sdl_net/handlers/filesbasehandler.cpp b/backends/networking/sdl_net/handlers/filesbasehandler.cpp index d4b5c3b9e8..9546c5c845 100644 --- a/backends/networking/sdl_net/handlers/filesbasehandler.cpp +++ b/backends/networking/sdl_net/handlers/filesbasehandler.cpp @@ -45,7 +45,7 @@ Common::String FilesBaseHandler::parentPath(Common::String path) { } bool FilesBaseHandler::transformPath(Common::String &path, Common::String &prefixToRemove, Common::String &prefixToAdd, bool isDirectory) { - // <path> is not empty, but could lack the trailing slash + // <path> is not empty, but could lack the trailing slash if (isDirectory && path.lastChar() != '/' && path.lastChar() != '\\') path += '/'; if (path.hasPrefix("/root")) { diff --git a/backends/networking/sdl_net/handlers/filespagehandler.cpp b/backends/networking/sdl_net/handlers/filespagehandler.cpp index 2e934a31c6..d3fa459aeb 100644 --- a/backends/networking/sdl_net/handlers/filespagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filespagehandler.cpp @@ -66,7 +66,7 @@ Common::String getDisplayPath(Common::String s) { } void FilesPageHandler::handle(Client &client) { - Common::String response = + Common::String response = "<html>" \ "<head><title>ScummVM</title></head>" \ "<body>" \ @@ -97,7 +97,7 @@ void FilesPageHandler::handle(Client &client) { Common::String path = client.queryParameter("path"); Common::String content = ""; - + // show an error message if failed to list directory if (!listDirectory(path, content, itemTemplate)) { HandlerUtils::setFilesManagerErrorMessageHandler(client, _("ScummVM couldn't list the directory you specified.")); diff --git a/backends/networking/sdl_net/handlers/listajaxhandler.cpp b/backends/networking/sdl_net/handlers/listajaxhandler.cpp index 6319485e3d..2e2e138fd6 100644 --- a/backends/networking/sdl_net/handlers/listajaxhandler.cpp +++ b/backends/networking/sdl_net/handlers/listajaxhandler.cpp @@ -116,7 +116,7 @@ void ListAjaxHandler::addItem(Common::JSONArray &responseItemsList, ItemType ite default: icon = "unk.png"; } - Common::JSONObject item; + Common::JSONObject item; item.setVal("name", new Common::JSONValue(name)); item.setVal("path", new Common::JSONValue(path)); item.setVal("isDirectory", new Common::JSONValue(isDirectory)); diff --git a/backends/networking/sdl_net/handlers/uploadfilehandler.cpp b/backends/networking/sdl_net/handlers/uploadfilehandler.cpp index e2f6143474..5642e3f948 100644 --- a/backends/networking/sdl_net/handlers/uploadfilehandler.cpp +++ b/backends/networking/sdl_net/handlers/uploadfilehandler.cpp @@ -59,7 +59,7 @@ void UploadFileHandler::handle(Client &client) { HandlerUtils::setFilesManagerErrorMessageHandler(client, _("Can't upload into a file!")); return; } - + // if all OK, set special handler client.setHandler(new UploadFileClientHandler(path)); } diff --git a/backends/networking/sdl_net/handlers/uploadfilehandler.h b/backends/networking/sdl_net/handlers/uploadfilehandler.h index bba7fdfc02..4cd6115182 100644 --- a/backends/networking/sdl_net/handlers/uploadfilehandler.h +++ b/backends/networking/sdl_net/handlers/uploadfilehandler.h @@ -29,7 +29,7 @@ namespace Networking { class UploadFileHandler: public FilesBaseHandler { void handle(Client &client); - + public: UploadFileHandler(); virtual ~UploadFileHandler(); diff --git a/backends/networking/sdl_net/localwebserver.cpp b/backends/networking/sdl_net/localwebserver.cpp index baa2974aee..0ad1335f41 100644 --- a/backends/networking/sdl_net/localwebserver.cpp +++ b/backends/networking/sdl_net/localwebserver.cpp @@ -77,7 +77,7 @@ void LocalWebserver::startTimer(int interval) { } } -void LocalWebserver::stopTimer() { +void LocalWebserver::stopTimer() { Common::TimerManager *manager = g_system->getTimerManager(); manager->removeTimerProc(localWebserverTimer); _timerStarted = false; @@ -94,7 +94,7 @@ void LocalWebserver::start() { startTimer(); // Create a listening TCP socket - IPaddress ip; + IPaddress ip; if (SDLNet_ResolveHost(&ip, NULL, _serverPort) == -1) { error("SDLNet_ResolveHost: %s\n", SDLNet_GetError()); } @@ -113,9 +113,9 @@ void LocalWebserver::start() { // Create a socket set _set = SDLNet_AllocSocketSet(MAX_CONNECTIONS + 1); //one more for our server socket if (!_set) { - error("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError()); + error("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError()); } - + int numused = SDLNet_TCP_AddSocket(_set, _serverSocket); if (numused == -1) { error("SDLNet_AddSocket: %s\n", SDLNet_GetError()); @@ -193,7 +193,7 @@ void LocalWebserver::handle() { if (_clients == 0) ++_idlingFrames; else _idlingFrames = 0; - + if (_idlingFrames > FRAMES_PER_SECOND && _stopOnIdle) { _handleMutex.unlock(); stop(); @@ -203,7 +203,7 @@ void LocalWebserver::handle() { _handleMutex.unlock(); } -void LocalWebserver::handleClient(uint32 i) { +void LocalWebserver::handleClient(uint32 i) { switch (_client[i].state()) { case INVALID: return; case READING_HEADERS: _client[i].readHeaders(); break; @@ -214,7 +214,7 @@ void LocalWebserver::handleClient(uint32 i) { (*_pathHandlers[_client[i].path()])(_client[i]); else if (_defaultHandler) (*_defaultHandler)(_client[i]); //try default handler - + if (_client[i].state() == BEING_HANDLED || _client[i].state() == INVALID) break; //if no handler, answer with default BAD REQUEST @@ -287,18 +287,18 @@ void LocalWebserver::resolveAddress(void *ipAddress) { if (!i->ifa_addr) { continue; } - + Common::String addr; - + // IPv4 - if (i->ifa_addr->sa_family == AF_INET) { + if (i->ifa_addr->sa_family == AF_INET) { tmpAddrPtr = &((struct sockaddr_in *)i->ifa_addr)->sin_addr; char addressBuffer[INET_ADDRSTRLEN]; inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN); debug("%s IP Address %s", i->ifa_name, addressBuffer); addr = addressBuffer; } - + // IPv6 /* if (i->ifa_addr->sa_family == AF_INET6) { @@ -309,9 +309,9 @@ void LocalWebserver::resolveAddress(void *ipAddress) { addr = addressBuffer; } */ - + if (addr.empty()) continue; - + // ignored IPv4 addresses if (addr.equals("127.0.0.1") || addr.equals("0.0.0.0") || addr.equals("localhost")) continue; @@ -321,11 +321,11 @@ void LocalWebserver::resolveAddress(void *ipAddress) { if (addr.equals("::1")) continue; */ - + // use the address found _address = "http://" + addr + Common::String::format(":%u/", _serverPort); } - + if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct); #endif } diff --git a/backends/networking/sdl_net/localwebserver.h b/backends/networking/sdl_net/localwebserver.h index 9c677f36b0..d118509d62 100644 --- a/backends/networking/sdl_net/localwebserver.h +++ b/backends/networking/sdl_net/localwebserver.h @@ -82,7 +82,7 @@ class LocalWebserver : public Common::Singleton<LocalWebserver> { void handleClient(uint32 i); void acceptClient(); void resolveAddress(void *ipAddress); - + public: static const uint32 DEFAULT_SERVER_PORT = 12345; diff --git a/backends/networking/sdl_net/reader.cpp b/backends/networking/sdl_net/reader.cpp index 1e5693c22f..8edda70341 100644 --- a/backends/networking/sdl_net/reader.cpp +++ b/backends/networking/sdl_net/reader.cpp @@ -230,7 +230,7 @@ void Reader::parseQueryParameters() { value = ""; } else key += _query[i]; } else { - if (_query[i] == '&') { + if (_query[i] == '&') { if (_queryParameters.contains(key)) warning("Query parameter \"%s\" is already set!", key.c_str()); else _queryParameters[key] = LocalWebserver::urlDecode(value); readingKey = true; diff --git a/backends/networking/sdl_net/uploadfileclienthandler.cpp b/backends/networking/sdl_net/uploadfileclienthandler.cpp index 7e93573ca5..4ecd095c19 100644 --- a/backends/networking/sdl_net/uploadfileclienthandler.cpp +++ b/backends/networking/sdl_net/uploadfileclienthandler.cpp @@ -164,11 +164,11 @@ void UploadFileClientHandler::handleBlockContent(Client *client) { (client->queryParameter("ajax") == "true" ? "/filesAJAX?path=" : "/files?path=") + LocalWebserver::urlEncodeQueryParameterValue(client->queryParameter("path")) ); - _state = UFH_STOP; + _state = UFH_STOP; return; } } - + // no more content avaiable if (client->noMoreContent()) { // if no file field was found - failure diff --git a/backends/networking/wwwroot/.filesAJAX.html b/backends/networking/wwwroot/.filesAJAX.html index f736b74b7e..d45c73069d 100644 --- a/backends/networking/wwwroot/.filesAJAX.html +++ b/backends/networking/wwwroot/.filesAJAX.html @@ -166,7 +166,7 @@ if (!slashes) { currentPath += crumb; b.appendChild(makeBreadcrumb(crumb, currentPath+'/')); - slashes = true; + slashes = true; } } else { if (slashes) { diff --git a/backends/networking/wwwroot/ajax.js b/backends/networking/wwwroot/ajax.js index 12c50f1e72..c01d7e93fc 100644 --- a/backends/networking/wwwroot/ajax.js +++ b/backends/networking/wwwroot/ajax.js @@ -6,7 +6,7 @@ ajax.x = function () { return new XMLHttpRequest(); }; // "no one uses IE6" ajax.send = function (url, callback, errorCallback, method, data, async) { if (async === undefined) async = true; - + var x = ajax.x(); x.open(method, url, async); x.onreadystatechange = function () { diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 91d9a572c2..256ae09ef8 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -265,7 +265,7 @@ bool JNI::isConnectionLimited() { env->ExceptionClear(); limited = true; } - + return limited; } diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 7f96868934..8a7fba46f7 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -88,7 +88,7 @@ Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String & } Common::StringArray results; - for (SaveFileCache::const_iterator file = _saveFileCache.begin(), end = _saveFileCache.end(); file != end; ++file) { + for (SaveFileCache::const_iterator file = _saveFileCache.begin(), end = _saveFileCache.end(); file != end; ++file) { if (!locked.contains(file->_key) && file->_key.matchString(pattern, true)) { results.push_back(file->_key); } @@ -142,7 +142,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String return nullptr; for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) { - if (filename == *i) { + if (filename == *i) { return nullptr; //file is locked, no saving available } } @@ -238,7 +238,7 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) { checkPath(Common::FSNode(savePathName)); #ifdef USE_LIBCURL - Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing + Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing if (!files.empty()) updateSavefilesList(files); //makes this cache invalid else _lockedFiles = files; #endif @@ -287,7 +287,7 @@ Common::HashMap<Common::String, uint32> DefaultSaveFileManager::loadTimestamps() Common::Array<Common::String> files; g_system->getSavefileManager()->updateSavefilesList(files); - //start with listing all the files in saves/ directory and setting invalid timestamp to them + //start with listing all the files in saves/ directory and setting invalid timestamp to them Common::StringArray localFiles = g_system->getSavefileManager()->listSavefiles("*"); for (uint32 i = 0; i < localFiles.size(); ++i) timestamps[localFiles[i]] = INVALID_TIMESTAMP; @@ -329,7 +329,7 @@ Common::HashMap<Common::String, uint32> DefaultSaveFileManager::loadTimestamps() //parse timestamp uint32 timestamp = buffer.asUint64(); - if (buffer == "" || timestamp == 0) break; + if (buffer == "" || timestamp == 0) break; timestamps[filename] = timestamp; } diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 40d8aca219..fdd0c6f033 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -129,7 +129,7 @@ void ConfigManager::addDomain(const String &domainName, const ConfigManager::Dom _keymapperDomain = domain; #endif #ifdef USE_CLOUD - } else if (domainName == kCloudDomain) { + } else if (domainName == kCloudDomain) { _cloudDomain = domain; #endif } else if (domain.contains("gameid")) { diff --git a/common/file.cpp b/common/file.cpp index 5f3402e9ed..9797bcaa69 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -161,14 +161,14 @@ bool DumpFile::open(const String &filename, bool createPath) { Common::String subpath = filename; subpath.erase(i); if (subpath.empty()) continue; - AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(subpath); - if (node->exists()) continue; + AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(subpath); + if (node->exists()) continue; if (!node->create(true)) warning("DumpFile: unable to create directories from path prefix"); } } } - FSNode node(filename); + FSNode node(filename); return open(node); } diff --git a/common/json.cpp b/common/json.cpp index f95a44f8fe..d0e585ac3d 100644 --- a/common/json.cpp +++ b/common/json.cpp @@ -281,7 +281,7 @@ JSONValue *JSONValue::parse(const char **data) { return new JSONValue(str); } - // Is it a boolean? + // Is it a boolean? else if ((simplejson_wcsnlen(*data, 4) && scumm_strnicmp(*data, "true", 4) == 0) || (simplejson_wcsnlen(*data, 5) && scumm_strnicmp(*data, "false", 5) == 0)) { bool value = scumm_strnicmp(*data, "true", 4) == 0; (*data) += value ? 4 : 5; @@ -989,7 +989,7 @@ String JSONValue::stringifyImpl(size_t const indentDepth) const { case JSONType_IntegerNumber: { char str[80]; sprintf(str, "%lld", _integerValue); - ret_string = str; + ret_string = str; break; } diff --git a/common/memstream.h b/common/memstream.h index 76fa07cd24..94b8d1992d 100644 --- a/common/memstream.h +++ b/common/memstream.h @@ -230,7 +230,7 @@ private: _capacity = MAX(new_len + 32, _capacity * 2); _data = (byte *)malloc(_capacity); - if (old_data) { + if (old_data) { // Copy old data if (_readPos < _writePos) { memcpy(_data, old_data + _readPos, _writePos - _readPos); @@ -289,7 +289,7 @@ public: uint32 pos() const { return _pos - _length; } //'read' position in the stream uint32 size() const { return _size; } //that's also 'write' position in the stream, as it's append-only - byte *getData() { return _data; } + byte *getData() { return _data; } }; } // End of namespace Common diff --git a/common/str.h b/common/str.h index 1293d89508..d55ba072a9 100644 --- a/common/str.h +++ b/common/str.h @@ -236,12 +236,12 @@ public: void trim(); uint hash() const; - + /**@{ * Functions to replace some amount of chars with chars from some other string. * * @note The implementation follows that of the STL's std::string: - * http://www.cplusplus.com/reference/string/string/replace/ + * http://www.cplusplus.com/reference/string/string/replace/ * * @param pos Starting position for the replace in the original string. * @param count Number of chars to replace from the original string. @@ -250,7 +250,7 @@ public: * @param countOri Same as count * @param posDest Initial position to read str from. * @param countDest Number of chars to read from str. npos by default. - */ + */ // Replace 'count' bytes, starting from 'pos' with str. void replace(uint32 pos, uint32 count, const String &str); // The same as above, but accepts a C-like array of characters. @@ -267,7 +267,7 @@ public: // str[posDest, posDest + countDest) void replace(uint32 posOri, uint32 countOri, const char *str, uint32 posDest, uint32 countDest); - /**@}*/ + /**@}*/ /** * Print formatted data into a String object. Similar to sprintf, diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index da4f577e3c..4470180710 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -128,7 +128,7 @@ bool XMLParser::parserError(const String &errStr) { while (currentPosition--) errorMessage += (char)_stream->readByte(); } - + errorMessage += "\n\nParser error: "; errorMessage += errStr; errorMessage += "\n\n"; diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp index 3dde71e919..20651e76e6 100644 --- a/engines/testbed/misc.cpp +++ b/engines/testbed/misc.cpp @@ -174,7 +174,7 @@ TestExitStatus MiscTests::testOpenUrl() { Testsuite::logPrintf("Info! openUrl() says it couldn't open the url (probably not supported on this platform)\n"); return kTestFailed; } - + if (Testsuite::handleInteractiveInput("Was ScummVM able to open 'http://scummvm.org/' in your default browser?", "Yes", "No", kOptionRight)) { Testsuite::logDetailedPrintf("Error! openUrl() is not working!\n"); return kTestFailed; diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 72d05e2973..7595efcfbc 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -584,7 +584,7 @@ bool Debugger::cmdMd5(int argc, const char **argv) { length = atoi(argv[2]); paramOffset = 2; } - + // Assume that spaces are part of a single filename. Common::String filename = argv[1 + paramOffset]; for (int i = 2 + paramOffset; i < argc; i++) { @@ -624,7 +624,7 @@ bool Debugger::cmdMd5Mac(int argc, const char **argv) { length = atoi(argv[2]); paramOffset = 2; } - + // Assume that spaces are part of a single filename. Common::String filename = argv[1 + paramOffset]; for (int i = 2 + paramOffset; i < argc; i++) { diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp index df8783736e..a90783de9e 100644 --- a/gui/downloaddialog.cpp +++ b/gui/downloaddialog.cpp @@ -119,7 +119,7 @@ bool DownloadDialog::selectDirectories() { if (alert.runModal() != GUI::kMessageOK) return false; } - //first user should select remote directory to download + //first user should select remote directory to download if (_remoteBrowser->runModal() <= 0) return false; Cloud::StorageFile remoteDirectory = _remoteBrowser->getResult(); @@ -248,7 +248,7 @@ Common::String DownloadDialog::getSpeedLabelText() { return Common::String::format("Download speed: %s %s", speed.c_str(), _(speedUnits.c_str())); } -void DownloadDialog::refreshWidgets() { +void DownloadDialog::refreshWidgets() { _localDirectory = CloudMan.getDownloadLocalDirectory(); _remoteDirectoryLabel->setLabel(_("From: ") + CloudMan.getDownloadRemoteDirectory()); _localDirectoryLabel->setLabel(_("To: ") + _localDirectory); diff --git a/gui/downloaddialog.h b/gui/downloaddialog.h index cbeb78ab66..9080717195 100644 --- a/gui/downloaddialog.h +++ b/gui/downloaddialog.h @@ -46,7 +46,7 @@ class DownloadDialog : public Dialog { LauncherDialog *_launcher; BrowserDialog *_browser; RemoteBrowserDialog *_remoteBrowser; - + StaticTextWidget *_remoteDirectoryLabel; StaticTextWidget *_localDirectoryLabel; StaticTextWidget *_percentLabel; diff --git a/gui/options.cpp b/gui/options.cpp index abc97aa00e..ee7e584e1c 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1779,7 +1779,7 @@ void GlobalOptionsDialog::setupCloudTab() { int serverLabelPosition = -1; //no override #ifdef USE_LIBCURL _selectedStorageIndex = _storagePopUp->getSelectedTag(); - + if (_storagePopUpDesc) _storagePopUpDesc->setVisible(true); if (_storagePopUp) _storagePopUp->setVisible(true); @@ -1813,7 +1813,7 @@ void GlobalOptionsDialog::setupCloudTab() { if (!shown) serverLabelPosition = (_storageUsernameDesc ? _storageUsernameDesc->getRelY() : 0); #else _selectedStorageIndex = 0; - + if (_storagePopUpDesc) _storagePopUpDesc->setVisible(false); if (_storagePopUp) _storagePopUp->setVisible(false); if (_storageUsernameDesc) _storageUsernameDesc->setVisible(false); @@ -1822,7 +1822,7 @@ void GlobalOptionsDialog::setupCloudTab() { if (_storageUsedSpaceDesc) _storageUsedSpaceDesc->setVisible(false); if (_storageUsedSpace) _storageUsedSpace->setVisible(false); if (_storageLastSyncDesc) _storageLastSyncDesc->setVisible(false); - if (_storageLastSync) _storageLastSync->setVisible(false); + if (_storageLastSync) _storageLastSync->setVisible(false); if (_storageConnectButton) _storageConnectButton->setVisible(false); if (_storageRefreshButton) _storageRefreshButton->setVisible(false); if (_storageDownloadButton) _storageDownloadButton->setVisible(false); @@ -1851,7 +1851,7 @@ void GlobalOptionsDialog::setupCloudTab() { serverPortClearButtonY = y; bool serverIsRunning = LocalServer.isRunning(); - + if (serverLabelPosition < 0) serverLabelPosition = serverInfoY; if (_runServerButton) { _runServerButton->setVisible(true); @@ -1907,7 +1907,7 @@ void GlobalOptionsDialog::storageListDirectoryCallback(Cloud::Storage::ListDirec uint64 totalSize = 0; for (uint32 i = 0; i < files.size(); ++i) if (!files[i].isDirectory()) - totalSize += files[i].size(); + totalSize += files[i].size(); CloudMan.setStorageUsedSpace(CloudMan.getStorageIndex(), totalSize); _redrawCloudTab = true; } diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index d176d29b02..49f35edc16 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -67,7 +67,7 @@ RemoteBrowserDialog::~RemoteBrowserDialog() { } } -void RemoteBrowserDialog::open() { +void RemoteBrowserDialog::open() { Dialog::open(); listDirectory(Cloud::StorageFile()); } @@ -176,7 +176,7 @@ void RemoteBrowserDialog::goUp() { if (i == 0 || path[i] == '/' || path[i] == '\\') { path.erase(i); break; - } + } } listDirectory(Cloud::StorageFile(path, 0, 0, true)); diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index 222f637872..0a39f59cd6 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -57,7 +57,7 @@ SaveLoadCloudSyncProgressDialog::SaveLoadCloudSyncProgressDialog(bool canRunInBa _progressBar->setValue(progress); _progressBar->setEnabled(false); _percentLabel = new StaticTextWidget(this, "SaveLoadCloudSyncProgress.PercentText", Common::String::format("%u %%", progress)); - new ButtonWidget(this, "SaveLoadCloudSyncProgress.Cancel", "Cancel", 0, kCancelSyncCmd, Common::ASCII_ESCAPE); // Cancel dialog + new ButtonWidget(this, "SaveLoadCloudSyncProgress.Cancel", "Cancel", 0, kCancelSyncCmd, Common::ASCII_ESCAPE); // Cancel dialog ButtonWidget *backgroundButton = new ButtonWidget(this, "SaveLoadCloudSyncProgress.Background", "Run in background", 0, kBackgroundSyncCmd, Common::ASCII_RETURN); // Confirm dialog backgroundButton->setEnabled(canRunInBackground); draw(); @@ -69,7 +69,7 @@ SaveLoadCloudSyncProgressDialog::~SaveLoadCloudSyncProgressDialog() { void SaveLoadCloudSyncProgressDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch(cmd) { - case kSavesSyncProgressCmd: + case kSavesSyncProgressCmd: _percentLabel->setLabel(Common::String::format("%u%%", data)); _progressBar->setValue(data); _progressBar->draw(); @@ -280,7 +280,7 @@ void SaveLoadChooserDialog::reflowLayout() { void SaveLoadChooserDialog::updateSaveList() { #ifdef USE_LIBCURL - Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing + Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing g_system->getSavefileManager()->updateSavefilesList(files); #endif listSaves(); @@ -300,7 +300,7 @@ void SaveLoadChooserDialog::listSaves() { //make up some slot number int slotNum = 0; - for (uint32 j = (files[i].size() > 3 ? files[i].size() - 3 : 0); j < files[i].size(); ++j) { //3 last chars + for (uint32 j = (files[i].size() > 3 ? files[i].size() - 3 : 0); j < files[i].size(); ++j) { //3 last chars char c = files[i][j]; if (c < '0' || c > '9') continue; slotNum = slotNum * 10 + (c - '0'); diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h index 4e375bfc2e..fb2833355f 100644 --- a/gui/saveload-dialog.h +++ b/gui/saveload-dialog.h @@ -84,7 +84,7 @@ public: #ifdef USE_LIBCURL virtual void runSaveSync(bool hasSavepathOverride); #endif - + virtual void handleTickle(); #ifndef DISABLE_SAVELOADCHOOSER_GRID @@ -148,8 +148,8 @@ public: virtual void open(); virtual void close(); -protected: - virtual void updateSaveList(); +protected: + virtual void updateSaveList(); private: virtual int runIntern(); @@ -163,7 +163,7 @@ private: StaticTextWidget *_playtime; String _resultString; - + void updateSelection(bool redraw); }; diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp index 299da11812..b411a2e0dc 100644 --- a/gui/storagewizarddialog.cpp +++ b/gui/storagewizarddialog.cpp @@ -46,7 +46,7 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId): Common::String headline = Common::String::format(_("%s Storage Connection Wizard"), CloudMan.listStorages()[_storageId].c_str()); new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.Headline", headline); - + new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.NavigateLine", _s("Navigate to the following URL:")); new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.URLLine", getUrl()); @@ -114,7 +114,7 @@ void StorageWizardDialog::close() { void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { - case kCodeBoxCmd: { + case kCodeBoxCmd: { Common::String code, message; uint32 correctFields = 0; for (uint32 i = 0; i < CODE_FIELDS; ++i) { @@ -184,7 +184,7 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 } case kStorageCodePassedCmd: CloudMan.connectStorage(_storageId, LocalServer.indexPageHandler().code()); - _close = true; + _close = true; break; default: Dialog::handleCommand(sender, cmd, data); @@ -208,7 +208,7 @@ Common::String StorageWizardDialog::getUrl() const { case Cloud::kStorageGoogleDriveId: url += "gd"; break; case Cloud::kStorageBoxId: url += "bx"; break; } - + if (couldUseLocalServer()) url += "s"; return url; } @@ -222,7 +222,7 @@ bool StorageWizardDialog::couldUseLocalServer() const { } int StorageWizardDialog::decodeHashchar(char c) { - const char HASHCHARS[65] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?!"; + const char HASHCHARS[65] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?!"; for (uint32 i = 0; i < 64; ++i) if (c == HASHCHARS[i]) return i; @@ -232,10 +232,10 @@ int StorageWizardDialog::decodeHashchar(char c) { bool StorageWizardDialog::correctChecksum(Common::String s) { if (s.size() == 0) return false; //no last char int providedChecksum = decodeHashchar(s.lastChar()); - int calculatedChecksum = 0x2A; //any initial value would do, but it must equal to the one used on the page where these checksums were generated + int calculatedChecksum = 0x2A; //any initial value would do, but it must equal to the one used on the page where these checksums were generated for (uint32 i = 0; i < s.size()-1; ++i) { calculatedChecksum = calculatedChecksum ^ s[i]; - } + } return providedChecksum == (calculatedChecksum % 64); } diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx index 49ecea2e11..1311345621 100644 --- a/gui/themes/scummclassic/classic_gfx.stx +++ b/gui/themes/scummclassic/classic_gfx.stx @@ -192,7 +192,7 @@ orientation = 'top' /> </drawdata> - + <drawdata id = 'scrollbar_button_idle' cache = 'false' resolution = 'y<400'> <drawstep func = 'bevelsq' bevel = '2' @@ -226,7 +226,7 @@ orientation = 'top' /> </drawdata> - + <drawdata id = 'scrollbar_button_hover' cache = 'false' resolution = 'y<400'> <drawstep func = 'bevelsq' bevel = '2' @@ -314,7 +314,7 @@ bevel = '2' fill = 'none' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -325,7 +325,7 @@ padding = '0, 0, 7, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -336,20 +336,20 @@ padding = '0, 0, 7, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' horizontal_align = 'left' /> </drawdata> - + <drawdata id = 'popup_idle' cache = 'false' resolution = 'y<400'> <drawstep func = 'bevelsq' bevel = '2' fill = 'none' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -360,7 +360,7 @@ padding = '0, 0, 3, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -371,7 +371,7 @@ padding = '0, 0, 3, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' @@ -394,7 +394,7 @@ padding = '0, 0, 7, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -411,13 +411,13 @@ horizontal_align = 'left' /> </drawdata> - + <drawdata id = 'popup_disabled' cache = 'false' resolution = 'y<400'> <drawstep func = 'bevelsq' bevel = '2' fill = 'none' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -428,7 +428,7 @@ padding = '0, 0, 3, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -439,7 +439,7 @@ padding = '0, 0, 3, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' @@ -462,7 +462,7 @@ padding = '0, 0, 7, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -479,13 +479,13 @@ horizontal_align = 'left' /> </drawdata> - + <drawdata id = 'popup_hover' cache = 'false' resolution = 'y<400'> <drawstep func = 'bevelsq' bevel = '2' fill = 'none' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -496,7 +496,7 @@ padding = '0, 0, 3, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' fg_color = 'green' fill = 'foreground' @@ -507,7 +507,7 @@ padding = '0, 0, 3, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' @@ -552,7 +552,7 @@ fill = 'foreground' fg_color = 'green' /> - </drawdata> + </drawdata> <drawdata id = 'button_idle' cache = 'false'> <text font = 'text_button' diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index b9c2781fa5..2e37b00c91 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -610,7 +610,7 @@ <widget name = 'ProgressBar' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' height = 'Globals.Line.Height' textalign = 'center' @@ -657,7 +657,7 @@ /> <widget name = 'ReturnLine2' height = 'Globals.Line.Height' - /> + /> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '4' center = 'true'> <widget name = 'CodeBox1' width = '70' @@ -699,7 +699,7 @@ /> <space size = '6' /> </layout> - </layout> + </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> <widget name = 'CancelButton' type = 'Button' @@ -1244,7 +1244,7 @@ width = '496' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' width = '496' height = 'Globals.Line.Height' @@ -1255,7 +1255,7 @@ <widget name = 'Cancel' width = '150' height = 'Globals.Button.Height' - /> + /> <widget name = 'Background' width = '150' height = 'Globals.Button.Height' diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 7c062f7776..06ce6f6003 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -538,7 +538,7 @@ <dialog name = 'GlobalOptions_Cloud_Container' overlays = 'GlobalOptions_Cloud.Container'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> - <widget name = 'StoragePopupDesc' + <widget name = 'StoragePopupDesc' width = '80' height = 'Globals.Line.Height' textalign = 'right' @@ -625,7 +625,7 @@ <widget name = 'ProgressBar' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' height = 'Globals.Line.Height' textalign = 'center' @@ -709,7 +709,7 @@ height = 'Globals.Line.Height' /> <space size = '4' /> - </layout> + </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'CancelButton' type = 'Button' @@ -1247,7 +1247,7 @@ width = '240' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' width = '240' height = 'Globals.Line.Height' @@ -1258,7 +1258,7 @@ <widget name = 'Cancel' width = '100' height = 'Globals.Button.Height' - /> + /> <widget name = 'Background' width = '100' height = 'Globals.Button.Height' diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index 3a1ec5a5f0..31b194d174 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -181,7 +181,7 @@ <text_color id = 'color_button_hover' color = 'white' /> - + <text_color id = 'color_alternative_inverted' color = 'white' /> @@ -327,7 +327,7 @@ orientation = 'top' /> </drawdata> - + <drawdata id = 'scrollbar_button_hover' cache = 'false' resolution = 'y>399'> <drawstep func = 'roundedsq' radius = '10' @@ -350,7 +350,7 @@ orientation = 'top' /> </drawdata> - + <drawdata id = 'scrollbar_button_hover' cache = 'false' resolution = 'y<400'> <drawstep func = 'roundedsq' radius = '10' @@ -476,7 +476,7 @@ bg_color = 'xtrabrightred' shadow = '1' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -487,7 +487,7 @@ padding = '0, 0, 6, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -498,14 +498,14 @@ padding = '0, 0, 6, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' horizontal_align = 'left' /> </drawdata> - + <drawdata id = 'popup_idle' cache = 'false' resolution ='y<400'> <drawstep func = 'roundedsq' radius = '5' @@ -515,7 +515,7 @@ bg_color = 'xtrabrightred' shadow = '1' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -526,7 +526,7 @@ padding = '0, 0, 3, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -537,7 +537,7 @@ padding = '0, 0, 3, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' @@ -566,7 +566,7 @@ padding = '0, 0, 6, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -577,14 +577,14 @@ padding = '0, 0, 6, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal_hover' vertical_align = 'center' horizontal_align = 'left' /> </drawdata> - + <drawdata id = 'popup_disabled' cache = 'false' resolution = 'y<400'> <drawstep func = 'roundedsq' radius = '5' @@ -594,7 +594,7 @@ bg_color = 'xtrabrightred' shadow = '2' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -605,7 +605,7 @@ padding = '0, 0, 3, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -616,7 +616,7 @@ padding = '0, 0, 3, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' @@ -645,7 +645,7 @@ padding = '0, 0, 6, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -656,14 +656,14 @@ padding = '0, 0, 6, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal_hover' vertical_align = 'center' horizontal_align = 'left' /> </drawdata> - + <drawdata id = 'popup_hover' cache = 'false' resolution = 'y<400'> <drawstep func = 'roundedsq' radius = '5' @@ -673,7 +673,7 @@ bg_color = 'xtrabrightred' shadow = '1' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -684,7 +684,7 @@ padding = '0, 0, 3, 0' orientation = 'bottom' /> - + <drawstep func = 'triangle' bg_color = 'shadowcolor' fill = 'background' @@ -695,7 +695,7 @@ padding = '0, 0, 3, 0' orientation = 'top' /> - + <text font = 'text_default' text_color = 'color_normal' vertical_align = 'center' @@ -777,7 +777,7 @@ bevel = '1' bevel_color = 'black' /> - </drawdata> + </drawdata> <!-- Idle button --> <drawdata id = 'button_idle' cache = 'false'> diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index e0ea86893a..49876be18b 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -624,7 +624,7 @@ <widget name = 'ProgressBar' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' height = 'Globals.Line.Height' textalign = 'center' @@ -671,7 +671,7 @@ /> <widget name = 'ReturnLine2' height = 'Globals.Line.Height' - /> + /> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '4' center = 'true'> <widget name = 'CodeBox1' width = '70' @@ -713,7 +713,7 @@ /> <space size = '6' /> </layout> - </layout> + </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> <widget name = 'CancelButton' type = 'Button' @@ -1258,7 +1258,7 @@ width = '496' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' width = '496' height = 'Globals.Line.Height' @@ -1269,7 +1269,7 @@ <widget name = 'Cancel' width = '150' height = 'Globals.Button.Height' - /> + /> <widget name = 'Background' width = '150' height = 'Globals.Button.Height' diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index ceb43bb717..e10ce4a6c2 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -536,7 +536,7 @@ <dialog name = 'GlobalOptions_Cloud_Container' overlays = 'GlobalOptions_Cloud.Container'> <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> - <widget name = 'StoragePopupDesc' + <widget name = 'StoragePopupDesc' width = '80' height = 'Globals.Line.Height' textalign = 'right' @@ -623,7 +623,7 @@ <widget name = 'ProgressBar' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' height = 'Globals.Line.Height' textalign = 'center' @@ -707,7 +707,7 @@ height = 'Globals.Line.Height' /> <space size = '4' /> - </layout> + </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'CancelButton' type = 'Button' @@ -1245,7 +1245,7 @@ width = '240' height = 'Globals.Button.Height' /> - <space size = '1'/> + <space size = '1'/> <widget name = 'PercentText' width = '240' height = 'Globals.Line.Height' @@ -1256,7 +1256,7 @@ <widget name = 'Cancel' width = '100' height = 'Globals.Button.Height' - /> + /> <widget name = 'Background' width = '100' height = 'Globals.Button.Height' diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index 820c00f18a..9a7792730d 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -52,7 +52,7 @@ void ScrollContainerWidget::init() { void ScrollContainerWidget::recalc() { int scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0); _limitH = _h; - + //calculate virtual height const int spacing = g_gui.xmlEval()->getVar("Global.Font.Height", 16); //on the bottom int h = 0; @@ -120,7 +120,7 @@ void ScrollContainerWidget::reflowLayout() { //hide and move widgets, if needed sendCommand(_reflowCmd, 0); - + //recalculate height recalc(); |