a/util: Guard against bad defs of "max"

This commit is contained in:
Ryan Pavlik 2022-07-20 14:31:03 -05:00
parent b37a89e312
commit 842c160c49

View file

@ -88,7 +88,7 @@ public:
push_back(const char *str) push_back(const char *str)
{ {
if (vec.size() > std::numeric_limits<uint32_t>::max() - 1) { if (vec.size() > (std::numeric_limits<uint32_t>::max)() - 1) {
throw std::out_of_range("Size limit reached"); throw std::out_of_range("Size limit reached");
} }
if (str == nullptr) { if (str == nullptr) {
@ -146,7 +146,7 @@ public:
bool bool
push_back_unique(const char *str) push_back_unique(const char *str)
{ {
if (vec.size() > std::numeric_limits<uint32_t>::max() - 1) { if (vec.size() > (std::numeric_limits<uint32_t>::max)() - 1) {
throw std::out_of_range("Size limit reached"); throw std::out_of_range("Size limit reached");
} }
if (str == nullptr) { if (str == nullptr) {