Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert four variable assignments to the usage of combined operators #340

Open
elfring opened this issue Dec 4, 2021 · 0 comments
Open

Comments

@elfring
Copy link

elfring commented Dec 4, 2021

馃憖 Some source code analysis tools can help to find opportunities for improving software components.
馃挱 I propose to increase the usage of combined operators accordingly.

diff --git a/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm b/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm
index 8548fcdc..4e618341 100644
--- a/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm
+++ b/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm
@@ -245,7 +245,7 @@ sub crypt (\$$){
 
     foreach my $block (@blocks) {
       if ($d) { # decrypting
-	$result .= $iv = $iv ^ $self->{'crypt'}->decrypt($block);
+	$result .= $iv ^= $self->{'crypt'}->decrypt($block);
 	$iv = $block unless $self->{pcbc};
       } else { # encrypting
 	$result .= $iv = $self->{'crypt'}->encrypt($iv ^ $block);
diff --git a/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm b/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm
index 5a7e5be1..56280a2b 100644
--- a/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm
+++ b/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm
@@ -510,7 +510,7 @@ sub bset {
         @{$self->{optsip}->type} = ();
         @{$self->{optsip}->len}  = ();
         @{$self->{optsip}->data} = ();
-        for(my $i=0; $i<=(@{${$self->{$proto_hdr}}[$n{$self->{proto}}]} - 2); $i = $i + 3) {
+        for(my $i=0; $i<=(@{${$self->{$proto_hdr}}[$n{$self->{proto}}]} - 2); $i += 3) {
             $self->{optsip}->type($j,
                 ${${$self->{$proto_hdr}}[$n{$self->{proto}}]}[$i]);
             $self->{optsip}->len($j,
@@ -529,7 +529,7 @@ sub bset {
             @{$self->{optstcp}->type} = ();
             @{$self->{optstcp}->len}  = ();
             @{$self->{optstcp}->data} = ();
-            for (my $i=0; $i<=(@{${$self->{tcphdr}}[18]} - 2); $i = $i + 3) {
+            for (my $i=0; $i<=(@{${$self->{tcphdr}}[18]} - 2); $i += 3) {
                 $self->{optstcp}->type($j,
                     ${${$self->{tcphdr}}[18]}[$i]);
                 $self->{optstcp}->len($j,
diff --git a/test/test-fwknop.pl b/test/test-fwknop.pl
index c3a13104..396c6293 100755
--- a/test/test-fwknop.pl
+++ b/test/test-fwknop.pl
@@ -1154,7 +1154,7 @@ if ($rerun_failed_mode) {
         } elsif ($line =~ /Run time: ([\d\.]+) minutes/) {
             my $total_elapsed_seconds = time() - $start_time;
             my $total_elapsed_minutes = sprintf "%.2f", ($total_elapsed_seconds / 60);
-            $total_elapsed_minutes = $total_elapsed_minutes + $1;
+            $total_elapsed_minutes += $1;
             &logr("    Run time: $total_elapsed_minutes minutes\n");
 
         } elsif ($line =~ /Run time: ([\d\.]+) seconds/) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant