From c10885e5f9cd6c4413d6e9ec4cc6fe218a1af7f4 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Tue, 2 Aug 2022 19:36:25 -0700 Subject: [PATCH] btest portability fix address review comment about shifting corner-case --- src/Expr.cc | 6 +++--- testing/btest/bifs/piped_exec.zeek | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Expr.cc b/src/Expr.cc index 918e5f1c14..ee855dad70 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -963,10 +963,10 @@ ValPtr BinaryExpr::Fold(Val* v1, Val* v2) const { if ( is_integral ) { - if ( i1 < 1 ) + if ( i1 < 0 ) RuntimeError("left shifting a negative number is undefined"); - i3 = i1 << i2; + i3 = i1 << static_cast(i2); } else if ( is_unsigned ) @@ -979,7 +979,7 @@ ValPtr BinaryExpr::Fold(Val* v1, Val* v2) const case EXPR_RSHIFT: { if ( is_integral ) - i3 = i1 >> i2; + i3 = i1 >> static_cast(i2); else if ( is_unsigned ) u3 = u1 >> u2; diff --git a/testing/btest/bifs/piped_exec.zeek b/testing/btest/bifs/piped_exec.zeek index c77a74292f..d33f902e5e 100644 --- a/testing/btest/bifs/piped_exec.zeek +++ b/testing/btest/bifs/piped_exec.zeek @@ -8,7 +8,7 @@ cmds = string_cat(cmds, "\nprint \"foobar\";"); # If we're using generated C++, turn that off for the pipe execution, # as otherwise we'll get a complaint that there's no corresponding # C++ bodies found for that zeek instance. -if ( piped_exec("export -n ZEEK_USE_CPP; zeek", cmds) != T ) +if ( piped_exec("unset ZEEK_USE_CPP; zeek", cmds) != T ) exit(1); # Test null output.