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

lotharsm noreply at scummvm.org
Sun Jul 10 14:30:13 UTC 2022


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

Summary:
ed17bed4a5 GUI: Fix calculating size of previously downloaded icons files


Commit: ed17bed4a57c6ae5feeb3ee2dc204a1b27dd4432
    https://github.com/scummvm/scummvm/commit/ed17bed4a57c6ae5feeb3ee2dc204a1b27dd4432
Author: Lothar Serra Mari (mail at serra.me)
Date: 2022-07-10T16:11:11+02:00

Commit Message:
GUI: Fix calculating size of previously downloaded icons files

Changed paths:
    gui/downloadiconsdialog.cpp


diff --git a/gui/downloadiconsdialog.cpp b/gui/downloadiconsdialog.cpp
index ec311e86e1a..96f595b9d06 100644
--- a/gui/downloadiconsdialog.cpp
+++ b/gui/downloadiconsdialog.cpp
@@ -423,8 +423,6 @@ void DownloadIconsDialog::calculateList() {
 }
 
 void DownloadIconsDialog::clearCache() {
-	Common::String sizeUnits;
-
 	Common::String iconsPath = ConfMan.get("iconspath");
 	if (iconsPath.empty()) {
 		Common::U32String str(_("ERROR: No icons path set"));
@@ -437,6 +435,7 @@ void DownloadIconsDialog::clearCache() {
 	Common::ArchiveMemberList iconFiles;
 
 	iconDir->listMatchingMembers(iconFiles, "gui-icons*.dat");
+	int totalSize = 0;
 
 	for (auto ic = iconFiles.begin(); ic != iconFiles.end(); ++ic) {
 		Common::String fname = (*ic)->getName();
@@ -444,10 +443,11 @@ void DownloadIconsDialog::clearCache() {
 		uint32 size = str->size();
 		delete str;
 
-		g_state->totalSize += size;
+		totalSize += size;
 	}
 
-	Common::String size = getHumanReadableBytes(g_state->totalSize, sizeUnits);
+	Common::String sizeUnits;
+	Common::String size = getHumanReadableBytes(totalSize, sizeUnits);
 
 	GUI::MessageDialog dialog(Common::U32String::format(_("You are about to remove %s %s of data, deleting all previously downloaded icon files. Do you want to proceed?"), size.c_str(), sizeUnits.c_str()), _("Proceed"), _("Cancel"));
 	if (dialog.runModal() == ::GUI::kMessageOK) {




More information about the Scummvm-git-logs mailing list