[Scummvm-git-logs] scummvm master -> 30655b9cff304e6f15b59b33ae4aa0cdd1288fc6
sev-
noreply at scummvm.org
Mon Jul 21 10:06:46 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
3383edb038 COMMON: Add function to Path to know if path is Punycoded
30655b9cff ENGINES: Fix triple Punyencoding
Commit: 3383edb038b21f1dc4ce450c2f03509a86740717
https://github.com/scummvm/scummvm/commit/3383edb038b21f1dc4ce450c2f03509a86740717
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-07-21T12:06:43+02:00
Commit Message:
COMMON: Add function to Path to know if path is Punycoded
Only the prefix is checked and Punycode correctness is not.
Only use this function with known paths.
Changed paths:
common/path.cpp
common/path.h
diff --git a/common/path.cpp b/common/path.cpp
index 4fb1446a1df..658744b03a5 100644
--- a/common/path.cpp
+++ b/common/path.cpp
@@ -1083,6 +1083,18 @@ bool Path::punycodeNeedsEncode() const {
}, tmp);
}
+bool Path::punycodeIsEncoded() const {
+ bool tmp = false;
+ return reduceComponents<bool &>(
+ [](bool &result, const String &in, bool last) -> bool & {
+ // If we already are encoded, we still are
+ if (result) return result;
+
+ result = punycode_hasprefix(in);
+ return result;
+ }, tmp);
+}
+
// For a path component creates a string with following property:
// if 2 files have the same case-insensitive
// identifier string then and only then we treat them as
diff --git a/common/path.h b/common/path.h
index 0579646d642..e679b068fec 100644
--- a/common/path.h
+++ b/common/path.h
@@ -513,6 +513,14 @@ public:
*/
bool punycodeNeedsEncode() const;
+ /**
+ * Returns whether the path is already Punycoded
+ *
+ * Only the prefix is checked and not the Punycode correctness.
+ * Use this function only with known Punycoded paths.
+ */
+ bool punycodeIsEncoded() const;
+
/**
* Convert all characters in the path to lowercase.
*
Commit: 30655b9cff304e6f15b59b33ae4aa0cdd1288fc6
https://github.com/scummvm/scummvm/commit/30655b9cff304e6f15b59b33ae4aa0cdd1288fc6
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-07-21T12:06:43+02:00
Commit Message:
ENGINES: Fix triple Punyencoding
Matched files come from our detection tables and are either classic
paths or Punyencoded ones. If they are already Punyencoded, don't do it
a second time.
Then, don't Punyencode another time a file name which was already
Punycoded.
Changed paths:
engines/game.cpp
diff --git a/engines/game.cpp b/engines/game.cpp
index d4880bb001f..52ddf3b4a56 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -239,7 +239,12 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
// Consolidate matched files across all engines and detection entries
for (const auto &file : game.matchedFiles) {
- Common::String key = Common::String::format("%s:%s", md5PropToCachePrefix(file._value.md5prop).c_str(), file._key.punycodeEncode().toString('/').c_str());
+ Common::Path filename = file._key;
+ // Avoid double encoding of punycoded files
+ if (!filename.punycodeIsEncoded()) {
+ filename = filename.punycodeEncode();
+ }
+ Common::String key = Common::String::format("%s:%s", md5PropToCachePrefix(file._value.md5prop).c_str(), filename.toString('/').c_str());
matchedFiles.setVal(key, file._value);
}
}
@@ -271,7 +276,7 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
// Skip the md5 prefix and since we could have full paths, take it into account
Common::Path filepath(strchr(filenames[i].c_str(), ':') + 1);
report += Common::String::format(" {\"%s\", 0, \"%s%s\", %lld},\n",
- filepath.punycodeEncode().toString().c_str(),
+ filepath.toString().c_str(),
md5Prefix.c_str(), file.md5.c_str(), (long long)file.size);
}
More information about the Scummvm-git-logs
mailing list