[Scummvm-git-logs] scummvm master -> 52690ca9305f9ff052f38ecf7a472c202326f73a
sev-
sev at scummvm.org
Wed Jul 21 20:30:47 UTC 2021
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:
52690ca930 DEVTOOLS: Encode file names with punycode in dumper-companion
Commit: 52690ca9305f9ff052f38ecf7a472c202326f73a
https://github.com/scummvm/scummvm/commit/52690ca9305f9ff052f38ecf7a472c202326f73a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-21T22:30:37+02:00
Commit Message:
DEVTOOLS: Encode file names with punycode in dumper-companion
Also, we are escaping some non-portable characters with 0x81.
More characters could be escaped.
Changed paths:
devtools/dumper-companion.pl
diff --git a/devtools/dumper-companion.pl b/devtools/dumper-companion.pl
index 0d01b3784a..452d92685f 100644
--- a/devtools/dumper-companion.pl
+++ b/devtools/dumper-companion.pl
@@ -86,11 +86,25 @@ sub processIso($) {
if (/^:/) {
$mdir = $_;
s/^://;
- s/:/\//g;
$dir = $_;
+
if ($::opt_c) {
$dir = encode_utf8(decode($::opt_c, $dir));
}
+
+ if ($::opt_e) {
+ # make 0x81 an escape symbol
+ $dir =~ s/\x81/\x81\x81/g;
+ # escape non-printables, '/', "'" and '"'
+ $dir =~ s/([\x00-\x1f\/'"])/\x81@{[chr(ord($1) + 0x80)]}/g;
+
+ if ($dir =~ /[\x80-\xff]/) {
+ $dir = encode_punycode $dir;
+ }
+ }
+ # Replace Mac separators with *nix
+ $dir =~ s/:/\//g;
+
mkdir "$dir";
$numdirs++;
} elsif (/^[fF]/) {
@@ -99,8 +113,6 @@ sub processIso($) {
my $data = $2;
my $fname = $3;
- $fname =~ s'/':'g; # Replace / with :
-
my $decfname = $fname;
if ($::opt_c) {
@@ -108,8 +120,13 @@ sub processIso($) {
}
if ($::opt_e) {
- if ($fname =~ /[\x80-\xff]/) {
- $decfname = encode_punycode $fname;
+ # make 0x81 an escape symbol
+ $decfname =~ s/\x81/\x81\x81/g;
+ # escape non-printables, '/', "'" and '"'
+ $decfname =~ s/([\x00-\x1f\/'"])/\x81@{[chr(ord($1) + 0x80)]}/g;
+
+ if ($decfname =~ /[\x80-\xff]/) {
+ $decfname = encode_punycode $decfname;
}
}
@@ -216,7 +233,7 @@ sub decode_punycode {
$input =~ s/^xn--//;
- if($input =~ s/(.*)$Delimiter//os) {
+ if ($input =~ s/(.*)$Delimiter//os) {
my $base_chars = $1;
croak("non-base character in input for decode_punycode")
if $base_chars =~ m/[^$BasicRE]/os;
@@ -229,7 +246,7 @@ sub decode_punycode {
utf8::downgrade($input); ## handling failure of downgrade is more expensive than
## doing the above regexp w/ utf8 semantics
- while(length $code) {
+ while (length $code) {
my $oldi = $i;
my $w = 1;
LOOP:
@@ -283,7 +300,7 @@ sub encode_punycode {
next if $m < $n;
$delta += ($m - $n) * ($h + 1);
$n = $m;
- for(my $i = 0; $i < $input_length; $i++) {
+ for (my $i = 0; $i < $input_length; $i++) {
my $c = $input[$i];
$delta++ if $c < $n;
if ($c == $n) {
More information about the Scummvm-git-logs
mailing list