diff options
35 files changed, 374 insertions, 360 deletions
diff --git a/backends/cloud/box/boxlistdirectorybyidrequest.cpp b/backends/cloud/box/boxlistdirectorybyidrequest.cpp index 537666bc52..5a4e06265f 100644 --- a/backends/cloud/box/boxlistdirectorybyidrequest.cpp +++ b/backends/cloud/box/boxlistdirectorybyidrequest.cpp @@ -37,7 +37,7 @@ namespace Box { BoxListDirectoryByIdRequest::BoxListDirectoryByIdRequest(BoxStorage *storage, Common::String id, Storage::ListDirectoryCallback cb, Networking::ErrorCallback ecb): Networking::Request(nullptr, ecb), _requestedId(id), _storage(storage), _listDirectoryCallback(cb), - _workingRequest(nullptr), _ignoreCallback(false) { + _workingRequest(nullptr), _ignoreCallback(false) { start(); } @@ -91,12 +91,12 @@ void BoxListDirectoryByIdRequest::responseCallback(Networking::JsonResponse resp //TODO: check that error is returned the right way /* if (responseObject.contains("error") || responseObject.contains("error_summary")) { - warning("Box returned error: %s", responseObject.getVal("error_summary")->asString().c_str()); - error.failed = true; - error.response = json->stringify(); - finishError(error); - delete json; - return; + warning("Box returned error: %s", responseObject.getVal("error_summary")->asString().c_str()); + error.failed = true; + error.response = json->stringify(); + finishError(error); + delete json; + return; } */ diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index 873e4fabc1..cd61e042da 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -57,9 +57,9 @@ BoxStorage::BoxStorage(Common::String accessToken, Common::String refreshToken): BoxStorage::BoxStorage(Common::String code) { getAccessToken( - new Common::Callback<BoxStorage, BoolResponse>(this, &BoxStorage::codeFlowComplete), - new Common::Callback<BoxStorage, Networking::ErrorResponse>(this, &BoxStorage::codeFlowFailed), - code + new Common::Callback<BoxStorage, BoolResponse>(this, &BoxStorage::codeFlowComplete), + new Common::Callback<BoxStorage, Networking::ErrorResponse>(this, &BoxStorage::codeFlowFailed), + code ); } @@ -89,9 +89,9 @@ void BoxStorage::getAccessToken(BoolCallback callback, Networking::ErrorCallback request->addPostField("client_secret=" + Common::String(SECRET)); /* if (Cloud::CloudManager::couldUseLocalServer()) { - request->addPostField("&redirect_uri=http%3A%2F%2Flocalhost%3A12345"); + request->addPostField("&redirect_uri=http%3A%2F%2Flocalhost%3A12345"); } else { - request->addPostField("&redirect_uri=https%3A%2F%2Fwww.scummvm.org/c/code"); + request->addPostField("&redirect_uri=https%3A%2F%2Fwww.scummvm.org/c/code"); } */ addRequest(request); diff --git a/backends/cloud/box/boxstorage.h b/backends/cloud/box/boxstorage.h index 89bc470a26..80a572cb31 100644 --- a/backends/cloud/box/boxstorage.h +++ b/backends/cloud/box/boxstorage.h @@ -68,7 +68,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/box/boxuploadrequest.cpp b/backends/cloud/box/boxuploadrequest.cpp index d1f68f1d24..1449aa97e3 100644 --- a/backends/cloud/box/boxuploadrequest.cpp +++ b/backends/cloud/box/boxuploadrequest.cpp @@ -174,11 +174,11 @@ void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) { //TODO: check errors /* if (object.contains("error")) { - warning("Box returned error: %s", json->stringify(true).c_str()); - delete json; - error.response = json->stringify(true); - finishError(error); - return; + warning("Box returned error: %s", json->stringify(true).c_str()); + delete json; + error.response = json->stringify(true); + finishError(error); + return; } */ } diff --git a/backends/cloud/cloudmanager.h b/backends/cloud/cloudmanager.h index 42aa7189b9..aad01338a9 100644 --- a/backends/cloud/cloudmanager.h +++ b/backends/cloud/cloudmanager.h @@ -88,8 +88,8 @@ public: * Replace active Storage. * @note this method automatically saves the changes with ConfMan. * - * @param storage Cloud::Storage to replace active storage with. - * @param index one of Cloud::StorageID enum values to indicate what storage type is replaced. + * @param storage Cloud::Storage to replace active storage with. + * @param index one of Cloud::StorageID enum values to indicate what storage type is replaced. */ void replaceStorage(Storage *storage, uint32 index); @@ -100,54 +100,54 @@ public: * Returns active Storage, which could be used to interact * with cloud storage. * - * @return active Cloud::Storage or null, if there is no active Storage. + * @return active Cloud::Storage or null, if there is no active Storage. */ Cloud::Storage *getCurrentStorage() const; /** * Return active Storage's index. * - * @return active Storage's index. + * @return active Storage's index. */ uint32 getStorageIndex() const; /** * Return Storages names as list. * - * @return a list of Storages names. + * @return a list of Storages names. */ Common::StringArray listStorages() const; /** * Changes the storage to the one with given index. * - * @param new Storage's index. + * @param new Storage's index. */ bool switchStorage(uint32 index); /** * Return username used by Storage. * - * @param Storage's index. - * @returns username or "" if index is invalid (no such Storage). + * @param Storage's index. + * @returns username or "" if index is invalid (no such Storage). */ Common::String getStorageUsername(uint32 index); /** * Return space used by Storage. * - * @param Storage's index. - * @returns used space in bytes or 0 if index is invalid (no such Storage). + * @param Storage's index. + * @returns used space in bytes or 0 if index is invalid (no such Storage). */ uint64 getStorageUsedSpace(uint32 index); /** * Return Storage's last sync date. * - * @param Storage's index. - * @returns last sync date or "" if index is invalid (no such Storage). - It also returns "" if there never was any sync - or if storage is syncing right now. + * @param Storage's index. + * @returns last sync date or "" if index is invalid (no such Storage). + It also returns "" if there never was any sync + or if storage is syncing right now. */ Common::String getStorageLastSync(uint32 index); @@ -155,8 +155,8 @@ public: * Set Storage's username. * Automatically saves changes to the config. * - * @param index Storage's index. - * @param name username to set + * @param index Storage's index. + * @param name username to set */ void setStorageUsername(uint32 index, Common::String name); @@ -164,8 +164,8 @@ public: * Set Storage's used space field. * Automatically saves changes to the config. * - * @param index Storage's index. - * @param used value to set + * @param index Storage's index. + * @param used value to set */ void setStorageUsedSpace(uint32 index, uint64 used); @@ -173,8 +173,8 @@ public: * Set Storage's last sync date. * Automatically saves changes to the config. * - * @param index Storage's index. - * @param date date to set + * @param index Storage's index. + * @param date date to set */ void setStorageLastSync(uint32 index, Common::String date); @@ -182,8 +182,8 @@ public: * Replace Storage which has given index with a * storage created with given code. * - * @param index Storage's index - * @param code OAuth2 code received from user + * @param index Storage's index + * @param code OAuth2 code received from user */ void connectStorage(uint32 index, Common::String code); @@ -264,7 +264,7 @@ public: }; /** Shortcut for accessing the connection manager. */ -#define CloudMan Cloud::CloudManager::instance() +#define CloudMan Cloud::CloudManager::instance() } // End of namespace Cloud diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index 0d308f4131..1f46c51558 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -64,7 +64,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/folderdownloadrequest.cpp b/backends/cloud/folderdownloadrequest.cpp index de60480423..ebcd167506 100644 --- a/backends/cloud/folderdownloadrequest.cpp +++ b/backends/cloud/folderdownloadrequest.cpp @@ -69,7 +69,7 @@ void FolderDownloadRequest::directoryListedCallback(Storage::ListDirectoryRespon _pendingFiles = response.value; // remove all directories - for (Common::Array<StorageFile>::iterator i = _pendingFiles.begin(); i != _pendingFiles.end(); ) + for (Common::Array<StorageFile>::iterator i = _pendingFiles.begin(); i != _pendingFiles.end();) if (i->isDirectory()) _pendingFiles.erase(i); else { diff --git a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp index 7b05d48784..3228dde100 100644 --- a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp +++ b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp @@ -35,7 +35,7 @@ namespace GoogleDrive { GoogleDriveListDirectoryByIdRequest::GoogleDriveListDirectoryByIdRequest(GoogleDriveStorage *storage, Common::String id, Storage::ListDirectoryCallback cb, Networking::ErrorCallback ecb): Networking::Request(nullptr, ecb), _requestedId(id), _storage(storage), _listDirectoryCallback(cb), - _workingRequest(nullptr), _ignoreCallback(false) { + _workingRequest(nullptr), _ignoreCallback(false) { start(); } diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp index fbb5e69881..3d87be36d5 100644 --- a/backends/cloud/googledrive/googledrivestorage.cpp +++ b/backends/cloud/googledrive/googledrivestorage.cpp @@ -57,9 +57,9 @@ GoogleDriveStorage::GoogleDriveStorage(Common::String accessToken, Common::Strin GoogleDriveStorage::GoogleDriveStorage(Common::String code) { getAccessToken( - new Common::Callback<GoogleDriveStorage, BoolResponse>(this, &GoogleDriveStorage::codeFlowComplete), - new Common::Callback<GoogleDriveStorage, Networking::ErrorResponse>(this, &GoogleDriveStorage::codeFlowFailed), - code + new Common::Callback<GoogleDriveStorage, BoolResponse>(this, &GoogleDriveStorage::codeFlowComplete), + new Common::Callback<GoogleDriveStorage, Networking::ErrorResponse>(this, &GoogleDriveStorage::codeFlowFailed), + code ); } diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h index e60719c770..6a834c44ca 100644 --- a/backends/cloud/googledrive/googledrivestorage.h +++ b/backends/cloud/googledrive/googledrivestorage.h @@ -70,7 +70,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/googledrive/googledriveuploadrequest.cpp b/backends/cloud/googledrive/googledriveuploadrequest.cpp index 4a7c30e9a5..90dc8af9d2 100644 --- a/backends/cloud/googledrive/googledriveuploadrequest.cpp +++ b/backends/cloud/googledrive/googledriveuploadrequest.cpp @@ -218,7 +218,7 @@ bool GoogleDriveUploadRequest::handleHttp308(const Networking::NetworkReadStream Common::String headers = stream->responseHeaders(); const char *cstr = headers.c_str(); for (int rangeTry = 0; rangeTry < 2; ++rangeTry) { - const char *needle = (rangeTry==0 ? "Range: 0-" : "Range: bytes=0-"); + const char *needle = (rangeTry == 0 ? "Range: 0-" : "Range: bytes=0-"); uint32 needleLength = (rangeTry == 0 ? 9 : 15); const char *position = strstr(cstr, needle); //if it lost the first part, I refuse to talk with it diff --git a/backends/cloud/id/idcreatedirectoryrequest.cpp b/backends/cloud/id/idcreatedirectoryrequest.cpp index f64133c888..11f65033ae 100644 --- a/backends/cloud/id/idcreatedirectoryrequest.cpp +++ b/backends/cloud/id/idcreatedirectoryrequest.cpp @@ -104,7 +104,7 @@ void IdCreateDirectoryRequest::idResolveFailedCallback(Networking::ErrorResponse Common::String parentId = error.response; for (uint32 i = 0; i < parentId.size(); ++i) if (parentId[i] == '\n') { - parentId.erase(0, i+1); + parentId.erase(0, i + 1); break; } diff --git a/backends/cloud/id/idresolveidrequest.cpp b/backends/cloud/id/idresolveidrequest.cpp index abd64df1db..38478fa149 100644 --- a/backends/cloud/id/idresolveidrequest.cpp +++ b/backends/cloud/id/idresolveidrequest.cpp @@ -101,7 +101,7 @@ void IdResolveIdRequest::listedDirectoryCallback(Storage::FileArrayResponse resp } if (!found) { - if (lastLevel) finishError(Networking::ErrorResponse(this, false, true, Common::String("no such file found in its parent directory\n")+_currentDirectoryId, 404)); + if (lastLevel) finishError(Networking::ErrorResponse(this, false, true, Common::String("no such file found in its parent directory\n") + _currentDirectoryId, 404)); else finishError(Networking::ErrorResponse(this, false, true, "subdirectory not found", 400)); } } diff --git a/backends/cloud/iso8601.h b/backends/cloud/iso8601.h index 6e11322cdb..cdd817bc07 100644 --- a/backends/cloud/iso8601.h +++ b/backends/cloud/iso8601.h @@ -28,8 +28,8 @@ namespace Cloud { namespace ISO8601 { - /** Returns timestamp corresponding to given ISO 8601 date */ - uint32 convertToTimestamp(const Common::String &iso8601Date); +/** Returns timestamp corresponding to given ISO 8601 date */ +uint32 convertToTimestamp(const Common::String &iso8601Date); } // End of namespace ISO8601 } // End of namespace Cloud diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index 7c1849e0da..a26dec37a4 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -58,9 +58,9 @@ OneDriveStorage::OneDriveStorage(Common::String accessToken, Common::String user OneDriveStorage::OneDriveStorage(Common::String code) { getAccessToken( - new Common::Callback<OneDriveStorage, BoolResponse>(this, &OneDriveStorage::codeFlowComplete), - new Common::Callback<OneDriveStorage, Networking::ErrorResponse>(this, &OneDriveStorage::codeFlowFailed), - code + new Common::Callback<OneDriveStorage, BoolResponse>(this, &OneDriveStorage::codeFlowComplete), + new Common::Callback<OneDriveStorage, Networking::ErrorResponse>(this, &OneDriveStorage::codeFlowFailed), + code ); } diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h index 4985f3fd67..59c61074e3 100644 --- a/backends/cloud/onedrive/onedrivestorage.h +++ b/backends/cloud/onedrive/onedrivestorage.h @@ -67,7 +67,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const; diff --git a/backends/cloud/onedrive/onedriveuploadrequest.cpp b/backends/cloud/onedrive/onedriveuploadrequest.cpp index 2af4d06741..a22dbf06a3 100644 --- a/backends/cloud/onedrive/onedriveuploadrequest.cpp +++ b/backends/cloud/onedrive/onedriveuploadrequest.cpp @@ -68,7 +68,7 @@ void OneDriveUploadRequest::uploadNextPart() { const uint32 UPLOAD_PER_ONE_REQUEST = 10 * 1024 * 1024; if (_uploadUrl == "" && (uint32)_contentsStream->size() > UPLOAD_PER_ONE_REQUEST) { - Common::String url = "https://api.onedrive.com/v1.0/drive/special/approot:/"+ConnMan.urlEncode(_savePath)+":/upload.createSession"; //folder must exist + Common::String url = "https://api.onedrive.com/v1.0/drive/special/approot:/" + ConnMan.urlEncode(_savePath) + ":/upload.createSession"; //folder must exist Networking::JsonCallback callback = new Common::Callback<OneDriveUploadRequest, Networking::JsonResponse>(this, &OneDriveUploadRequest::partUploadedCallback); Networking::ErrorCallback failureCallback = new Common::Callback<OneDriveUploadRequest, Networking::ErrorResponse>(this, &OneDriveUploadRequest::partUploadedErrorCallback); Networking::CurlJsonRequest *request = new OneDriveTokenRefresher(_storage, callback, failureCallback, url.c_str()); @@ -80,7 +80,7 @@ void OneDriveUploadRequest::uploadNextPart() { Common::String url; if (_uploadUrl == "") { - url = "https://api.onedrive.com/v1.0/drive/special/approot:/"+ConnMan.urlEncode(_savePath)+":/content"; + url = "https://api.onedrive.com/v1.0/drive/special/approot:/" + ConnMan.urlEncode(_savePath) + ":/content"; } else { url = _uploadUrl; } @@ -98,14 +98,13 @@ void OneDriveUploadRequest::uploadNextPart() { request->setBuffer(buffer, size); if (_uploadUrl != "") - request->addHeader(Common::String::format("Content-Range: bytes %u-%u/%u", oldPos, _contentsStream->pos()-1, _contentsStream->size())); - else - if (_contentsStream->size() == 0) { - warning("\"Sorry, OneDrive can't upload empty files\""); - finishUpload(StorageFile(_savePath, 0, 0, false)); - delete request; - return; - } + request->addHeader(Common::String::format("Content-Range: bytes %u-%u/%u", oldPos, _contentsStream->pos() - 1, _contentsStream->size())); + else if (_contentsStream->size() == 0) { + warning("\"Sorry, OneDrive can't upload empty files\""); + finishUpload(StorageFile(_savePath, 0, 0, false)); + delete request; + return; + } _workingRequest = ConnMan.addRequest(request); } diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 957b7e655d..e3b3aa2400 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -181,7 +181,8 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er Common::String dir = _storage->savesDirectoryPath(); if (dir.lastChar() == '/') dir.deleteLastChar(); debug(9, "creating %s", dir.c_str()); - _workingRequest = _storage->createDirectory(dir, + _workingRequest = _storage->createDirectory( + dir, new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::directoryCreatedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::directoryCreatedErrorCallback) ); @@ -225,7 +226,9 @@ void SavesSyncRequest::downloadNextFile() { sendCommand(GUI::kSavesSyncProgressCmd, (int)(getDownloadingProgress() * 100)); debug(9, "downloading %s (%d %%)", _currentDownloadingFile.name().c_str(), (int)(getProgress() * 100)); - _workingRequest = _storage->downloadById(_currentDownloadingFile.id(), DefaultSaveFileManager::concatWithSavesPath(_currentDownloadingFile.name()), + _workingRequest = _storage->downloadById( + _currentDownloadingFile.id(), + DefaultSaveFileManager::concatWithSavesPath(_currentDownloadingFile.name()), new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::fileDownloadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileDownloadedErrorCallback) ); @@ -270,14 +273,18 @@ void SavesSyncRequest::uploadNextFile() { _currentUploadingFile = _filesToUpload.back(); _filesToUpload.pop_back(); - debug(9, "uploading %s (%d %%)", _currentUploadingFile.c_str(), (int)(getProgress()*100)); + debug(9, "uploading %s (%d %%)", _currentUploadingFile.c_str(), (int)(getProgress() * 100)); if (_storage->uploadStreamSupported()) { - _workingRequest = _storage->upload(_storage->savesDirectoryPath() + _currentUploadingFile, g_system->getSavefileManager()->openRawFile(_currentUploadingFile), + _workingRequest = _storage->upload( + _storage->savesDirectoryPath() + _currentUploadingFile, + g_system->getSavefileManager()->openRawFile(_currentUploadingFile), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileUploadedErrorCallback) ); } else { - _workingRequest = _storage->upload(_storage->savesDirectoryPath() + _currentUploadingFile, DefaultSaveFileManager::concatWithSavesPath(_currentUploadingFile), + _workingRequest = _storage->upload( + _storage->savesDirectoryPath() + _currentUploadingFile, + DefaultSaveFileManager::concatWithSavesPath(_currentUploadingFile), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileUploadedErrorCallback) ); diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h index 8582a7575a..6a5765f13a 100644 --- a/backends/cloud/storage.h +++ b/backends/cloud/storage.h @@ -111,7 +111,7 @@ public: /** * Return unique storage name. - * @returns some unique storage name (for example, "Dropbox (user@example.com)") + * @returns some unique storage name (for example, "Dropbox (user@example.com)") */ virtual Common::String name() const = 0; @@ -155,7 +155,7 @@ public: * Calls the <errorCallback> if failed to get information. * * @note on success Storage should also call - * CloudMan.setStorageUsername(). + * CloudMan.setStorageUsername(). */ virtual Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) = 0; diff --git a/backends/cloud/storagefile.cpp b/backends/cloud/storagefile.cpp index 4bee92edce..c1107ea23d 100644 --- a/backends/cloud/storagefile.cpp +++ b/backends/cloud/storagefile.cpp @@ -42,7 +42,7 @@ StorageFile::StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir) { uint32 i = _name.size() - 1; while (true) { if (_name[i] == '/' || _name[i] == '\\') { - _name.erase(0, i+1); + _name.erase(0, i + 1); break; } if (i == 0) break; diff --git a/backends/networking/browser/openurl-posix.cpp b/backends/networking/browser/openurl-posix.cpp index 0e56119b4f..429a379fcf 100644 --- a/backends/networking/browser/openurl-posix.cpp +++ b/backends/networking/browser/openurl-posix.cpp @@ -31,45 +31,45 @@ namespace Browser { 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 - // it's OK now (urls are hardcoded somewhere in GUI) - Common::String cmd = client + " " + url; - return (system(cmd.c_str()) != -1); + // FIXME: system's input must be heavily escaped + // well, when url's specified by user + // it's OK now (urls are hardcoded somewhere in GUI) + Common::String cmd = client + " " + url; + return (system(cmd.c_str()) != -1); } } bool openUrl(const Common::String &url) { - // inspired by Qt's "qdesktopservices_x11.cpp" + // inspired by Qt's "qdesktopservices_x11.cpp" - // try "standards" - if (launch("xdg-open", url)) - return true; - if (launch(getenv("DEFAULT_BROWSER"), url)) - return true; - if (launch(getenv("BROWSER"), url)) - return true; + // try "standards" + if (launch("xdg-open", url)) + return true; + if (launch(getenv("DEFAULT_BROWSER"), url)) + return true; + if (launch(getenv("BROWSER"), url)) + return true; - // try desktop environment specific tools - if (launch("gnome-open", url)) // gnome - return true; - if (launch("kfmclient openURL", url)) // kde - return true; - if (launch("exo-open", url)) // xfce - return true; + // try desktop environment specific tools + if (launch("gnome-open", url)) // gnome + return true; + if (launch("kfmclient openURL", url)) // kde + return true; + if (launch("exo-open", url)) // xfce + return true; - // try browser names - if (launch("firefox", url)) - return true; - if (launch("mozilla", url)) - return true; - if (launch("netscape", url)) - return true; - if (launch("opera", url)) - return true; + // try browser names + if (launch("firefox", url)) + return true; + if (launch("mozilla", url)) + return true; + if (launch("netscape", url)) + return true; + if (launch("opera", url)) + return true; - warning("Networking::Browser::openUrl() (POSIX) failed to open URL"); - return false; + warning("Networking::Browser::openUrl() (POSIX) failed to open URL"); + return false; } } // End of namespace Browser diff --git a/backends/networking/curl/cloudicon.cpp b/backends/networking/curl/cloudicon.cpp index 5178522583..80e26169dd 100644 --- a/backends/networking/curl/cloudicon.cpp +++ b/backends/networking/curl/cloudicon.cpp @@ -82,7 +82,7 @@ bool CloudIcon::draw() { if (g_system) { Graphics::TransparentSurface *surface = &_icon; - makeAlphaIcon((_showingDisabled? _disabledIcon:_icon), _currentAlpha); + makeAlphaIcon((_showingDisabled ? _disabledIcon : _icon), _currentAlpha); if (_alphaIcon.getPixels()) surface = &_alphaIcon; if (surface && surface->getPixels()) { int x = g_system->getOverlayWidth() - surface->w - 10, y = 10; diff --git a/backends/networking/curl/cloudicon_data.h b/backends/networking/curl/cloudicon_data.h index a924dc84d2..21d88182a3 100644 --- a/backends/networking/curl/cloudicon_data.h +++ b/backends/networking/curl/cloudicon_data.h @@ -25,87 +25,87 @@ // The tool is from https://github.com/pinard/Recode byte cloudicon_data[] = { -137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, - 82, 0, 0, 0, 32, 0, 0, 0, 32, 8, 6, 0, 0, 0, 115, -122, 122, 244, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8, -124, 8, 100, 136, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, - 18, 0, 0, 11, 18, 1, 210, 221, 126, 252, 0, 0, 0, 22, 116, - 69, 88, 116, 67, 114, 101, 97, 116, 105, 111, 110, 32, 84, 105, 109, -101, 0, 48, 54, 47, 48, 51, 47, 49, 54, 159, 192, 233, 192, 0, - 0, 0, 28, 116, 69, 88, 116, 83, 111, 102, 116, 119, 97, 114, 101, - 0, 65, 100, 111, 98, 101, 32, 70, 105, 114, 101, 119, 111, 114, 107, -115, 32, 67, 83, 54, 232, 188, 178, 140, 0, 0, 4, 50, 73, 68, - 65, 84, 88, 133, 197, 151, 109, 104, 150, 101, 20, 199, 127, 247, 227, -179, 105, 51, 23, 65, 181, 150, 224, 154, 214, 132, 194, 249, 33, 165, - 22, 189, 231, 194, 210, 250, 16, 171, 180, 55, 42, 152, 68, 65, 100, - 52, 233, 5, 146, 144, 144, 26, 249, 169, 62, 164, 80, 89, 152, 25, - 18, 226, 42, 49, 87, 88, 180, 94, 96, 96, 246, 234, 180, 70, 50, - 66, 214, 55, 247, 22, 133, 247, 255, 244, 225, 58, 247, 158, 107, 143, -219, 243, 60, 186, 192, 3, 135, 251, 220, 215, 117, 223, 231, 127, 238, -235, 252, 239, 235, 58, 39, 105, 250, 206, 56, 147, 146, 55, 85, 252, -108, 13, 112, 59, 176, 12, 88, 2, 204, 7, 230, 248, 220, 48, 208, - 15, 244, 2, 221, 64, 23, 48, 86, 137, 211, 228, 146, 158, 178, 43, - 80, 7, 172, 3, 218, 129, 179, 43, 241, 9, 140, 0, 155, 129, 87, -128, 193, 146, 15, 47, 248, 178, 100, 0, 237, 64, 39, 112, 14, 96, -174, 20, 217, 153, 228, 162, 0, 50, 25, 2, 58, 128, 45, 83, 1, -228, 53, 121, 10, 170, 129, 183, 128, 213, 126, 47, 215, 49, 224, 39, -224, 19, 160, 7, 56, 2, 204, 0, 154, 128, 27, 128, 229, 110, 215, -120, 64, 181, 132, 149, 184, 30, 120, 4, 248, 183, 24, 40, 185, 248, -243, 147, 86, 160, 154, 144, 195, 91, 252, 43, 5, 140, 2, 31, 2, - 27, 129, 195, 83, 125, 141, 75, 19, 240, 2, 129, 47, 179, 61, 144, - 4, 216, 7, 172, 44, 14, 34, 105, 232, 62, 41, 128, 109, 192, 189, - 14, 126, 2, 24, 0, 30, 3, 246, 150, 1, 46, 150, 54, 15, 184, - 1, 200, 251, 216, 123, 192, 253, 19, 2, 152, 183, 119, 66, 0, 237, -192, 27, 110, 159, 0, 250, 128, 187, 128, 67, 167, 8, 158, 201, 98, -224, 3, 160, 209, 131, 72, 128, 53, 68, 156, 200, 153, 192, 181, 206, - 68, 167, 219, 50, 49, 96, 226, 78, 19, 135, 162, 103, 138, 117, 169, -137, 46, 19, 163, 38, 82, 19, 63, 152, 120, 220, 196, 12, 159, 63, -104, 98, 149, 137, 99, 238, 211, 28, 163, 46, 243, 145, 147, 192, 117, -157, 68, 173, 219, 195, 18, 143, 74, 28, 137, 230, 139, 181, 77, 162, - 71, 98, 165, 68, 141, 68, 78, 98, 145, 196, 107, 18, 59, 252, 30, -137, 3, 18, 207, 72, 140, 249, 125, 173, 99, 33, 65, 114, 209, 110, -131, 192, 218, 65, 2, 105, 4, 108, 245, 165, 74, 125, 165, 206, 5, -214, 2, 151, 3, 7, 128, 119, 128, 95, 253, 189, 169, 228, 105, 224, - 85, 183, 171, 128, 29, 192, 29, 4, 82, 142, 18, 246, 151, 177, 164, -126, 151, 1, 220, 3, 188, 79, 32, 222, 40, 97, 167, 235, 243, 151, -207, 2, 190, 5, 154, 35, 231, 223, 0, 45, 101, 242, 127, 12, 152, - 75, 97, 191, 88, 12, 124, 237, 254, 18, 96, 21, 176, 35, 227, 192, - 50, 207, 15, 38, 126, 49, 113, 56, 202, 243, 221, 38, 154, 139, 114, -223, 82, 130, 23, 153, 214, 155, 88, 20, 221, 255, 104, 226, 104, 116, -223, 106, 42, 144, 112, 169, 137, 196, 131, 248, 56, 10, 166, 222, 196, -141, 21, 128, 77, 165, 223, 155, 120, 42, 34, 246, 158, 200, 247, 18, - 19, 228, 21, 178, 60, 223, 151, 41, 1, 190, 112, 251, 60, 224, 171, -104, 238, 116, 36, 33, 240, 224, 32, 240, 25, 176, 31, 120, 194, 199, - 27, 161, 112, 26, 102, 167, 154, 1, 127, 186, 253, 98, 9, 240, 81, - 2, 97, 43, 149, 231, 61, 128, 129, 104, 108, 78, 28, 64, 44, 25, -105, 218, 74, 56, 156, 13, 252, 76, 248, 43, 42, 145, 140, 176, 249, -226, 137, 188, 133, 20, 12, 123, 68, 9, 225, 171, 127, 7, 46, 40, -227, 180, 82, 112, 128, 153, 126, 189, 148, 194, 105, 57, 12, 5, 18, -246, 71, 68, 185, 214, 237, 191, 166, 65, 190, 98, 237, 243, 235, 205, -209, 88, 127, 188, 19, 246, 250, 53, 39, 177, 194, 237, 157, 37, 118, -193, 83, 213, 183, 37, 102, 73, 92, 39, 145, 196, 152, 57, 75, 193, - 82, 246, 249, 21, 75, 89, 104, 41, 205, 150, 178, 222, 82, 250, 163, -241, 211, 213, 253, 150, 178, 201, 82, 174, 180, 148, 185, 150, 146, 248, -120, 183, 165, 133, 20, 116, 153, 24, 113, 123, 150, 137, 103, 77, 28, - 55, 113, 141, 137, 173, 38, 134, 60, 61, 167, 178, 236, 3, 38, 54, -152, 184, 213, 255, 253, 39, 221, 55, 142, 213, 101, 42, 252, 5, 99, -132, 202, 101, 45, 97, 175, 94, 14, 172, 0, 118, 1, 15, 185, 78, - 71, 86, 19, 138, 217, 196, 117, 179, 99, 146, 204, 126, 125, 188, 30, -168, 35, 236, 255, 181, 132, 3, 233, 15, 224, 54, 202, 87, 64, 229, -164, 5, 216, 9, 92, 232, 224, 67, 192, 66, 188, 88, 205, 69, 185, - 26, 180, 148, 14, 207, 81, 206, 82, 230, 89, 202, 110, 75, 185, 108, - 26, 249, 191, 202, 82, 222, 181, 148, 243, 163, 220, 119, 56, 22, 150, - 78, 172, 7, 144, 216, 34, 177, 205, 237, 188, 196, 2, 137, 61, 18, - 15, 158, 6, 243, 31, 144, 216, 37, 209, 224, 190, 18, 137, 237, 142, - 49, 254, 92, 50, 115, 211, 164, 69, 233, 71, 64, 43, 140, 23, 165, -127, 19, 26, 142, 231, 8, 117, 192, 84, 82, 69, 56, 118, 215, 3, - 55, 17, 54, 160, 172, 40, 253, 148, 80, 168, 78, 44, 74, 171, 59, - 39, 237, 11, 170, 129, 55, 129, 251, 40, 108, 205, 2, 254, 1, 126, -243, 96, 122, 129, 163, 62, 223, 0, 92, 237, 160, 141, 17, 112, 38, -219, 129, 135, 139, 193, 1, 146, 170, 151, 43, 106, 76, 106, 139, 198, -229, 192, 73, 20, 96, 12, 152, 177, 253, 56, 101, 26, 147, 36, 191, -177, 226, 214, 108, 13, 133, 214, 172, 220, 75, 35, 14, 90, 190, 53, -203, 189, 84, 113, 119, 156, 53, 167, 173, 192, 21, 252, 95, 205, 105, -178, 225, 204, 182, 231, 255, 1, 200, 91, 112, 221, 160, 249, 68, 42, - 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130 + 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, + 82, 0, 0, 0, 32, 0, 0, 0, 32, 8, 6, 0, 0, 0, 115, + 122, 122, 244, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8, + 124, 8, 100, 136, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, + 18, 0, 0, 11, 18, 1, 210, 221, 126, 252, 0, 0, 0, 22, 116, + 69, 88, 116, 67, 114, 101, 97, 116, 105, 111, 110, 32, 84, 105, 109, + 101, 0, 48, 54, 47, 48, 51, 47, 49, 54, 159, 192, 233, 192, 0, + 0, 0, 28, 116, 69, 88, 116, 83, 111, 102, 116, 119, 97, 114, 101, + 0, 65, 100, 111, 98, 101, 32, 70, 105, 114, 101, 119, 111, 114, 107, + 115, 32, 67, 83, 54, 232, 188, 178, 140, 0, 0, 4, 50, 73, 68, + 65, 84, 88, 133, 197, 151, 109, 104, 150, 101, 20, 199, 127, 247, 227, + 179, 105, 51, 23, 65, 181, 150, 224, 154, 214, 132, 194, 249, 33, 165, + 22, 189, 231, 194, 210, 250, 16, 171, 180, 55, 42, 152, 68, 65, 100, + 52, 233, 5, 146, 144, 144, 26, 249, 169, 62, 164, 80, 89, 152, 25, + 18, 226, 42, 49, 87, 88, 180, 94, 96, 96, 246, 234, 180, 70, 50, + 66, 214, 55, 247, 22, 133, 247, 255, 244, 225, 58, 247, 158, 107, 143, + 219, 243, 60, 186, 192, 3, 135, 251, 220, 215, 117, 223, 231, 127, 238, + 235, 252, 239, 235, 58, 39, 105, 250, 206, 56, 147, 146, 55, 85, 252, + 108, 13, 112, 59, 176, 12, 88, 2, 204, 7, 230, 248, 220, 48, 208, + 15, 244, 2, 221, 64, 23, 48, 86, 137, 211, 228, 146, 158, 178, 43, + 80, 7, 172, 3, 218, 129, 179, 43, 241, 9, 140, 0, 155, 129, 87, + 128, 193, 146, 15, 47, 248, 178, 100, 0, 237, 64, 39, 112, 14, 96, + 174, 20, 217, 153, 228, 162, 0, 50, 25, 2, 58, 128, 45, 83, 1, + 228, 53, 121, 10, 170, 129, 183, 128, 213, 126, 47, 215, 49, 224, 39, + 224, 19, 160, 7, 56, 2, 204, 0, 154, 128, 27, 128, 229, 110, 215, + 120, 64, 181, 132, 149, 184, 30, 120, 4, 248, 183, 24, 40, 185, 248, + 243, 147, 86, 160, 154, 144, 195, 91, 252, 43, 5, 140, 2, 31, 2, + 27, 129, 195, 83, 125, 141, 75, 19, 240, 2, 129, 47, 179, 61, 144, + 4, 216, 7, 172, 44, 14, 34, 105, 232, 62, 41, 128, 109, 192, 189, + 14, 126, 2, 24, 0, 30, 3, 246, 150, 1, 46, 150, 54, 15, 184, + 1, 200, 251, 216, 123, 192, 253, 19, 2, 152, 183, 119, 66, 0, 237, + 192, 27, 110, 159, 0, 250, 128, 187, 128, 67, 167, 8, 158, 201, 98, + 224, 3, 160, 209, 131, 72, 128, 53, 68, 156, 200, 153, 192, 181, 206, + 68, 167, 219, 50, 49, 96, 226, 78, 19, 135, 162, 103, 138, 117, 169, + 137, 46, 19, 163, 38, 82, 19, 63, 152, 120, 220, 196, 12, 159, 63, + 104, 98, 149, 137, 99, 238, 211, 28, 163, 46, 243, 145, 147, 192, 117, + 157, 68, 173, 219, 195, 18, 143, 74, 28, 137, 230, 139, 181, 77, 162, + 71, 98, 165, 68, 141, 68, 78, 98, 145, 196, 107, 18, 59, 252, 30, + 137, 3, 18, 207, 72, 140, 249, 125, 173, 99, 33, 65, 114, 209, 110, + 131, 192, 218, 65, 2, 105, 4, 108, 245, 165, 74, 125, 165, 206, 5, + 214, 2, 151, 3, 7, 128, 119, 128, 95, 253, 189, 169, 228, 105, 224, + 85, 183, 171, 128, 29, 192, 29, 4, 82, 142, 18, 246, 151, 177, 164, + 126, 151, 1, 220, 3, 188, 79, 32, 222, 40, 97, 167, 235, 243, 151, + 207, 2, 190, 5, 154, 35, 231, 223, 0, 45, 101, 242, 127, 12, 152, + 75, 97, 191, 88, 12, 124, 237, 254, 18, 96, 21, 176, 35, 227, 192, + 50, 207, 15, 38, 126, 49, 113, 56, 202, 243, 221, 38, 154, 139, 114, + 223, 82, 130, 23, 153, 214, 155, 88, 20, 221, 255, 104, 226, 104, 116, + 223, 106, 42, 144, 112, 169, 137, 196, 131, 248, 56, 10, 166, 222, 196, + 141, 21, 128, 77, 165, 223, 155, 120, 42, 34, 246, 158, 200, 247, 18, + 19, 228, 21, 178, 60, 223, 151, 41, 1, 190, 112, 251, 60, 224, 171, + 104, 238, 116, 36, 33, 240, 224, 32, 240, 25, 176, 31, 120, 194, 199, + 27, 161, 112, 26, 102, 167, 154, 1, 127, 186, 253, 98, 9, 240, 81, + 2, 97, 43, 149, 231, 61, 128, 129, 104, 108, 78, 28, 64, 44, 25, + 105, 218, 74, 56, 156, 13, 252, 76, 248, 43, 42, 145, 140, 176, 249, + 226, 137, 188, 133, 20, 12, 123, 68, 9, 225, 171, 127, 7, 46, 40, + 227, 180, 82, 112, 128, 153, 126, 189, 148, 194, 105, 57, 12, 5, 18, + 246, 71, 68, 185, 214, 237, 191, 166, 65, 190, 98, 237, 243, 235, 205, + 209, 88, 127, 188, 19, 246, 250, 53, 39, 177, 194, 237, 157, 37, 118, + 193, 83, 213, 183, 37, 102, 73, 92, 39, 145, 196, 152, 57, 75, 193, + 82, 246, 249, 21, 75, 89, 104, 41, 205, 150, 178, 222, 82, 250, 163, + 241, 211, 213, 253, 150, 178, 201, 82, 174, 180, 148, 185, 150, 146, 248, + 120, 183, 165, 133, 20, 116, 153, 24, 113, 123, 150, 137, 103, 77, 28, + 55, 113, 141, 137, 173, 38, 134, 60, 61, 167, 178, 236, 3, 38, 54, + 152, 184, 213, 255, 253, 39, 221, 55, 142, 213, 101, 42, 252, 5, 99, + 132, 202, 101, 45, 97, 175, 94, 14, 172, 0, 118, 1, 15, 185, 78, + 71, 86, 19, 138, 217, 196, 117, 179, 99, 146, 204, 126, 125, 188, 30, + 168, 35, 236, 255, 181, 132, 3, 233, 15, 224, 54, 202, 87, 64, 229, + 164, 5, 216, 9, 92, 232, 224, 67, 192, 66, 188, 88, 205, 69, 185, + 26, 180, 148, 14, 207, 81, 206, 82, 230, 89, 202, 110, 75, 185, 108, + 26, 249, 191, 202, 82, 222, 181, 148, 243, 163, 220, 119, 56, 22, 150, + 78, 172, 7, 144, 216, 34, 177, 205, 237, 188, 196, 2, 137, 61, 18, + 15, 158, 6, 243, 31, 144, 216, 37, 209, 224, 190, 18, 137, 237, 142, + 49, 254, 92, 50, 115, 211, 164, 69, 233, 71, 64, 43, 140, 23, 165, + 127, 19, 26, 142, 231, 8, 117, 192, 84, 82, 69, 56, 118, 215, 3, + 55, 17, 54, 160, 172, 40, 253, 148, 80, 168, 78, 44, 74, 171, 59, + 39, 237, 11, 170, 129, 55, 129, 251, 40, 108, 205, 2, 254, 1, 126, + 243, 96, 122, 129, 163, 62, 223, 0, 92, 237, 160, 141, 17, 112, 38, + 219, 129, 135, 139, 193, 1, 146, 170, 151, 43, 106, 76, 106, 139, 198, + 229, 192, 73, 20, 96, 12, 152, 177, 253, 56, 101, 26, 147, 36, 191, + 177, 226, 214, 108, 13, 133, 214, 172, 220, 75, 35, 14, 90, 190, 53, + 203, 189, 84, 113, 119, 156, 53, 167, 173, 192, 21, 252, 95, 205, 105, + 178, 225, 204, 182, 231, 255, 1, 200, 91, 112, 221, 160, 249, 68, 42, + 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130 }; diff --git a/backends/networking/curl/cloudicon_disabled_data.h b/backends/networking/curl/cloudicon_disabled_data.h index fc1638cf97..4340a8a37c 100644 --- a/backends/networking/curl/cloudicon_disabled_data.h +++ b/backends/networking/curl/cloudicon_disabled_data.h @@ -25,93 +25,93 @@ // The tool is from https://github.com/pinard/Recode byte cloudicon_disabled_data[] = { -137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, - 82, 0, 0, 0, 32, 0, 0, 0, 32, 8, 6, 0, 0, 0, 115, -122, 122, 244, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8, -124, 8, 100, 136, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, - 18, 0, 0, 11, 18, 1, 210, 221, 126, 252, 0, 0, 0, 22, 116, - 69, 88, 116, 67, 114, 101, 97, 116, 105, 111, 110, 32, 84, 105, 109, -101, 0, 48, 54, 47, 48, 51, 47, 49, 54, 159, 192, 233, 192, 0, - 0, 0, 28, 116, 69, 88, 116, 83, 111, 102, 116, 119, 97, 114, 101, - 0, 65, 100, 111, 98, 101, 32, 70, 105, 114, 101, 119, 111, 114, 107, -115, 32, 67, 83, 54, 232, 188, 178, 140, 0, 0, 4, 139, 73, 68, - 65, 84, 88, 133, 197, 215, 91, 168, 86, 69, 20, 7, 240, 223, 254, -244, 120, 236, 120, 57, 26, 94, 10, 31, 34, 35, 11, 36, 203, 74, -212, 160, 204, 212, 110, 166, 248, 208, 205, 172, 151, 144, 136, 158, 82, - 80, 168, 32, 233, 165, 160, 32, 130, 236, 165, 34, 204, 74, 18, 52, - 36, 169, 232, 34, 24, 221, 243, 218, 133, 74, 77, 195, 44, 200, 91, -122, 188, 156, 172, 102, 159, 221, 195, 204, 246, 219, 126, 231, 226, 17, -138, 22, 12, 123, 246, 236, 153, 245, 95, 107, 205, 127, 205, 172, 157, - 21, 254, 95, 233, 27, 122, 63, 183, 5, 179, 48, 13, 87, 98, 52, - 6, 167, 111, 71, 176, 11, 27, 177, 14, 107, 209, 222, 27, 165, 217, -137, 211, 207, 25, 137, 197, 152, 143, 65, 189, 209, 137, 163, 120, 1, - 79, 98, 111, 143, 147, 143, 247, 172, 108, 62, 158, 194, 16, 20, 169, -105, 232, 151, 82, 171, 24, 80, 74, 27, 22, 225, 197, 110, 13, 104, -235, 122, 188, 31, 94, 194, 93, 21, 192, 14, 49, 172, 223, 226, 109, -124, 130, 29, 232, 131, 49, 184, 22, 55, 166, 126, 75, 131, 65, 175, -225, 94, 252, 213, 201, 128, 131, 93, 131, 191, 137, 27, 42, 192, 199, -241, 6, 158, 192, 246, 238, 188, 73, 50, 6, 143, 98, 78, 50, 164, -140, 200, 123, 34, 135, 78, 49, 34, 219, 215, 89, 193, 171, 152, 151, -192, 3, 246, 224, 1, 188, 123, 26, 224, 170, 92, 134, 143, 49, 160, - 50, 86, 96, 5, 238, 174, 78, 108, 204, 130, 249, 98, 216, 75, 240, -109, 184, 13, 63, 156, 1, 248, 68, 44, 21, 189, 47, 165, 67, 140, -196, 60, 172, 87, 225, 68, 182, 167, 62, 105, 100, 2, 106, 77, 11, -118, 139, 123, 186, 163, 59, 164, 53, 76, 16, 195, 125, 29, 250, 15, -227, 167, 73, 12, 237, 27, 73, 91, 75, 142, 28, 21, 185, 51, 60, -141, 181, 225, 98, 41, 59, 106, 33, 185, 26, 88, 28, 104, 77, 253, -163, 129, 251, 3, 59, 42, 223, 79, 105, 171, 184, 53, 240, 73, 224, -150, 64, 203, 32, 106, 99, 185, 160, 224, 236, 16, 245, 118, 4, 54, - 5, 166, 4, 22, 6, 218, 211, 218, 214, 132, 37, 32, 75, 238, 181, -224, 55, 12, 76, 222, 191, 140, 251, 144, 39, 79, 135, 98, 1, 198, - 98, 11, 150, 227, 251, 50, 204, 67, 113, 121, 90, 156, 57, 185, 127, -135, 154, 184, 9, 95, 160, 9, 43, 49, 59, 69, 225, 24, 206, 65, -123, 150, 54, 247, 14, 188, 158, 214, 30, 23, 79, 186, 109, 9, 252, - 44, 124, 142, 113, 149, 232, 127, 134, 201, 196, 88, 79, 66, 115, 5, -252, 24, 182, 114, 224, 32, 35, 230, 212, 207, 139, 75, 241, 169, 168, - 47, 195, 157, 88, 89, 110, 193, 180, 64, 145, 250, 223, 5, 182, 87, -194, 125, 123, 96, 92, 195, 22, 76, 14, 201, 227, 177, 226, 65, 144, -227, 111, 28, 198, 151, 113, 131, 135, 5, 46, 169, 172, 249, 38, 176, -187, 242, 62, 35, 160, 150, 199, 197, 19, 114, 178, 156, 34, 231, 173, -244, 180, 154, 115, 115, 166, 166, 57, 167, 180, 193, 34, 3, 7, 165, - 61, 11, 137, 105, 27, 112, 160, 62, 111, 235, 106, 22, 166, 126, 71, -206, 59, 165, 238, 156, 43, 114, 100, 155, 98, 120, 218, 146, 206, 2, - 83, 241, 225, 26, 134, 165, 253, 27, 173, 65, 134, 138, 137, 222, 154, -222, 139, 228, 249, 87, 233, 217, 133, 76, 159, 19, 47, 169, 89, 226, -129, 214, 71, 188, 192, 134, 148, 231, 64, 121, 171, 21, 248, 85, 244, -232, 177, 30, 192, 59, 90, 82, 6, 193, 9, 108, 234, 30, 28, 30, - 9, 209, 128, 74, 214, 71, 204, 190, 121, 231, 201, 5, 228, 220, 218, -248, 97, 136, 200, 246, 102, 106, 29, 234, 73, 190, 5, 135, 186, 7, -135, 201, 9, 167, 111, 227, 135, 50, 2, 71, 146, 69, 153, 232, 245, -206, 192, 136, 234, 196, 86, 49, 13, 154, 162, 113, 39, 211, 101, 51, -126, 239, 25, 28, 154, 19, 206, 133, 234, 119, 195, 17, 234, 36, 220, - 85, 33, 202, 213, 169, 191, 175, 36, 92, 139, 152, 106, 3, 212, 9, -119, 76, 100, 251, 126, 157, 9, 218, 69, 219, 150, 158, 211, 42, 99, -187, 114, 245, 147, 112, 83, 122, 214, 2, 51, 83, 127, 85, 16, 89, - 62, 94, 60, 61, 202, 20, 58, 36, 38, 244, 126, 93, 159, 146, 93, -180, 101, 129, 254, 129, 107, 2, 89, 26, 219, 24, 42, 6, 188, 95, -153, 124, 81, 202, 251, 37, 3, 249, 101, 188, 120, 114, 148, 223, 219, -197, 212, 56, 208, 123, 240, 245, 129, 167, 3, 19, 3, 163, 42, 6, -172, 11, 234, 36, 92, 43, 242, 105, 32, 250, 227, 161, 89, 44, 45, - 98, 196, 139, 14, 178, 146, 112, 27, 210, 179, 23, 178, 7, 203, 240, -248, 156, 152, 251, 15, 38, 221, 146, 138, 181, 212, 73, 216, 46, 214, -112, 11, 82, 180, 103, 138, 71, 237, 40, 145, 52, 29, 216, 221, 194, -220, 41, 49, 0, 103, 36, 129, 185, 152, 158, 116, 101, 9, 171, 29, -178, 85, 245, 121, 213, 235, 184, 90, 215, 229, 248, 89, 172, 112, 190, - 62, 83, 112, 209, 145, 85, 226, 229, 147, 105, 188, 142, 43, 172, 220, -155, 179, 40, 29, 201, 85, 6, 239, 204, 153, 155, 243, 117, 47, 216, -222, 216, 38, 229, 188, 146, 51, 188, 162, 119, 81, 194, 82, 205, 130, -178, 189, 24, 120, 173, 97, 108, 80, 34, 102, 111, 73, 87, 182, 123, - 2, 107, 2, 231, 133, 184, 213, 89, 96, 69, 194, 56, 57, 47, 91, -222, 57, 100, 253, 68, 130, 92, 175, 94, 148, 254, 129, 15, 240, 176, - 88, 7, 116, 39, 77, 226, 181, 187, 68, 172, 146, 154, 69, 78, 101, - 98, 77, 57, 91, 99, 81, 250, 82, 215, 138, 202, 178, 188, 44, 78, - 37, 67, 254, 196, 143, 201, 152, 141, 98, 217, 86, 224, 60, 92, 149, - 64, 207, 175, 0, 151, 178, 66, 119, 101, 249, 243, 61, 184, 163, 254, - 99, 210, 218, 48, 94, 94, 5, 101, 13, 162, 1, 176, 100, 251, 97, -167, 249, 49, 233, 115, 179, 250, 111, 78, 23, 109, 115, 193, 178, 130, - 62, 5, 151, 20, 52, 23, 241, 76, 200, 10, 106, 149, 103, 173, 50, -158, 21, 28, 45, 120, 174, 96, 110, 193, 71, 61, 232, 151, 61, 219, -115, 4, 170, 82, 254, 156, 206, 16, 47, 197, 127, 231, 231, 244, 153, -222, 27, 240, 159, 200, 63, 153, 185, 24, 191, 162, 246, 71, 153, 0, - 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130 + 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, + 82, 0, 0, 0, 32, 0, 0, 0, 32, 8, 6, 0, 0, 0, 115, + 122, 122, 244, 0, 0, 0, 4, 115, 66, 73, 84, 8, 8, 8, 8, + 124, 8, 100, 136, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, + 18, 0, 0, 11, 18, 1, 210, 221, 126, 252, 0, 0, 0, 22, 116, + 69, 88, 116, 67, 114, 101, 97, 116, 105, 111, 110, 32, 84, 105, 109, + 101, 0, 48, 54, 47, 48, 51, 47, 49, 54, 159, 192, 233, 192, 0, + 0, 0, 28, 116, 69, 88, 116, 83, 111, 102, 116, 119, 97, 114, 101, + 0, 65, 100, 111, 98, 101, 32, 70, 105, 114, 101, 119, 111, 114, 107, + 115, 32, 67, 83, 54, 232, 188, 178, 140, 0, 0, 4, 139, 73, 68, + 65, 84, 88, 133, 197, 215, 91, 168, 86, 69, 20, 7, 240, 223, 254, + 244, 120, 236, 120, 57, 26, 94, 10, 31, 34, 35, 11, 36, 203, 74, + 212, 160, 204, 212, 110, 166, 248, 208, 205, 172, 151, 144, 136, 158, 82, + 80, 168, 32, 233, 165, 160, 32, 130, 236, 165, 34, 204, 74, 18, 52, + 36, 169, 232, 34, 24, 221, 243, 218, 133, 74, 77, 195, 44, 200, 91, + 122, 188, 156, 172, 102, 159, 221, 195, 204, 246, 219, 126, 231, 226, 17, + 138, 22, 12, 123, 246, 236, 153, 245, 95, 107, 205, 127, 205, 172, 157, + 21, 254, 95, 233, 27, 122, 63, 183, 5, 179, 48, 13, 87, 98, 52, + 6, 167, 111, 71, 176, 11, 27, 177, 14, 107, 209, 222, 27, 165, 217, + 137, 211, 207, 25, 137, 197, 152, 143, 65, 189, 209, 137, 163, 120, 1, + 79, 98, 111, 143, 147, 143, 247, 172, 108, 62, 158, 194, 16, 20, 169, + 105, 232, 151, 82, 171, 24, 80, 74, 27, 22, 225, 197, 110, 13, 104, + 235, 122, 188, 31, 94, 194, 93, 21, 192, 14, 49, 172, 223, 226, 109, + 124, 130, 29, 232, 131, 49, 184, 22, 55, 166, 126, 75, 131, 65, 175, + 225, 94, 252, 213, 201, 128, 131, 93, 131, 191, 137, 27, 42, 192, 199, + 241, 6, 158, 192, 246, 238, 188, 73, 50, 6, 143, 98, 78, 50, 164, + 140, 200, 123, 34, 135, 78, 49, 34, 219, 215, 89, 193, 171, 152, 151, + 192, 3, 246, 224, 1, 188, 123, 26, 224, 170, 92, 134, 143, 49, 160, + 50, 86, 96, 5, 238, 174, 78, 108, 204, 130, 249, 98, 216, 75, 240, + 109, 184, 13, 63, 156, 1, 248, 68, 44, 21, 189, 47, 165, 67, 140, + 196, 60, 172, 87, 225, 68, 182, 167, 62, 105, 100, 2, 106, 77, 11, + 118, 139, 123, 186, 163, 59, 164, 53, 76, 16, 195, 125, 29, 250, 15, + 227, 167, 73, 12, 237, 27, 73, 91, 75, 142, 28, 21, 185, 51, 60, + 141, 181, 225, 98, 41, 59, 106, 33, 185, 26, 88, 28, 104, 77, 253, + 163, 129, 251, 3, 59, 42, 223, 79, 105, 171, 184, 53, 240, 73, 224, + 150, 64, 203, 32, 106, 99, 185, 160, 224, 236, 16, 245, 118, 4, 54, + 5, 166, 4, 22, 6, 218, 211, 218, 214, 132, 37, 32, 75, 238, 181, + 224, 55, 12, 76, 222, 191, 140, 251, 144, 39, 79, 135, 98, 1, 198, + 98, 11, 150, 227, 251, 50, 204, 67, 113, 121, 90, 156, 57, 185, 127, + 135, 154, 184, 9, 95, 160, 9, 43, 49, 59, 69, 225, 24, 206, 65, + 123, 150, 54, 247, 14, 188, 158, 214, 30, 23, 79, 186, 109, 9, 252, + 44, 124, 142, 113, 149, 232, 127, 134, 201, 196, 88, 79, 66, 115, 5, + 252, 24, 182, 114, 224, 32, 35, 230, 212, 207, 139, 75, 241, 169, 168, + 47, 195, 157, 88, 89, 110, 193, 180, 64, 145, 250, 223, 5, 182, 87, + 194, 125, 123, 96, 92, 195, 22, 76, 14, 201, 227, 177, 226, 65, 144, + 227, 111, 28, 198, 151, 113, 131, 135, 5, 46, 169, 172, 249, 38, 176, + 187, 242, 62, 35, 160, 150, 199, 197, 19, 114, 178, 156, 34, 231, 173, + 244, 180, 154, 115, 115, 166, 166, 57, 167, 180, 193, 34, 3, 7, 165, + 61, 11, 137, 105, 27, 112, 160, 62, 111, 235, 106, 22, 166, 126, 71, + 206, 59, 165, 238, 156, 43, 114, 100, 155, 98, 120, 218, 146, 206, 2, + 83, 241, 225, 26, 134, 165, 253, 27, 173, 65, 134, 138, 137, 222, 154, + 222, 139, 228, 249, 87, 233, 217, 133, 76, 159, 19, 47, 169, 89, 226, + 129, 214, 71, 188, 192, 134, 148, 231, 64, 121, 171, 21, 248, 85, 244, + 232, 177, 30, 192, 59, 90, 82, 6, 193, 9, 108, 234, 30, 28, 30, + 9, 209, 128, 74, 214, 71, 204, 190, 121, 231, 201, 5, 228, 220, 218, + 248, 97, 136, 200, 246, 102, 106, 29, 234, 73, 190, 5, 135, 186, 7, + 135, 201, 9, 167, 111, 227, 135, 50, 2, 71, 146, 69, 153, 232, 245, + 206, 192, 136, 234, 196, 86, 49, 13, 154, 162, 113, 39, 211, 101, 51, + 126, 239, 25, 28, 154, 19, 206, 133, 234, 119, 195, 17, 234, 36, 220, + 85, 33, 202, 213, 169, 191, 175, 36, 92, 139, 152, 106, 3, 212, 9, + 119, 76, 100, 251, 126, 157, 9, 218, 69, 219, 150, 158, 211, 42, 99, + 187, 114, 245, 147, 112, 83, 122, 214, 2, 51, 83, 127, 85, 16, 89, + 62, 94, 60, 61, 202, 20, 58, 36, 38, 244, 126, 93, 159, 146, 93, + 180, 101, 129, 254, 129, 107, 2, 89, 26, 219, 24, 42, 6, 188, 95, + 153, 124, 81, 202, 251, 37, 3, 249, 101, 188, 120, 114, 148, 223, 219, + 197, 212, 56, 208, 123, 240, 245, 129, 167, 3, 19, 3, 163, 42, 6, + 172, 11, 234, 36, 92, 43, 242, 105, 32, 250, 227, 161, 89, 44, 45, + 98, 196, 139, 14, 178, 146, 112, 27, 210, 179, 23, 178, 7, 203, 240, + 248, 156, 152, 251, 15, 38, 221, 146, 138, 181, 212, 73, 216, 46, 214, + 112, 11, 82, 180, 103, 138, 71, 237, 40, 145, 52, 29, 216, 221, 194, + 220, 41, 49, 0, 103, 36, 129, 185, 152, 158, 116, 101, 9, 171, 29, + 178, 85, 245, 121, 213, 235, 184, 90, 215, 229, 248, 89, 172, 112, 190, + 62, 83, 112, 209, 145, 85, 226, 229, 147, 105, 188, 142, 43, 172, 220, + 155, 179, 40, 29, 201, 85, 6, 239, 204, 153, 155, 243, 117, 47, 216, + 222, 216, 38, 229, 188, 146, 51, 188, 162, 119, 81, 194, 82, 205, 130, + 178, 189, 24, 120, 173, 97, 108, 80, 34, 102, 111, 73, 87, 182, 123, + 2, 107, 2, 231, 133, 184, 213, 89, 96, 69, 194, 56, 57, 47, 91, + 222, 57, 100, 253, 68, 130, 92, 175, 94, 148, 254, 129, 15, 240, 176, + 88, 7, 116, 39, 77, 226, 181, 187, 68, 172, 146, 154, 69, 78, 101, + 98, 77, 57, 91, 99, 81, 250, 82, 215, 138, 202, 178, 188, 44, 78, + 37, 67, 254, 196, 143, 201, 152, 141, 98, 217, 86, 224, 60, 92, 149, + 64, 207, 175, 0, 151, 178, 66, 119, 101, 249, 243, 61, 184, 163, 254, + 99, 210, 218, 48, 94, 94, 5, 101, 13, 162, 1, 176, 100, 251, 97, + 167, 249, 49, 233, 115, 179, 250, 111, 78, 23, 109, 115, 193, 178, 130, + 62, 5, 151, 20, 52, 23, 241, 76, 200, 10, 106, 149, 103, 173, 50, + 158, 21, 28, 45, 120, 174, 96, 110, 193, 71, 61, 232, 151, 61, 219, + 115, 4, 170, 82, 254, 156, 206, 16, 47, 197, 127, 231, 231, 244, 153, + 222, 27, 240, 159, 200, 63, 153, 185, 24, 191, 162, 246, 71, 153, 0, + 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130 }; diff --git a/backends/networking/curl/connectionmanager.h b/backends/networking/curl/connectionmanager.h index 5fd19d78b5..826bef6d36 100644 --- a/backends/networking/curl/connectionmanager.h +++ b/backends/networking/curl/connectionmanager.h @@ -125,7 +125,7 @@ public: }; /** Shortcut for accessing the connection manager. */ -#define ConnMan Networking::ConnectionManager::instance() +#define ConnMan Networking::ConnectionManager::instance() } // End of namespace Networking diff --git a/backends/networking/curl/networkreadstream.cpp b/backends/networking/curl/networkreadstream.cpp index d5f6288a26..1764a939fd 100644 --- a/backends/networking/curl/networkreadstream.cpp +++ b/backends/networking/curl/networkreadstream.cpp @@ -31,19 +31,19 @@ namespace Networking { 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); + if (stream) return stream->write(d, n * l); return 0; } 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); + if (stream) return stream->fillWithSendingContents(d, n * l); return 0; } static size_t curlHeadersCallback(char *d, size_t n, size_t l, void *p) { NetworkReadStream *stream = (NetworkReadStream *)p; - if (stream) return stream->addResponseHeaders(d, n*l); + if (stream) return stream->addResponseHeaders(d, n * l); return 0; } @@ -112,30 +112,33 @@ void NetworkReadStream::init(const char *url, curl_slist *headersList, Common::H curl_easy_setopt(_easy, CURLOPT_XFERINFODATA, this); // set POST multipart upload form fields/files - struct curl_httppost *formpost = NULL; - struct curl_httppost *lastptr = NULL; + struct curl_httppost *formpost = nullptr; + struct curl_httppost *lastptr = nullptr; for (Common::HashMap<Common::String, Common::String>::iterator i = formFields.begin(); i != formFields.end(); ++i) { - if (0 != curl_formadd(&formpost, &lastptr, + CURLFORMcode code = curl_formadd( + &formpost, + &lastptr, CURLFORM_COPYNAME, i->_key.c_str(), CURLFORM_COPYCONTENTS, i->_value.c_str(), - CURLFORM_END)) debug("file failed formadd"); - } + CURLFORM_END + ); - /* - curl_formadd(&formpost, &lastptr, - CURLFORM_COPYNAME, "fieldname", - CURLFORM_BUFFER, "filename", - CURLFORM_BUFFERPTR, buffer, - CURLFORM_BUFFERLENGTH, bufferSize, - CURLFORM_END); - */ + if (code != CURL_FORMADD_OK) + debug("field failed formadd"); + } for (Common::HashMap<Common::String, Common::String>::iterator i = formFiles.begin(); i != formFiles.end(); ++i) { - if (0 != curl_formadd(&formpost, &lastptr, + CURLFORMcode code = curl_formadd( + &formpost, + &lastptr, CURLFORM_COPYNAME, i->_key.c_str(), CURLFORM_FILE, i->_value.c_str(), - CURLFORM_END)) debug("file failed formadd"); + CURLFORM_END + ); + + if (code != CURL_FORMADD_OK) + debug("file failed formadd"); } curl_easy_setopt(_easy, CURLOPT_HTTPPOST, formpost); diff --git a/backends/networking/curl/networkreadstream.h b/backends/networking/curl/networkreadstream.h index 0138da183b..2be6d591cb 100644 --- a/backends/networking/curl/networkreadstream.h +++ b/backends/networking/curl/networkreadstream.h @@ -50,9 +50,9 @@ public: NetworkReadStream(const char *url, curl_slist *headersList, Common::String postFields, bool uploading = false, bool usingPatch = false); /** Send <formFields>, <formFiles>, using POST multipart/form. */ NetworkReadStream( - const char *url, curl_slist *headersList, - Common::HashMap<Common::String, Common::String> formFields, - Common::HashMap<Common::String, Common::String> formFiles); + const char *url, curl_slist *headersList, + Common::HashMap<Common::String, Common::String> formFields, + Common::HashMap<Common::String, Common::String> formFiles); /** Send <buffer, using POST by default. */ NetworkReadStream(const char *url, curl_slist *headersList, const byte *buffer, uint32 bufferSize, bool uploading = false, bool usingPatch = false, bool post = true); virtual ~NetworkReadStream(); @@ -77,8 +77,8 @@ public: * supposed to match those of ISO C fread(), in particular where * it concerns setting error and end of file/stream flags. * - * @param dataPtr pointer to a buffer into which the data is read - * @param dataSize number of bytes to be read + * @param dataPtr pointer to a buffer into which the data is read + * @param dataSize number of bytes to be read * @return the number of bytes which were actually read. */ virtual uint32 read(void *dataPtr, uint32 dataSize); diff --git a/backends/networking/curl/request.h b/backends/networking/curl/request.h index 6a1bc12594..9b366ea40c 100644 --- a/backends/networking/curl/request.h +++ b/backends/networking/curl/request.h @@ -161,7 +161,7 @@ public: /** Method, which does actual work. Depends on what this Request is doing. */ virtual void handle() = 0; - /** Method, which is called by ConnectionManager when Request's state is RETRY. */ + /** Method, which is called by ConnectionManager when Request's state is RETRY. */ virtual void handleRetry(); /** Method, which is used to restart the Request. */ diff --git a/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp b/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp index 2ded9785a0..b16827dc58 100644 --- a/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp +++ b/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp @@ -91,9 +91,8 @@ void CreateDirectoryHandler::handle(Client &client) { client.queryParameter("path").c_str(), _("Back to parent directory") ), - (client.queryParameter("ajax") == "true" ? "/filesAJAX?path=" : "/files?path=") + - LocalWebserver::urlEncodeQueryParameterValue(client.queryParameter("path")) + LocalWebserver::urlEncodeQueryParameterValue(client.queryParameter("path")) ); } diff --git a/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp b/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp index 7d48458d5e..6cf18aeb79 100644 --- a/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp @@ -34,6 +34,7 @@ FilesAjaxPageHandler::FilesAjaxPageHandler() {} FilesAjaxPageHandler::~FilesAjaxPageHandler() {} namespace { + Common::String encodeDoubleQuotesAndSlashes(Common::String s) { Common::String result = ""; for (uint32 i = 0; i < s.size(); ++i) @@ -42,8 +43,9 @@ Common::String encodeDoubleQuotesAndSlashes(Common::String s) { } else if (s[i] == '\\') { result += "\\\\"; } else result += s[i]; - return result; + return result; } + } void FilesAjaxPageHandler::handle(Client &client) { diff --git a/backends/networking/sdl_net/handlerutils.cpp b/backends/networking/sdl_net/handlerutils.cpp index cdc505bfa9..bb6a036bdb 100644 --- a/backends/networking/sdl_net/handlerutils.cpp +++ b/backends/networking/sdl_net/handlerutils.cpp @@ -108,14 +108,16 @@ void HandlerUtils::setMessageHandler(Client &client, Common::String message, Com } void HandlerUtils::setFilesManagerErrorMessageHandler(Client &client, Common::String message, Common::String redirectTo) { - setMessageHandler(client, + setMessageHandler( + client, Common::String::format( "%s<br/><a href=\"files%s?path=%s\">%s</a>", message.c_str(), - client.queryParameter("ajax") == "true" ? "AJAX": "", + client.queryParameter("ajax") == "true" ? "AJAX" : "", "%2F", //that's encoded "/" _("Back to the files manager") - ), redirectTo + ), + redirectTo ); } diff --git a/backends/networking/sdl_net/localwebserver.cpp b/backends/networking/sdl_net/localwebserver.cpp index 0ad1335f41..9b62bb8637 100644 --- a/backends/networking/sdl_net/localwebserver.cpp +++ b/backends/networking/sdl_net/localwebserver.cpp @@ -205,8 +205,11 @@ void LocalWebserver::handle() { void LocalWebserver::handleClient(uint32 i) { switch (_client[i].state()) { - case INVALID: return; - case READING_HEADERS: _client[i].readHeaders(); break; + case INVALID: + return; + case READING_HEADERS: + _client[i].readHeaders(); + break; case READ_HEADERS: //decide what to do next with that client //if GET, check whether we know a handler for such URL //if PUT, check whether we know a handler for that URL @@ -216,7 +219,6 @@ void LocalWebserver::handleClient(uint32 i) { (*_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 //fallthrough case BAD_REQUEST: @@ -278,55 +280,55 @@ void LocalWebserver::resolveAddress(void *ipAddress) { // if not - try platform-specific #ifdef POSIX - struct ifaddrs *ifAddrStruct = NULL; - void *tmpAddrPtr = NULL; + struct ifaddrs *ifAddrStruct = NULL; + void *tmpAddrPtr = NULL; - getifaddrs(&ifAddrStruct); + getifaddrs(&ifAddrStruct); - for (struct ifaddrs *i = ifAddrStruct; i != NULL; i = i->ifa_next) { - if (!i->ifa_addr) { - continue; - } + for (struct ifaddrs *i = ifAddrStruct; i != NULL; i = i->ifa_next) { + if (!i->ifa_addr) { + continue; + } - Common::String addr; + Common::String addr; - // IPv4 - 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; - } + // IPv4 + 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) { - tmpAddrPtr = &((struct sockaddr_in6 *)i->ifa_addr)->sin6_addr; - char addressBuffer[INET6_ADDRSTRLEN]; - inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN); - debug("%s IP Address %s", i->ifa_name, addressBuffer); - addr = addressBuffer; - } - */ + // IPv6 + /* + if (i->ifa_addr->sa_family == AF_INET6) { + tmpAddrPtr = &((struct sockaddr_in6 *)i->ifa_addr)->sin6_addr; + char addressBuffer[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN); + debug("%s IP Address %s", i->ifa_name, addressBuffer); + addr = addressBuffer; + } + */ - if (addr.empty()) continue; + if (addr.empty()) continue; - // ignored IPv4 addresses - if (addr.equals("127.0.0.1") || addr.equals("0.0.0.0") || addr.equals("localhost")) - continue; + // ignored IPv4 addresses + if (addr.equals("127.0.0.1") || addr.equals("0.0.0.0") || addr.equals("localhost")) + continue; - // ignored IPv6 addresses - /* - if (addr.equals("::1")) - continue; - */ + // ignored IPv6 addresses + /* + if (addr.equals("::1")) + continue; + */ - // use the address found - _address = "http://" + addr + Common::String::format(":%u/", _serverPort); - } + // use the address found + _address = "http://" + addr + Common::String::format(":%u/", _serverPort); + } - if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct); + if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct); #endif } @@ -397,9 +399,9 @@ Common::String LocalWebserver::urlDecode(Common::String value) { continue; } - if (value[i] == '%' && i+2 < size) { - int d1 = hexDigit(value[i+1]); - int d2 = hexDigit(value[i+2]); + if (value[i] == '%' && i + 2 < size) { + int d1 = hexDigit(value[i + 1]); + int d2 = hexDigit(value[i + 2]); if (0 <= d1 && d1 < 16 && 0 <= d2 && d2 < 16) { result += (char)(d1 * 16 + d2); i = i + 2; diff --git a/backends/networking/sdl_net/localwebserver.h b/backends/networking/sdl_net/localwebserver.h index d118509d62..f4c59c6b91 100644 --- a/backends/networking/sdl_net/localwebserver.h +++ b/backends/networking/sdl_net/localwebserver.h @@ -110,7 +110,7 @@ public: }; /** Shortcut for accessing the local webserver. */ -#define LocalServer Networking::LocalWebserver::instance() +#define LocalServer Networking::LocalWebserver::instance() } // End of namespace Networking diff --git a/backends/networking/sdl_net/reader.cpp b/backends/networking/sdl_net/reader.cpp index 8edda70341..66efeec8cc 100644 --- a/backends/networking/sdl_net/reader.cpp +++ b/backends/networking/sdl_net/reader.cpp @@ -163,7 +163,7 @@ void Reader::parseFirstLine(const Common::String &headers) { const char *cstr = headers.c_str(); const char *position = strstr(cstr, "\r\n"); if (position) { //we have at least one line - and we want the first one - //"<METHOD> <path> HTTP/<VERSION>\r\n" + //"<METHOD> <path> HTTP/<VERSION>\r\n" Common::String method, path, http, buf; uint32 length = position - cstr; if (headersSize > length) headersSize = length; diff --git a/backends/networking/sdl_net/uploadfileclienthandler.cpp b/backends/networking/sdl_net/uploadfileclienthandler.cpp index 4ecd095c19..3c51c558a2 100644 --- a/backends/networking/sdl_net/uploadfileclienthandler.cpp +++ b/backends/networking/sdl_net/uploadfileclienthandler.cpp @@ -153,16 +153,16 @@ void UploadFileClientHandler::handleBlockContent(Client *client) { if (client->noMoreContent()) { // success - redirect back to directory listing - HandlerUtils::setMessageHandler(*client, + HandlerUtils::setMessageHandler( + *client, Common::String::format( "%s<br/><a href=\"files?path=%s\">%s</a>", _("Uploaded successfully!"), client->queryParameter("path").c_str(), _("Back to parent directory") ), - (client->queryParameter("ajax") == "true" ? "/filesAJAX?path=" : "/files?path=") + - LocalWebserver::urlEncodeQueryParameterValue(client->queryParameter("path")) + LocalWebserver::urlEncodeQueryParameterValue(client->queryParameter("path")) ); _state = UFH_STOP; return; |