[Scummvm-git-logs] scummvm master -> de891e47293ed779143d05130a6a8d8aa958742a

lephilousophe noreply at scummvm.org
Sat Jun 8 09:16:16 UTC 2024


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3db0eef3d3 DLC: Fix signedness warnings
7c1b35f84c DLC: Fix build following changes to networking code API
de891e4729 DLC: Fix build following Path changes


Commit: 3db0eef3d35da097e522b354660723dd8c23b310
    https://github.com/scummvm/scummvm/commit/3db0eef3d35da097e522b354660723dd8c23b310
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-06-08T11:15:57+02:00

Commit Message:
DLC: Fix signedness warnings

Changed paths:
    backends/dlc/dlcmanager.cpp
    backends/dlc/dlcmanager.h
    gui/dlcsdialog.cpp
    gui/downloaddlcsdialog.cpp


diff --git a/backends/dlc/dlcmanager.cpp b/backends/dlc/dlcmanager.cpp
index e48d60c5603..b5f70d41212 100644
--- a/backends/dlc/dlcmanager.cpp
+++ b/backends/dlc/dlcmanager.cpp
@@ -121,7 +121,7 @@ Common::String DLCManager::getCurrentDownloadingDLC() const {
 	return _currentDownloadingDLC;
 }
 
-int DLCManager::getDLCIdxFromId(const Common::String &id) const {
+uint DLCManager::getDLCIdxFromId(const Common::String &id) const {
 	for (uint32 i = 0; i < _dlcs.size(); ++i) {
 		if (_dlcs[i]->id == id) return i;
 	}
diff --git a/backends/dlc/dlcmanager.h b/backends/dlc/dlcmanager.h
index 8cb2b4f2621..e169b1c3c54 100644
--- a/backends/dlc/dlcmanager.h
+++ b/backends/dlc/dlcmanager.h
@@ -82,7 +82,7 @@ public:
 
 	Common::String getCurrentDownloadingDLC() const;
 
-	int getDLCIdxFromId(const Common::String &id) const;
+	uint getDLCIdxFromId(const Common::String &id) const;
 
 	void startDownloadAsync(const Common::String &id, const Common::String &url);
 };
diff --git a/gui/dlcsdialog.cpp b/gui/dlcsdialog.cpp
index bbd30e7aebb..3c7bf833e2b 100644
--- a/gui/dlcsdialog.cpp
+++ b/gui/dlcsdialog.cpp
@@ -80,8 +80,8 @@ void DLCsDialog::refreshDLCList() {
 	for (Common::ConfigManager::DomainMap::iterator domain = ConfMan.beginGameDomains(); domain != ConfMan.endGameDomains(); ++domain) {
 		if (domain->_value.contains("download")) {
 			Common::String id = domain->_value.getVal("download");
-			int idx = DLCMan.getDLCIdxFromId(id);
-			if (idx != -1 && idx < games.size()) {
+			uint idx = DLCMan.getDLCIdxFromId(id);
+			if (idx != -1u && idx < games.size()) {
 				games[idx] = "\001C{alternate}" + games[idx];
 			}
 		}
diff --git a/gui/downloaddlcsdialog.cpp b/gui/downloaddlcsdialog.cpp
index d7ee14025a7..35c86dce286 100644
--- a/gui/downloaddlcsdialog.cpp
+++ b/gui/downloaddlcsdialog.cpp
@@ -113,7 +113,7 @@ void DownloadDLCsDialog::refreshWidgets() {
 }
 
 void DownloadDLCsDialog::handleTickle() {
-	uint32 progress = getDownloadingProgress();
+	int32 progress = getDownloadingProgress();
 
 	if (_progressBar->getValue() != progress) {
 		_selectedIdx = _pendingDownloadsList->getSelected();


Commit: 7c1b35f84c43ce3df30528d10b77a81ce24a5e01
    https://github.com/scummvm/scummvm/commit/7c1b35f84c43ce3df30528d10b77a81ce24a5e01
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-06-08T11:15:57+02:00

Commit Message:
DLC: Fix build following changes to networking code API

Changed paths:
    backends/dlc/scummvmcloud.cpp
    backends/dlc/scummvmcloud.h


diff --git a/backends/dlc/scummvmcloud.cpp b/backends/dlc/scummvmcloud.cpp
index 69fd4d34fd4..29f1df5947e 100644
--- a/backends/dlc/scummvmcloud.cpp
+++ b/backends/dlc/scummvmcloud.cpp
@@ -44,8 +44,8 @@
 namespace DLC {
 namespace ScummVMCloud {
 
-void ScummVMCloud::jsonCallbackGetAllDLCs(Networking::JsonResponse response) {
-	Common::JSONValue *json = (Common::JSONValue *)response.value;
+void ScummVMCloud::jsonCallbackGetAllDLCs(const Networking::JsonResponse &response) {
+	const Common::JSONValue *json = response.value;
 	if (json == nullptr || !json->isObject()) {
 		return;
 	}
@@ -81,21 +81,21 @@ void ScummVMCloud::jsonCallbackGetAllDLCs(Networking::JsonResponse response) {
 	DLCMan.refreshDLCList();
 }
 
-void ScummVMCloud::errorCallbackGetAllDLCs(Networking::ErrorResponse error) {
+void ScummVMCloud::errorCallbackGetAllDLCs(const Networking::ErrorResponse &error) {
 	warning("JsonRequest Error - getAllDLCs");
 }
 
 void ScummVMCloud::getAllDLCs() {
 	Common::String url("https://scummvm-dlcs-default-rtdb.firebaseio.com/dlcs.json"); // temporary mock api
+	Networking::JsonCallback callback = new Common::Callback<ScummVMCloud, const Networking::JsonResponse &>(this, &ScummVMCloud::jsonCallbackGetAllDLCs);
+	Networking::ErrorCallback failureCallback = new Common::Callback<ScummVMCloud, const Networking::ErrorResponse &>(this, &ScummVMCloud::errorCallbackGetAllDLCs);
 	Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(
-		new Common::Callback<ScummVMCloud, Networking::JsonResponse>(this, &ScummVMCloud::jsonCallbackGetAllDLCs), 
-		new Common::Callback<ScummVMCloud, Networking::ErrorResponse>(this, &ScummVMCloud::errorCallbackGetAllDLCs), 
-		url);
+		callback, failureCallback, url);
 
 	request->execute();
 }
 
-void ScummVMCloud::downloadFileCallback(Networking::DataResponse r) {
+void ScummVMCloud::downloadFileCallback(const Networking::DataResponse &r) {
 	Networking::SessionFileResponse *response = static_cast<Networking::SessionFileResponse *>(r.value);
 	DLCMan._currentDownloadedSize += response->len;
 	if (DLCMan._interruptCurrentDownload) {
@@ -149,7 +149,7 @@ void ScummVMCloud::downloadFileCallback(Networking::DataResponse r) {
 	}
 }
 
-void ScummVMCloud::errorCallback(Networking::ErrorResponse error) {
+void ScummVMCloud::errorCallback(const Networking::ErrorResponse &error) {
 	// error downloading - start next download in queue
 	DLCMan._queuedDownloadTasks.front()->state = DLCDesc::kErrorDownloading;
 	DLCMan._queuedDownloadTasks.pop();
@@ -160,9 +160,9 @@ void ScummVMCloud::errorCallback(Networking::ErrorResponse error) {
 void ScummVMCloud::startDownloadAsync(const Common::String &id, const Common::String &url) {
 	Common::String localFile = normalizePath(ConfMan.get("dlcspath") + "/" + id, '/');
 
-	_rq = new Networking::SessionRequest(url, localFile,
-		new Common::Callback<ScummVMCloud, Networking::DataResponse>(this, &ScummVMCloud::downloadFileCallback),
-		new Common::Callback<ScummVMCloud, Networking::ErrorResponse>(this, &ScummVMCloud::errorCallback));
+	Networking::DataCallback callback = new Common::Callback<ScummVMCloud, const Networking::DataResponse &>(this, &ScummVMCloud::downloadFileCallback);
+	Networking::ErrorCallback failureCallback = new Common::Callback<ScummVMCloud, const Networking::ErrorResponse &>(this, &ScummVMCloud::errorCallback);
+	_rq = new Networking::SessionRequest(url, localFile, callback, failureCallback);
 
 	_rq->start();
 }
diff --git a/backends/dlc/scummvmcloud.h b/backends/dlc/scummvmcloud.h
index f7dd28c1e10..6663a46c3aa 100644
--- a/backends/dlc/scummvmcloud.h
+++ b/backends/dlc/scummvmcloud.h
@@ -55,13 +55,13 @@ public:
 	void addEntryToConfig(Common::Path gamePath);
 
 	// callback functions
-	void jsonCallbackGetAllDLCs(Networking::JsonResponse response);
+	void jsonCallbackGetAllDLCs(const Networking::JsonResponse &response);
 
-	void errorCallbackGetAllDLCs(Networking::ErrorResponse error);
+	void errorCallbackGetAllDLCs(const Networking::ErrorResponse &error);
 
-	void downloadFileCallback(Networking::DataResponse response);
+	void downloadFileCallback(const Networking::DataResponse &response);
 
-	void errorCallback(Networking::ErrorResponse error);
+	void errorCallback(const Networking::ErrorResponse &error);
 };
 
 } // End of namespace ScummVMCloud


Commit: de891e47293ed779143d05130a6a8d8aa958742a
    https://github.com/scummvm/scummvm/commit/de891e47293ed779143d05130a6a8d8aa958742a
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-06-08T11:15:57+02:00

Commit Message:
DLC: Fix build following Path changes

Changed paths:
    backends/dlc/scummvmcloud.cpp


diff --git a/backends/dlc/scummvmcloud.cpp b/backends/dlc/scummvmcloud.cpp
index 29f1df5947e..312e638a83f 100644
--- a/backends/dlc/scummvmcloud.cpp
+++ b/backends/dlc/scummvmcloud.cpp
@@ -123,7 +123,7 @@ void ScummVMCloud::downloadFileCallback(const Networking::DataResponse &r) {
 
 		// extract the downloaded zip
 		Common::String gameDir = Common::punycode_encodefilename(dlc->name);
-		Common::Path destPath = Common::Path(ConfMan.get("dlcspath")).appendComponent(gameDir);
+		Common::Path destPath(ConfMan.getPath("dlcspath").appendComponent(gameDir));
 		Common::Error error = extractZip(relativeFilePath, destPath);
 
 		// remove cache (the downloaded .zip)
@@ -158,7 +158,7 @@ void ScummVMCloud::errorCallback(const Networking::ErrorResponse &error) {
 }
 
 void ScummVMCloud::startDownloadAsync(const Common::String &id, const Common::String &url) {
-	Common::String localFile = normalizePath(ConfMan.get("dlcspath") + "/" + id, '/');
+	Common::Path localFile(ConfMan.getPath("dlcspath").appendComponent(id));
 
 	Networking::DataCallback callback = new Common::Callback<ScummVMCloud, const Networking::DataResponse &>(this, &ScummVMCloud::downloadFileCallback);
 	Networking::ErrorCallback failureCallback = new Common::Callback<ScummVMCloud, const Networking::ErrorResponse &>(this, &ScummVMCloud::errorCallback);
@@ -169,14 +169,14 @@ void ScummVMCloud::startDownloadAsync(const Common::String &id, const Common::St
 
 Common::Error ScummVMCloud::extractZip(const Common::Path &file, const Common::Path &destPath) {
 	Common::Archive *dataArchive = nullptr;
-	Common::Path dlcPath = Common::Path(ConfMan.get("dlcspath"));
+	Common::Path dlcPath(ConfMan.getPath("dlcspath"));
 	Common::FSNode *fs = new Common::FSNode(dlcPath.join(file));
 	Common::Error error = Common::kNoError;
 	if (fs->exists()) {
 		dataArchive = Common::makeZipArchive(*fs);
 		// dataArchive is nullptr if zip file is incomplete
 		if (dataArchive != nullptr) {
-			error = dataArchive->dumpArchive(destPath.toString());
+			error = dataArchive->dumpArchive(destPath);
 		} else {
 			error = Common::Error(Common::kCreatingFileFailed, DLCMan._queuedDownloadTasks.front()->name + "Archive is broken, please re-download");
 		}
@@ -188,12 +188,12 @@ Common::Error ScummVMCloud::extractZip(const Common::Path &file, const Common::P
 }
 
 void ScummVMCloud::removeCacheFile(const Common::Path &file) {
-	Common::Path dlcPath = Common::Path(ConfMan.get("dlcspath"));
+	Common::Path dlcPath(ConfMan.getPath("dlcspath"));
 	Common::Path fileToDelete = dlcPath.join(file);
 #if defined(POSIX)
-	unlink(fileToDelete.toString().c_str());
+	unlink(fileToDelete.toString(Common::Path::kNativeSeparator).c_str());
 #elif defined(WIN32)
-	_unlink(fileToDelete.toString().c_str());
+	_unlink(fileToDelete.toString(Common::Path::kNativeSeparator).c_str());
 #else
 	warning("ScummVMCloud::removeCacheFile(): Removing is unimplemented");
 #endif




More information about the Scummvm-git-logs mailing list