[Scummvm-git-logs] scummvm master -> 57836da5bbdee0aa28fe9dae4f3b5290c48cc7e5

sev- sev at scummvm.org
Tue Jul 27 21:01:27 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:
57836da5bb DEVTOOLS: Reduce code duplication in dumper-companion.pl


Commit: 57836da5bbdee0aa28fe9dae4f3b5290c48cc7e5
    https://github.com/scummvm/scummvm/commit/57836da5bbdee0aa28fe9dae4f3b5290c48cc7e5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-27T23:00:41+02:00

Commit Message:
DEVTOOLS: Reduce code duplication in dumper-companion.pl

Changed paths:
    devtools/dumper-companion.pl


diff --git a/devtools/dumper-companion.pl b/devtools/dumper-companion.pl
index 8439972bc3..6ac3031ed9 100644
--- a/devtools/dumper-companion.pl
+++ b/devtools/dumper-companion.pl
@@ -38,6 +38,7 @@ sub processIso($);
 sub processMacbinary();
 sub decode_punycode;
 sub encode_punycode;
+sub encode_punycodefilename;
 
 getopts('hmf:c:ed');
 
@@ -93,14 +94,7 @@ sub processIso($) {
 			}
 
 			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;
-				}
+				$dir = encode_punycodefilename $dir;
 			}
 			# Replace Mac separators with *nix
 			$dir =~ s/:/\//g;
@@ -120,14 +114,7 @@ sub processIso($) {
 				}
 
 				if ($::opt_e) {
-					# make 0x81 an escape symbol
-					$decfname =~ s/\x81/\x81\x79/g;
-					# escape non-printables, '/', '"' and ':'
-					$decfname =~ s/([\x00-\x1f\/":])/\x81@{[chr(ord($1) + 0x80)]}/g;
-
-					if ($decfname =~ /[\x80-\xff]/) {
-						$decfname = encode_punycode $decfname;
-					}
+					$decfname = encode_punycodefilename	$decfname;
 				}
 
 				print " " x $prevlen;
@@ -330,3 +317,17 @@ sub encode_punycode {
     }
     return 'xn--' . $output;
 }
+
+sub encode_punycodefilename {
+	my $decfname = shift;
+
+	$decfname =~ s/\x81/\x81\x79/g;
+	# escape non-printables, '/', '"' and ':'
+	$decfname =~ s/([\x00-\x1f\/":])/\x81@{[chr(ord($1) + 0x80)]}/g;
+
+	if ($decfname =~ /[\x80-\xff]/) {
+		$decfname = encode_punycode $decfname;
+	}
+
+	return $decfname;
+}




More information about the Scummvm-git-logs mailing list