commit 0aaf6ac: [Minor] Css: Fix colors parsing

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Jul 7 13:35:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-07 14:30:22 +0100
URL: https://github.com/rspamd/rspamd/commit/0aaf6ac2c1e8aaf9fe53a64cbb5ec06586fa9ccd (HEAD -> master)

[Minor] Css: Fix colors parsing

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

diff --git a/src/libserver/css/css_value.cxx b/src/libserver/css/css_value.cxx
index ec44b86a6..799d5f8ef 100644
--- a/src/libserver/css/css_value.cxx
+++ b/src/libserver/css/css_value.cxx
@@ -110,14 +110,14 @@ constexpr static inline auto rgb_color_component_convert(const css_parser_token
 			ret = (std::uint8_t) (dbl / 100.0 * 255.0);
 		}
 		else {
-			if (dbl > 1) {
-				dbl = 1;
+			if (dbl > 255) {
+				dbl = 255;
 			}
 			else if (dbl < 0) {
 				dbl = 0;
 			}
 
-			ret = (std::uint8_t) (dbl * 255.0);
+			ret = (std::uint8_t) (dbl);
 		}
 	}
 


More information about the Commits mailing list