[Scummvm-git-logs] scummvm master -> a60e144e1e3b2979013a8339955e8a899d4ed544
djsrv
dservilla at gmail.com
Sun Aug 22 17:20:05 UTC 2021
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:
7b71e617f6 COMMON: Fully remove old punycode path functions
ad6f533175 COMMON: Fix punycode encoder/decoder
a60e144e1e DIRECTOR: Fix punycode in detection tables
Commit: 7b71e617f6bdf001af444520e3fe7687ea707493
https://github.com/scummvm/scummvm/commit/7b71e617f6bdf001af444520e3fe7687ea707493
Author: djsrv (dservilla at gmail.com)
Date: 2021-08-22T11:45:02-04:00
Commit Message:
COMMON: Fully remove old punycode path functions
Changed paths:
common/punycode.cpp
common/punycode.h
diff --git a/common/punycode.cpp b/common/punycode.cpp
index 7d271a1ed7..d344ccb363 100644
--- a/common/punycode.cpp
+++ b/common/punycode.cpp
@@ -317,19 +317,6 @@ String punycode_encodefilename(const String src) {
return punycode_encode(dst);
}
-String punycode_encodepath(const String src) {
- StringTokenizer tok(src, "/");
- String res;
-
- while (!tok.empty()) {
- res += punycode_encodefilename(tok.nextToken());
- if (!tok.empty())
- res += '/';
- }
-
- return res;
-}
-
String punycode_decodefilename(const String src1) {
String dst;
String src = punycode_decode(src1);
diff --git a/common/punycode.h b/common/punycode.h
index 3933f9d9a0..4853966306 100644
--- a/common/punycode.h
+++ b/common/punycode.h
@@ -60,7 +60,6 @@ String punycode_encode(const String src);
String punycode_decode(const String src);
String punycode_encodefilename(const String src1);
-String punycode_encodepath(const String src);
/**
* Convert Punycode filename to Binary using special 0x81 escape character. Returns the decoded string
@@ -68,12 +67,12 @@ String punycode_encodepath(const String src);
String punycode_decodefilename(const String src1);
/**
- * Convert path with '/' as separators from Punycode
+ * Convert path from Punycode
*/
Path punycode_decodepath(const Path &src);
/**
- * Convert path to Punycode with '/' as separators
+ * Convert path to Punycode
*/
Path punycode_encodepath(const Path &src);
Commit: ad6f533175dc85c871202ef5a7006c37b8f0aebb
https://github.com/scummvm/scummvm/commit/ad6f533175dc85c871202ef5a7006c37b8f0aebb
Author: djsrv (dservilla at gmail.com)
Date: 2021-08-22T13:11:26-04:00
Commit Message:
COMMON: Fix punycode encoder/decoder
These need to use Unicode code points, not raw bytes.
Changed paths:
common/punycode.cpp
common/punycode.h
diff --git a/common/punycode.cpp b/common/punycode.cpp
index d344ccb363..c9484af402 100644
--- a/common/punycode.cpp
+++ b/common/punycode.cpp
@@ -57,7 +57,7 @@ namespace Common {
#define DAMP 700
#define INITIAL_N 128
#define INITIAL_BIAS 72
-#define SMAX 0x7fff
+#define SMAX 0x10ffff // maximum Unicode code point
#define SPECIAL_SYMBOLS "/\":*[]+|\\?%<>,;="
@@ -129,19 +129,19 @@ static size_t decode_digit(uint32 v) {
return SMAX;
}
-String punycode_encode(String src) {
- int srclen = src.size();
- int h = 0, si;
+String punycode_encode(U32String src) {
+ size_t srclen = src.size();
+ size_t h = 0, si;
String dst;
for (si = 0; si < srclen; si++) {
- if ((byte)src[si] < 128) {
+ if (src[si] < 128) {
dst += src[si];
h++;
}
}
- int b = h;
+ size_t b = h;
/* Write out delimiter if any basic code points were processed. */
if (h != srclen) {
@@ -150,16 +150,16 @@ String punycode_encode(String src) {
return src;
}
- int n = INITIAL_N;
- int bias = INITIAL_BIAS;
- int delta = 0;
- int m;
+ size_t n = INITIAL_N;
+ size_t bias = INITIAL_BIAS;
+ size_t delta = 0;
+ size_t m;
for (; h < srclen; n++, delta++) {
/* Find next smallest non-basic code point. */
for (m = SMAX, si = 0; si < srclen; si++) {
- if ((byte)src[si] >= n && (byte)src[si] < m) {
- m = (byte)src[si];
+ if (src[si] >= n && src[si] < m) {
+ m = src[si];
}
}
@@ -173,13 +173,13 @@ String punycode_encode(String src) {
n = m;
for (si = 0; si < srclen; si++) {
- if ((byte)src[si] < n) {
+ if (src[si] < n) {
if (++delta == 0) {
/* OVERFLOW */
warning("punycode_encode: overflow2");
return src;
}
- } else if ((byte)src[si] == n) {
+ } else if (src[si] == n) {
dst += encode_var_int(bias, delta);
bias = adapt_bias(delta, h + 1, h == b);
delta = 0;
@@ -206,7 +206,7 @@ bool punycode_needEncode(const String src) {
return false;
}
-String punycode_decode(const String src1) {
+U32String punycode_decode(const String src1) {
if (!src1.hasPrefix("xn--"))
return src1;
@@ -225,7 +225,7 @@ String punycode_decode(const String src1) {
if (di == String::npos)
return src;
- String dst;
+ U32String dst;
for (size_t i = 0; i < di; i++) {
dst += src[i];
@@ -288,9 +288,9 @@ String punycode_decode(const String src1) {
n += i / (di + 1);
i %= (di + 1);
- String dst1(dst.c_str(), i);
- dst1 += (char )n;
- dst1 += String(&dst.c_str()[i]);
+ U32String dst1(dst.c_str(), i);
+ dst1 += (u32char_type_t)n;
+ dst1 += U32String(&dst.c_str()[i]);
dst = dst1;
i++;
}
@@ -298,17 +298,17 @@ String punycode_decode(const String src1) {
return dst;
}
-String punycode_encodefilename(const String src) {
- String dst;
+String punycode_encodefilename(const U32String src) {
+ U32String dst;
for (uint i = 0; i < src.size(); i++) {
- if ((byte)src[i] == 0x81) { // In case we have our escape character present
- dst += '\x81';
- dst += '\x79';
+ if (src[i] == 0x81) { // In case we have our escape character present
+ dst += 0x81;
+ dst += 0x79;
// Encode special symbols and non-printables
- } else if (strchr(SPECIAL_SYMBOLS, src[i]) || (byte)src[i] < 0x20) {
- dst += '\x81';
- dst += (byte)src[i] + '\x80';
+ } else if ((src[i] < 0x80 && strchr(SPECIAL_SYMBOLS, (byte)src[i])) || src[i] < 0x20) {
+ dst += 0x81;
+ dst += src[i] + 0x80;
} else {
dst += src[i];
}
@@ -317,9 +317,9 @@ String punycode_encodefilename(const String src) {
return punycode_encode(dst);
}
-String punycode_decodefilename(const String src1) {
- String dst;
- String src = punycode_decode(src1);
+U32String punycode_decodefilename(const String src1) {
+ U32String dst;
+ U32String src = punycode_decode(src1);
// Check if the string did not change which could be
// also on decoding failure
@@ -327,12 +327,12 @@ String punycode_decodefilename(const String src1) {
return src;
for (uint i = 0; i < src.size(); i++) {
- if ((byte)src[i] == 0x81 && i + 1 < src.size()) {
+ if (src[i] == 0x81 && i + 1 < src.size()) {
i++;
if (src[i] == 0x79)
- dst += '\x81';
+ dst += 0x81;
else
- dst += (byte)src[i] - '\x80';
+ dst += src[i] - 0x80;
} else {
dst += src[i];
}
diff --git a/common/punycode.h b/common/punycode.h
index 4853966306..0143f73c42 100644
--- a/common/punycode.h
+++ b/common/punycode.h
@@ -50,21 +50,21 @@
namespace Common {
/**
- * Convert Binary to Punycode. Returns the encoded string.
+ * Convert UTF-32 to Punycode. Returns the encoded string.
*/
-String punycode_encode(const String src);
+String punycode_encode(const U32String src);
/**
- * Convert Punycode to Binary. Returns the decoded string
+ * Convert Punycode to UTF-32. Returns the decoded string
*/
-String punycode_decode(const String src);
+U32String punycode_decode(const String src);
-String punycode_encodefilename(const String src1);
+String punycode_encodefilename(const U32String src1);
/**
* Convert Punycode filename to Binary using special 0x81 escape character. Returns the decoded string
*/
-String punycode_decodefilename(const String src1);
+U32String punycode_decodefilename(const String src1);
/**
* Convert path from Punycode
Commit: a60e144e1e3b2979013a8339955e8a899d4ed544
https://github.com/scummvm/scummvm/commit/a60e144e1e3b2979013a8339955e8a899d4ed544
Author: djsrv (dservilla at gmail.com)
Date: 2021-08-22T13:16:13-04:00
Commit Message:
DIRECTOR: Fix punycode in detection tables
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index cc9c981412..78a7468eaa 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -1035,9 +1035,9 @@ static const DirectorGameDescription gameDescriptions[] = {
},
// Original filename is "â¢Main Menu" for all
- MACGAME1("theapartment", "D2", "xn--Main Menu-a88aqz", "fc56c179cb8c6d4938e61ee61fd0032c", 48325, 200),
- MACGAME1("theapartment", "D3", "xn--Main Menu-a88aqz", "9e838fe1a6af7992d656ca325e38dee5", 47911, 300),
- MACGAME1("theapartment", "D4", "xn--Main Menu-a88aqz", "ff86181f03fe6eb060f65a985ca0580d", 160612, 400),
+ MACGAME1("theapartment", "D2", "xn--Main Menu-zd0e", "fc56c179cb8c6d4938e61ee61fd0032c", 48325, 200),
+ MACGAME1("theapartment", "D3", "xn--Main Menu-zd0e", "9e838fe1a6af7992d656ca325e38dee5", 47911, 300),
+ MACGAME1("theapartment", "D4", "xn--Main Menu-zd0e", "ff86181f03fe6eb060f65a985ca0580d", 160612, 400),
//////////////////////////////////////////////////
//
@@ -1144,8 +1144,8 @@ static const DirectorGameDescription gameDescriptions[] = {
MACGAME1_l("tri3dtrial", "", "Tri-3D-Trial", "cfa68a1bc49251497ebde18e5fc9c217", 271223, Common::JA_JPN, 200),
// Original file name is Spaceship Warlockâ¢
- MACGAME1("warlock", "v1.0", "Spaceship Warlock", "cfa68a1bc49251497ebde18e5fc9c217", 271093, 200),
- MACGAME1("warlock", "v1.1.1", "Spaceship Warlock", "cfa68a1bc49251497ebde18e5fc9c217", 271107, 200),
+ MACGAME1("warlock", "v1.0", "xn--Spaceship Warlock-306j", "cfa68a1bc49251497ebde18e5fc9c217", 271093, 200),
+ MACGAME1("warlock", "v1.1.1", "xn--Spaceship Warlock-306j", "cfa68a1bc49251497ebde18e5fc9c217", 271107, 200),
MACDEMO1("warlock", "v1.0 Demo", "Spaceship Warlock Demo", "cfa68a1bc49251497ebde18e5fc9c217", 271099, 200),
MACDEMO1("warlock", "v1.1.1 Demo", "SS Warlock Movie Trailer", "cfa68a1bc49251497ebde18e5fc9c217", 273377, 200),
@@ -2415,9 +2415,10 @@ static const DirectorGameDescription gameDescriptions[] = {
// Full game is not Director
WINDEMO1("mechwarrior2", "Demo", "MW2DEMO.EXE", "4a8fd0d74faef305bc935e1aac94d3e8", 712817, 400),
- MACGAME2("mediaband", "v1.0", "xn--Meet MediaBand-eca49b68a", "17efee018a660458fae80de4364021ac", 483774,
+ // Original file name is Meet MediaBandâ¢
+ MACGAME2("mediaband", "v1.0", "xn--Meet MediaBand-yk6h", "17efee018a660458fae80de4364021ac", 483774,
"title", "88e717a623bc2690d84a1246e512eaff", 2646636, 404),
- MACGAME2("mediaband", "v1.1", "xn--Meet MediaBand-eca49b68a", "17efee018a660458fae80de4364021ac", 483774,
+ MACGAME2("mediaband", "v1.1", "xn--Meet MediaBand-yk6h", "17efee018a660458fae80de4364021ac", 483774,
"title", "14a64b7999d909a23df7842cec65458c", 2752392, 404),
WINGAME1("mediaband", "v1.1", "MEDIABND.EXE", "0cfb9b4762e33ab56d656a0eb146a048", 717921, 404),
More information about the Scummvm-git-logs
mailing list