[X2Go-Commits] [x2goserver] 25/30: x2goserver/lib/x2goupdateoptionsstring: fix parsing of transformation strings by replacing the switch statement with if statements.
git-admin at x2go.org
git-admin at x2go.org
Thu Dec 13 11:22:50 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goserver.
commit 0d086816198d5c55e8e1b2a34291f3d6ed744af6
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Dec 13 08:29:10 2018 +0100
x2goserver/lib/x2goupdateoptionsstring: fix parsing of transformation strings by replacing the switch statement with if statements.
"Fallthrough" doesn't mean the same thing as in C, apparently. Buyer
beware.
---
debian/changelog | 4 ++++
x2goserver/lib/x2goupdateoptionsstring | 36 +++++++++++++---------------------
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index e26f649..8ee6e8d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -59,6 +59,10 @@ x2goserver (4.1.0.4-0x2go1) UNRELEASED; urgency=medium
intermediate representation if we know that parsing failed.
- x2goserver/lib/x2goupdateoptionsstring: fix debug string and add another
one dumping the raw options string.
+ - x2goserver/lib/x2goupdateoptionsstring: fix parsing of transformation
+ strings by replacing the switch statement with if statements.
+ "Fallthrough" doesn't mean the same thing as in C, apparently. Buyer
+ beware.
* debian/control:
+ Build-depend upon lsb-release for distro version detection.
* debian/x2goserver.manpages:
diff --git a/x2goserver/lib/x2goupdateoptionsstring b/x2goserver/lib/x2goupdateoptionsstring
index 06d82a5..1521d3e 100755
--- a/x2goserver/lib/x2goupdateoptionsstring
+++ b/x2goserver/lib/x2goupdateoptionsstring
@@ -28,7 +28,6 @@ use English qw (-no_match_vars);
use Getopt::Long qw (GetOptionsFromArray);
use Pod::Usage;
use Storable qw (dclone);
-use Switch qw (fallthrough);
use Data::Dumper qw (Dumper);
exit (Main (@ARGV));
@@ -645,28 +644,21 @@ sub interpret_transform {
# Check if non-empty, empty transform strings can only mean an
# append/modify operation.
if ($transform) {
- switch (substr ($transform, 0, 1)) {
- case (q{-}) {
- # Option starts with a dash, so must be a removal
- # operation.
- $mode = 1;
- }
- case (q{+}) {
- # Options starting with a plus character are add/modify
- # operations. The default mode option here is fine, but
- # we'll need to strip the initial character.
- # Careful: switch-fallthrough, even for the previous
- # case(s)!
- $sanitized_transform = substr ($sanitized_transform, 1);
- last;
- }
- else {
- # Everything else does not feature an explicit modifier,
- # so we can take the transformation string verbatim.
- # No need to actually do anything here, handled by the
- # initialization.
- }
+ if (q{-} eq substr ($transform, 0, 1)) {
+ # Option starts with a dash, so must be a removal operation.
+ $mode = 1;
+ $sanitized_transform = substr ($sanitized_transform, 1);
}
+ elsif ((q{+}) eq substr ($transform, 0, 1)) {
+ # Options starting with a plus character are add/modify operations. The
+ # default mode option here is fine, but we'll need to strip the initial
+ # character.
+ $sanitized_transform = substr ($sanitized_transform, 1);
+ }
+
+ # Everything else does not feature an explicit modifier, so we can take
+ # the transformation string verbatim.
+ # No need to actually do anything here, handled by the initialization.
}
# Set up return value accordingly.
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
More information about the x2go-commits
mailing list