fix clang-check warnings

This commit is contained in:
MihailRis
2025-01-01 16:06:44 +03:00
parent 4c23dc6adf
commit 17dcbe98ab
8 changed files with 8 additions and 12 deletions
+4 -4
View File
@@ -92,11 +92,11 @@ glm::vec4 Attribute::asColor() const {
throw std::runtime_error("#RRGGBB or #RRGGBBAA required");
}
int a = 255;
int r = (hexchar2int(text[1]) << 4) | hexchar2int(text[2]);
int g = (hexchar2int(text[3]) << 4) | hexchar2int(text[4]);
int b = (hexchar2int(text[5]) << 4) | hexchar2int(text[6]);
int r = (std::max(0, hexchar2int(text[1])) << 4) | hexchar2int(text[2]);
int g = (std::max(0, hexchar2int(text[3])) << 4) | hexchar2int(text[4]);
int b = (std::max(0, hexchar2int(text[5])) << 4) | hexchar2int(text[6]);
if (text.length() == 9) {
a = (hexchar2int(text[7]) << 4) | hexchar2int(text[8]);
a = (std::max(0, hexchar2int(text[7])) << 4) | hexchar2int(text[8]);
}
return glm::vec4(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
} else {