commit 8381b14: [Minor] Css: Fix bits operations

Vsevolod Stakhov vsevolod at highsecure.ru
Thu May 6 15:35:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-05-06 16:31:36 +0100
URL: https://github.com/rspamd/rspamd/commit/8381b141d52546897af76c0798ec5bda654a6104 (HEAD -> master)

[Minor] Css: Fix bits operations

---
 src/libserver/css/css_rule.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libserver/css/css_rule.cxx b/src/libserver/css/css_rule.cxx
index 02f33aa13..417770a08 100644
--- a/src/libserver/css/css_rule.cxx
+++ b/src/libserver/css/css_rule.cxx
@@ -56,7 +56,7 @@ void css_rule::override_values(const css_rule &other)
 	/* Copy only not set values */
 	std::copy_if(other.values.begin(), other.values.end(), std::back_inserter(values),
 			[&bits](const auto &elt) -> bool {
-				return !isset(&bits, static_cast<int>(elt.type));
+				return (bits & static_cast<int>(elt.type)) == 0;
 			});
 }
 
@@ -74,8 +74,8 @@ void css_rule::merge_values(const css_rule &other)
 	/* Copy only not set values */
 	std::copy_if(other.values.begin(), other.values.end(), std::back_inserter(values),
 			[&bits](const auto &elt) -> bool {
-		return !isset(&bits, static_cast<int>(elt.type));
-	});
+				return (bits & static_cast<int>(elt.type)) == 0;
+			});
 }
 
 auto css_declarations_block::add_rule(rule_shared_ptr rule) -> bool


More information about the Commits mailing list