diff options
Diffstat (limited to 'backends')
34 files changed, 109 insertions, 107 deletions
diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index 598ca55c15..fb01521016 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -67,8 +67,8 @@ void BoxStorage::loadKeyAndSecret() { #endif } -BoxStorage::BoxStorage(Common::String accessToken, Common::String refreshToken): - _token(accessToken), _refreshToken(refreshToken) {} +BoxStorage::BoxStorage(Common::String token, Common::String refreshToken): + _token(token), _refreshToken(refreshToken) {} BoxStorage::BoxStorage(Common::String code) { getAccessToken( @@ -191,36 +191,36 @@ void BoxStorage::infoInnerCallback(StorageInfoCallback outerCallback, Networking return; } - Common::JSONObject info = json->asObject(); + Common::JSONObject jsonInfo = json->asObject(); - Common::String uid, name, email; + Common::String uid, displayName, email; uint64 quotaUsed = 0, quotaAllocated = 0; // can check that "type": "user" // there is also "max_upload_size", "phone" and "avatar_url" - if (Networking::CurlJsonRequest::jsonContainsString(info, "id", "BoxStorage::infoInnerCallback")) - uid = info.getVal("id")->asString(); + if (Networking::CurlJsonRequest::jsonContainsString(jsonInfo, "id", "BoxStorage::infoInnerCallback")) + uid = jsonInfo.getVal("id")->asString(); - if (Networking::CurlJsonRequest::jsonContainsString(info, "name", "BoxStorage::infoInnerCallback")) - name = info.getVal("name")->asString(); + if (Networking::CurlJsonRequest::jsonContainsString(jsonInfo, "name", "BoxStorage::infoInnerCallback")) + displayName = jsonInfo.getVal("name")->asString(); - if (Networking::CurlJsonRequest::jsonContainsString(info, "login", "BoxStorage::infoInnerCallback")) - email = info.getVal("login")->asString(); + if (Networking::CurlJsonRequest::jsonContainsString(jsonInfo, "login", "BoxStorage::infoInnerCallback")) + email = jsonInfo.getVal("login")->asString(); - if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(info, "space_amount", "BoxStorage::infoInnerCallback")) - quotaAllocated = info.getVal("space_amount")->asIntegerNumber(); + if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(jsonInfo, "space_amount", "BoxStorage::infoInnerCallback")) + quotaAllocated = jsonInfo.getVal("space_amount")->asIntegerNumber(); - if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(info, "space_used", "BoxStorage::infoInnerCallback")) - quotaUsed = info.getVal("space_used")->asIntegerNumber(); + if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(jsonInfo, "space_used", "BoxStorage::infoInnerCallback")) + quotaUsed = jsonInfo.getVal("space_used")->asIntegerNumber(); Common::String username = email; - if (username == "") username = name; + if (username == "") username = displayName; if (username == "") username = uid; CloudMan.setStorageUsername(kStorageBoxId, username); if (outerCallback) { - (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated))); + (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, displayName, email, quotaUsed, quotaAllocated))); delete outerCallback; } @@ -245,8 +245,8 @@ void BoxStorage::createDirectoryInnerCallback(BoolCallback outerCallback, Networ if (outerCallback) { if (Networking::CurlJsonRequest::jsonIsObject(json, "BoxStorage::createDirectoryInnerCallback")) { - Common::JSONObject info = json->asObject(); - (*outerCallback)(BoolResponse(nullptr, info.contains("id"))); + Common::JSONObject jsonInfo = json->asObject(); + (*outerCallback)(BoolResponse(nullptr, jsonInfo.contains("id"))); } else { (*outerCallback)(BoolResponse(nullptr, false)); } @@ -256,7 +256,7 @@ void BoxStorage::createDirectoryInnerCallback(BoolCallback outerCallback, Networ delete json; } -Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) { +Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback) { if (!errorCallback) errorCallback = getErrorPrintingCallback(); @@ -270,7 +270,7 @@ Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String pare parentObject.setVal("id", new Common::JSONValue(parentId)); Common::JSONObject jsonRequestParameters; - jsonRequestParameters.setVal("name", new Common::JSONValue(name)); + jsonRequestParameters.setVal("name", new Common::JSONValue(directoryName)); jsonRequestParameters.setVal("parent", new Common::JSONValue(parentObject)); Common::JSONValue value(jsonRequestParameters); diff --git a/backends/cloud/box/boxstorage.h b/backends/cloud/box/boxstorage.h index 27bf60e39b..a641669b2a 100644 --- a/backends/cloud/box/boxstorage.h +++ b/backends/cloud/box/boxstorage.h @@ -74,7 +74,7 @@ public: /** Public Cloud API comes down there. */ virtual Networking::Request *listDirectoryById(Common::String id, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback); - virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback); + virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback); /** Returns UploadStatus struct with info about uploaded file. */ virtual Networking::Request *upload(Common::String remotePath, Common::String localPath, UploadCallback callback, Networking::ErrorCallback errorCallback); diff --git a/backends/cloud/cloudmanager.cpp b/backends/cloud/cloudmanager.cpp index 5f7d6942ca..4fb38ad779 100644 --- a/backends/cloud/cloudmanager.cpp +++ b/backends/cloud/cloudmanager.cpp @@ -272,6 +272,8 @@ void CloudManager::connectStorage(uint32 index, Common::String code) { // when the token is received, they call replaceStorage() // or removeStorage(), if some error occurred // thus, no memory leak happens + + // FIXME: storage is set, but never used. Should it be returned from this function for class variable _storages? } Networking::Request *CloudManager::listDirectory(Common::String path, Storage::ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive) { diff --git a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp index 411e367a9d..d6937d9cb2 100644 --- a/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp +++ b/backends/cloud/dropbox/dropboxcreatedirectoryrequest.cpp @@ -52,8 +52,8 @@ void DropboxCreateDirectoryRequest::start() { _ignoreCallback = false; Networking::JsonCallback innerCallback = new Common::Callback<DropboxCreateDirectoryRequest, Networking::JsonResponse>(this, &DropboxCreateDirectoryRequest::responseCallback); - Networking::ErrorCallback errorCallback = new Common::Callback<DropboxCreateDirectoryRequest, Networking::ErrorResponse>(this, &DropboxCreateDirectoryRequest::errorCallback); - Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorCallback, DROPBOX_API_CREATE_FOLDER); + Networking::ErrorCallback errorResponseCallback = new Common::Callback<DropboxCreateDirectoryRequest, Networking::ErrorResponse>(this, &DropboxCreateDirectoryRequest::errorCallback); + Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorResponseCallback, DROPBOX_API_CREATE_FOLDER); request->addHeader("Authorization: Bearer " + _token); request->addHeader("Content-Type: application/json"); diff --git a/backends/cloud/dropbox/dropboxinforequest.cpp b/backends/cloud/dropbox/dropboxinforequest.cpp index 3d82c8d34b..ebf2d12170 100644 --- a/backends/cloud/dropbox/dropboxinforequest.cpp +++ b/backends/cloud/dropbox/dropboxinforequest.cpp @@ -54,8 +54,8 @@ void DropboxInfoRequest::start() { _ignoreCallback = false; Networking::JsonCallback innerCallback = new Common::Callback<DropboxInfoRequest, Networking::JsonResponse>(this, &DropboxInfoRequest::userResponseCallback); - Networking::ErrorCallback errorCallback = new Common::Callback<DropboxInfoRequest, Networking::ErrorResponse>(this, &DropboxInfoRequest::errorCallback); - Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorCallback, DROPBOX_API_GET_CURRENT_ACCOUNT); + Networking::ErrorCallback errorResponseCallback = new Common::Callback<DropboxInfoRequest, Networking::ErrorResponse>(this, &DropboxInfoRequest::errorCallback); + Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorResponseCallback, DROPBOX_API_GET_CURRENT_ACCOUNT); request->addHeader("Authorization: Bearer " + _token); request->addHeader("Content-Type: application/json"); request->addPostField("null"); //use POST @@ -108,8 +108,8 @@ void DropboxInfoRequest::userResponseCallback(Networking::JsonResponse response) delete json; Networking::JsonCallback innerCallback = new Common::Callback<DropboxInfoRequest, Networking::JsonResponse>(this, &DropboxInfoRequest::quotaResponseCallback); - Networking::ErrorCallback errorCallback = new Common::Callback<DropboxInfoRequest, Networking::ErrorResponse>(this, &DropboxInfoRequest::errorCallback); - Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorCallback, DROPBOX_API_GET_SPACE_USAGE); + Networking::ErrorCallback errorResponseCallback = new Common::Callback<DropboxInfoRequest, Networking::ErrorResponse>(this, &DropboxInfoRequest::errorCallback); + Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorResponseCallback, DROPBOX_API_GET_SPACE_USAGE); request->addHeader("Authorization: Bearer " + _token); request->addHeader("Content-Type: application/json"); request->addPostField("null"); //use POST diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp index ec4c84400c..c00d954966 100644 --- a/backends/cloud/googledrive/googledrivestorage.cpp +++ b/backends/cloud/googledrive/googledrivestorage.cpp @@ -68,8 +68,8 @@ void GoogleDriveStorage::loadKeyAndSecret() { #endif } -GoogleDriveStorage::GoogleDriveStorage(Common::String accessToken, Common::String refreshToken): - _token(accessToken), _refreshToken(refreshToken) {} +GoogleDriveStorage::GoogleDriveStorage(Common::String token, Common::String refreshToken): + _token(token), _refreshToken(refreshToken) {} GoogleDriveStorage::GoogleDriveStorage(Common::String code) { getAccessToken( @@ -192,28 +192,28 @@ void GoogleDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Ne return; } - Common::JSONObject info = json->asObject(); + Common::JSONObject jsonInfo = json->asObject(); - Common::String uid, name, email; + Common::String uid, displayName, email; uint64 quotaUsed = 0, quotaAllocated = 0; - if (Networking::CurlJsonRequest::jsonContainsAttribute(info, "user", "GoogleDriveStorage::infoInnerCallback") && - Networking::CurlJsonRequest::jsonIsObject(info.getVal("user"), "GoogleDriveStorage::infoInnerCallback")) { + if (Networking::CurlJsonRequest::jsonContainsAttribute(jsonInfo, "user", "GoogleDriveStorage::infoInnerCallback") && + Networking::CurlJsonRequest::jsonIsObject(jsonInfo.getVal("user"), "GoogleDriveStorage::infoInnerCallback")) { //"me":true, "kind":"drive#user","photoLink": "", //"displayName":"Alexander Tkachev","emailAddress":"alexander@tkachov.ru","permissionId":"" - Common::JSONObject user = info.getVal("user")->asObject(); + Common::JSONObject user = jsonInfo.getVal("user")->asObject(); if (Networking::CurlJsonRequest::jsonContainsString(user, "permissionId", "GoogleDriveStorage::infoInnerCallback")) uid = user.getVal("permissionId")->asString(); //not sure it's user's id, but who cares anyway? if (Networking::CurlJsonRequest::jsonContainsString(user, "displayName", "GoogleDriveStorage::infoInnerCallback")) - name = user.getVal("displayName")->asString(); + displayName = user.getVal("displayName")->asString(); if (Networking::CurlJsonRequest::jsonContainsString(user, "emailAddress", "GoogleDriveStorage::infoInnerCallback")) email = user.getVal("emailAddress")->asString(); } - if (Networking::CurlJsonRequest::jsonContainsAttribute(info, "storageQuota", "GoogleDriveStorage::infoInnerCallback") && - Networking::CurlJsonRequest::jsonIsObject(info.getVal("storageQuota"), "GoogleDriveStorage::infoInnerCallback")) { + if (Networking::CurlJsonRequest::jsonContainsAttribute(jsonInfo, "storageQuota", "GoogleDriveStorage::infoInnerCallback") && + Networking::CurlJsonRequest::jsonIsObject(jsonInfo.getVal("storageQuota"), "GoogleDriveStorage::infoInnerCallback")) { //"usageInDrive":"6332462","limit":"18253611008","usage":"6332462","usageInDriveTrash":"0" - Common::JSONObject storageQuota = info.getVal("storageQuota")->asObject(); + Common::JSONObject storageQuota = jsonInfo.getVal("storageQuota")->asObject(); if (Networking::CurlJsonRequest::jsonContainsString(storageQuota, "usage", "GoogleDriveStorage::infoInnerCallback")) { Common::String usage = storageQuota.getVal("usage")->asString(); @@ -229,7 +229,7 @@ void GoogleDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Ne CloudMan.setStorageUsername(kStorageGoogleDriveId, email); if (outerCallback) { - (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated))); + (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, displayName, email, quotaUsed, quotaAllocated))); delete outerCallback; } @@ -246,8 +246,8 @@ void GoogleDriveStorage::createDirectoryInnerCallback(BoolCallback outerCallback if (outerCallback) { if (Networking::CurlJsonRequest::jsonIsObject(json, "GoogleDriveStorage::createDirectoryInnerCallback")) { - Common::JSONObject info = json->asObject(); - (*outerCallback)(BoolResponse(nullptr, info.contains("id"))); + Common::JSONObject jsonInfo = json->asObject(); + (*outerCallback)(BoolResponse(nullptr, jsonInfo.contains("id"))); } else { (*outerCallback)(BoolResponse(nullptr, false)); } @@ -289,7 +289,7 @@ void GoogleDriveStorage::printInfo(StorageInfoResponse response) { debug(9, "\tdisk usage: %lu/%lu", response.value.used(), response.value.available()); } -Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) { +Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback) { if (!errorCallback) errorCallback = getErrorPrintingCallback(); @@ -304,7 +304,7 @@ Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::Str Common::JSONObject jsonRequestParameters; jsonRequestParameters.setVal("mimeType", new Common::JSONValue("application/vnd.google-apps.folder")); - jsonRequestParameters.setVal("name", new Common::JSONValue(name)); + jsonRequestParameters.setVal("name", new Common::JSONValue(directoryName)); jsonRequestParameters.setVal("parents", new Common::JSONValue(parentsArray)); Common::JSONValue value(jsonRequestParameters); diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h index 457369dc90..d0585bc403 100644 --- a/backends/cloud/googledrive/googledrivestorage.h +++ b/backends/cloud/googledrive/googledrivestorage.h @@ -86,7 +86,7 @@ public: virtual Networking::Request *streamFileById(Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback); /** Calls the callback when finished. */ - virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback); + virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback); /** Returns the StorageInfo struct. */ virtual Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback); diff --git a/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp b/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp index da67266d12..74cf3208e3 100644 --- a/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp +++ b/backends/cloud/onedrive/onedrivecreatedirectoryrequest.cpp @@ -72,8 +72,8 @@ void OneDriveCreateDirectoryRequest::start() { url += ":/" + ConnMan.urlEncode(parent) + ":"; 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()); + Networking::ErrorCallback errorResponseCallback = new Common::Callback<OneDriveCreateDirectoryRequest, Networking::ErrorResponse>(this, &OneDriveCreateDirectoryRequest::errorCallback); + Networking::CurlJsonRequest *request = new OneDriveTokenRefresher(_storage, innerCallback, errorResponseCallback, url.c_str()); request->addHeader("Authorization: Bearer " + _storage->accessToken()); request->addHeader("Content-Type: application/json"); diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index 8799f3d69f..14e803d980 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -67,8 +67,8 @@ void OneDriveStorage::loadKeyAndSecret() { #endif } -OneDriveStorage::OneDriveStorage(Common::String accessToken, Common::String userId, Common::String refreshToken): - _token(accessToken), _uid(userId), _refreshToken(refreshToken) {} +OneDriveStorage::OneDriveStorage(Common::String token, Common::String uid, Common::String refreshToken): + _token(token), _uid(uid), _refreshToken(refreshToken) {} OneDriveStorage::OneDriveStorage(Common::String code) { getAccessToken( @@ -193,35 +193,35 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo return; } - Common::JSONObject info = json->asObject(); + Common::JSONObject jsonInfo = json->asObject(); - Common::String uid, name, email; + Common::String uid, displayName, email; uint64 quotaUsed = 0, quotaAllocated = 26843545600LL; // 25 GB, because I actually don't know any way to find out the real one - if (Networking::CurlJsonRequest::jsonContainsObject(info, "createdBy", "OneDriveStorage::infoInnerCallback")) { - Common::JSONObject createdBy = info.getVal("createdBy")->asObject(); + if (Networking::CurlJsonRequest::jsonContainsObject(jsonInfo, "createdBy", "OneDriveStorage::infoInnerCallback")) { + Common::JSONObject createdBy = jsonInfo.getVal("createdBy")->asObject(); if (Networking::CurlJsonRequest::jsonContainsObject(createdBy, "user", "OneDriveStorage::infoInnerCallback")) { Common::JSONObject user = createdBy.getVal("user")->asObject(); if (Networking::CurlJsonRequest::jsonContainsString(user, "id", "OneDriveStorage::infoInnerCallback")) uid = user.getVal("id")->asString(); if (Networking::CurlJsonRequest::jsonContainsString(user, "displayName", "OneDriveStorage::infoInnerCallback")) - name = user.getVal("displayName")->asString(); + displayName = user.getVal("displayName")->asString(); } } - if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(info, "size", "OneDriveStorage::infoInnerCallback")) { - quotaUsed = info.getVal("size")->asIntegerNumber(); + if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(jsonInfo, "size", "OneDriveStorage::infoInnerCallback")) { + quotaUsed = jsonInfo.getVal("size")->asIntegerNumber(); } Common::String username = email; if (username == "") - username = name; + username = displayName; if (username == "") username = uid; CloudMan.setStorageUsername(kStorageOneDriveId, username); if (outerCallback) { - (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated))); + (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, displayName, email, quotaUsed, quotaAllocated))); delete outerCallback; } diff --git a/backends/cloud/storagefile.cpp b/backends/cloud/storagefile.cpp index 2428d8ff80..90ec7da120 100644 --- a/backends/cloud/storagefile.cpp +++ b/backends/cloud/storagefile.cpp @@ -56,10 +56,10 @@ StorageFile::StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir) { _isDirectory = dir; } -StorageFile::StorageFile(Common::String id, Common::String path, Common::String name, uint32 sz, uint32 ts, bool dir) { - _id = id; - _path = path; - _name = name; +StorageFile::StorageFile(Common::String fileId, Common::String filePath, Common::String fileName, uint32 sz, uint32 ts, bool dir) { + _id = fileId; + _path = filePath; + _name = fileName; _size = sz; _timestamp = ts; _isDirectory = dir; diff --git a/backends/cloud/storagefile.h b/backends/cloud/storagefile.h index 44f16c3689..c29ac77dd1 100644 --- a/backends/cloud/storagefile.h +++ b/backends/cloud/storagefile.h @@ -48,7 +48,7 @@ class StorageFile { public: StorageFile(); //invalid empty file StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir); - StorageFile(Common::String id, Common::String path, Common::String name, uint32 sz, uint32 ts, bool dir); + StorageFile(Common::String fileId, Common::String filePath, Common::String fileName, uint32 sz, uint32 ts, bool dir); Common::String id() const { return _id; } Common::String path() const { return _path; } diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 24286b649d..28ea3bbecd 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -195,11 +195,11 @@ public: /** * Creates a file referred by this node. * - * @param isDirectory true if created file must be a directory + * @param isDirectoryFlag true if created file must be a directory * * @return true if file is created successfully */ - virtual bool create(bool isDirectory) = 0; + virtual bool create(bool isDirectoryFlag) = 0; }; diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 24a8fb98ad..09ba3a1c83 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -443,7 +443,7 @@ Common::WriteStream *AmigaOSFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath(), true); } -bool AmigaOSFilesystemNode::create(bool isDirectory) { +bool AmigaOSFilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/amigaos4/amigaos4-fs.h b/backends/fs/amigaos4/amigaos4-fs.h index 3ed45d3f77..c86bb4c57a 100644 --- a/backends/fs/amigaos4/amigaos4-fs.h +++ b/backends/fs/amigaos4/amigaos4-fs.h @@ -116,7 +116,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); }; diff --git a/backends/fs/chroot/chroot-fs.cpp b/backends/fs/chroot/chroot-fs.cpp index be6805bbd8..ac7cde3398 100644 --- a/backends/fs/chroot/chroot-fs.cpp +++ b/backends/fs/chroot/chroot-fs.cpp @@ -108,7 +108,7 @@ Common::WriteStream *ChRootFilesystemNode::createWriteStream() { return _realNode->createWriteStream(); } -bool ChRootFilesystemNode::create(bool /*isDir*/) { +bool ChRootFilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/chroot/chroot-fs.h b/backends/fs/chroot/chroot-fs.h index e0ecc1c47e..76902bc92a 100644 --- a/backends/fs/chroot/chroot-fs.h +++ b/backends/fs/chroot/chroot-fs.h @@ -49,7 +49,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); private: static Common::String addPathComponent(const Common::String &path, const Common::String &component); diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 83b1295838..035178dbb4 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -211,7 +211,7 @@ Common::WriteStream *DSFileSystemNode::createWriteStream() { return Common::wrapBufferedWriteStream(stream, WRITE_BUFFER_SIZE); } -bool DSFileSystemNode::create(bool isDirectory) { +bool DSFileSystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } @@ -271,7 +271,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path) { _path = path; } -GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDir) { +GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDirectoryFlag) { //consolePrintf("'%s'",path.c_str()); int lastSlash = 3; @@ -284,7 +284,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDir) _displayName = Common::String(path.c_str() + lastSlash + 1); _path = path; _isValid = true; - _isDirectory = isDir; + _isDirectory = isDirectoryFlag; } @@ -398,7 +398,7 @@ Common::WriteStream *GBAMPFileSystemNode::createWriteStream() { return Common::wrapBufferedWriteStream(stream, WRITE_BUFFER_SIZE); } -bool GBAMPFileSystemNode::create(bool isDirectory) { +bool GBAMPFileSystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index 939d1a1555..12dd6d6a59 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -91,7 +91,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); /** * Returns the zip file this node points to. @@ -132,7 +132,7 @@ public: * @param path String with the path the new node should point to. * @param path true if path is a directory, false otherwise. */ - GBAMPFileSystemNode(const Common::String &path, bool isDirectory); + GBAMPFileSystemNode(const Common::String &path, bool isDirectoryFlag); /** * Copy constructor. @@ -157,7 +157,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); }; struct fileHandle { diff --git a/backends/fs/n64/n64-fs.cpp b/backends/fs/n64/n64-fs.cpp index d568500d30..5a131c0305 100644 --- a/backends/fs/n64/n64-fs.cpp +++ b/backends/fs/n64/n64-fs.cpp @@ -160,7 +160,7 @@ Common::WriteStream *N64FilesystemNode::createWriteStream() { return RomfsStream::makeFromPath(getPath(), true); } -bool N64FilesystemNode::create(bool isDirectory) { +bool N64FilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/n64/n64-fs.h b/backends/fs/n64/n64-fs.h index d520ad5be6..b2de8a4bc4 100644 --- a/backends/fs/n64/n64-fs.h +++ b/backends/fs/n64/n64-fs.h @@ -73,7 +73,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); }; #endif diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index ce5715210a..4434bcba97 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -253,10 +253,10 @@ Common::WriteStream *POSIXFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath(), true); } -bool POSIXFilesystemNode::create(bool isDir) { +bool POSIXFilesystemNode::create(bool isDirectoryFlag) { bool success; - if (isDir) { + if (isDirectoryFlag) { success = mkdir(_path.c_str(), 0755) == 0; } else { int fd = open(_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0755); @@ -270,12 +270,12 @@ bool POSIXFilesystemNode::create(bool isDir) { if (success) { setFlags(); if (_isValid) { - if (_isDirectory != isDir) warning("failed to create %s: got %s", isDir ? "directory" : "file", _isDirectory ? "directory" : "file"); - return _isDirectory == isDir; + if (_isDirectory != isDirectoryFlag) warning("failed to create %s: got %s", isDirectoryFlag ? "directory" : "file", _isDirectory ? "directory" : "file"); + return _isDirectory == isDirectoryFlag; } warning("POSIXFilesystemNode: %s() was a success, but stat indicates there is no such %s", - isDir ? "mkdir" : "creat", isDir ? "directory" : "file"); + isDirectoryFlag ? "mkdir" : "creat", isDirectoryFlag ? "directory" : "file"); return false; } diff --git a/backends/fs/posix/posix-fs.h b/backends/fs/posix/posix-fs.h index 4ebce7e9d9..5a6b6bd2bd 100644 --- a/backends/fs/posix/posix-fs.h +++ b/backends/fs/posix/posix-fs.h @@ -73,7 +73,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); private: /** diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index 8391e063a0..eba740e948 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -441,7 +441,7 @@ Common::WriteStream *Ps2FilesystemNode::createWriteStream() { return PS2FileStream::makeFromPath(getPath(), true); } -bool Ps2FilesystemNode::create(bool isDirectory) { +bool Ps2FilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/ps2/ps2-fs.h b/backends/fs/ps2/ps2-fs.h index c9da434535..ca476eca9f 100644 --- a/backends/fs/ps2/ps2-fs.h +++ b/backends/fs/ps2/ps2-fs.h @@ -96,7 +96,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); int getDev() { return 0; } }; diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index 6bd5e93435..c69592ea99 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -239,7 +239,7 @@ Common::WriteStream *PSPFilesystemNode::createWriteStream() { return Common::wrapBufferedWriteStream(stream, WRITE_BUFFER_SIZE); } -bool PSPFilesystemNode::create(bool isDirectory) { +bool PSPFilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/psp/psp-fs.h b/backends/fs/psp/psp-fs.h index 648544650b..47c6d04a70 100644 --- a/backends/fs/psp/psp-fs.h +++ b/backends/fs/psp/psp-fs.h @@ -65,7 +65,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); }; #endif diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index e4163caa33..c6d5cc4955 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -232,7 +232,7 @@ Common::WriteStream *SymbianFilesystemNode::createWriteStream() { return SymbianStdioStream::makeFromPath(getPath(), true); } -bool SymbianFilesystemNode::create(bool isDirectory) { +bool SymbianFilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/symbian/symbian-fs.h b/backends/fs/symbian/symbian-fs.h index 1327f9f2e9..0f8212035f 100644 --- a/backends/fs/symbian/symbian-fs.h +++ b/backends/fs/symbian/symbian-fs.h @@ -66,7 +66,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); }; #endif diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index e036b75019..c3fdbc07b2 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -213,7 +213,7 @@ Common::WriteStream *WiiFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath(), true); } -bool WiiFilesystemNode::create(bool isDirectory) { +bool WiiFilesystemNode::create(bool isDirectoryFlag) { error("Not supported"); return false; } diff --git a/backends/fs/wii/wii-fs.h b/backends/fs/wii/wii-fs.h index affb765884..491c8d1d2c 100644 --- a/backends/fs/wii/wii-fs.h +++ b/backends/fs/wii/wii-fs.h @@ -69,7 +69,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); }; #endif diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index b43686f911..caf0e31360 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -244,10 +244,10 @@ Common::WriteStream *WindowsFilesystemNode::createWriteStream() { return StdioStream::makeFromPath(getPath(), true); } -bool WindowsFilesystemNode::create(bool isDirectory) { +bool WindowsFilesystemNode::create(bool isDirectoryFlag) { bool success; - if (isDirectory) { + if (isDirectoryFlag) { success = CreateDirectory(toUnicode(_path.c_str()), NULL) != 0; } else { success = CreateFile(toUnicode(_path.c_str()), GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) != INVALID_HANDLE_VALUE; @@ -264,12 +264,12 @@ bool WindowsFilesystemNode::create(bool isDirectory) { _path += '\\'; } - if (_isDirectory != isDirectory) warning("failed to create %s: got %s", isDirectory ? "directory" : "file", _isDirectory ? "directory" : "file"); - return _isDirectory == isDirectory; + if (_isDirectory != isDirectoryFlag) warning("failed to create %s: got %s", isDirectoryFlag ? "directory" : "file", _isDirectory ? "directory" : "file"); + return _isDirectory == isDirectoryFlag; } warning("WindowsFilesystemNode: Create%s() was a success, but GetFileAttributes() indicates there is no such %s", - isDirectory ? "Directory" : "File", isDirectory ? "directory" : "file"); + isDirectoryFlag ? "Directory" : "File", isDirectoryFlag ? "directory" : "file"); return false; } diff --git a/backends/fs/windows/windows-fs.h b/backends/fs/windows/windows-fs.h index 7c9f2c1e1a..3758877f05 100644 --- a/backends/fs/windows/windows-fs.h +++ b/backends/fs/windows/windows-fs.h @@ -88,7 +88,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream(); - virtual bool create(bool isDirectory); + virtual bool create(bool isDirectoryFlag); private: /** diff --git a/backends/networking/curl/networkreadstream.cpp b/backends/networking/curl/networkreadstream.cpp index b4516701a7..4da18ce311 100644 --- a/backends/networking/curl/networkreadstream.cpp +++ b/backends/networking/curl/networkreadstream.cpp @@ -228,19 +228,19 @@ Common::String NetworkReadStream::responseHeaders() const { } uint32 NetworkReadStream::fillWithSendingContents(char *bufferToFill, uint32 maxSize) { - uint32 size = _sendingContentsSize - _sendingContentsPos; - if (size > maxSize) - size = maxSize; - for (uint32 i = 0; i < size; ++i) { + uint32 sendSize = _sendingContentsSize - _sendingContentsPos; + if (sendSize > maxSize) + sendSize = maxSize; + for (uint32 i = 0; i < sendSize; ++i) { bufferToFill[i] = _sendingContentsBuffer[_sendingContentsPos + i]; } - _sendingContentsPos += size; - return size; + _sendingContentsPos += sendSize; + return sendSize; } -uint32 NetworkReadStream::addResponseHeaders(char *buffer, uint32 size) { - _responseHeaders += Common::String(buffer, size); - return size; +uint32 NetworkReadStream::addResponseHeaders(char *buffer, uint32 bufferSize) { + _responseHeaders += Common::String(buffer, bufferSize); + return bufferSize; } double NetworkReadStream::getProgress() const { diff --git a/backends/networking/curl/networkreadstream.h b/backends/networking/curl/networkreadstream.h index 62a3e41d9b..275d8dbd79 100644 --- a/backends/networking/curl/networkreadstream.h +++ b/backends/networking/curl/networkreadstream.h @@ -128,7 +128,7 @@ public: * * @returns how many bytes were actually read */ - uint32 addResponseHeaders(char *buffer, uint32 size); + uint32 addResponseHeaders(char *buffer, uint32 bufferSize); /** Returns a number in range [0, 1], where 1 is "complete". */ double getProgress() const; |
