Skip to content

Commit

Permalink
Wrap std::min in parens to avoid conflicts with macros
Browse files Browse the repository at this point in the history
  • Loading branch information
stertingen authored and kenneth-jia committed Oct 11, 2022
1 parent 6f70d1f commit 5ce1f8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/kafka/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct Log
static const std::vector<std::string> levelNames = {"EMERG", "ALERT", "CRIT", "ERR", "WARNING", "NOTICE", "INFO", "DEBUG", "INVALID"};
static const std::size_t maxIndex = levelNames.size() - 1;

return levelNames[std::min(level, maxIndex)];
return levelNames[(std::min)(level, maxIndex)];
}
};

Expand All @@ -57,7 +57,7 @@ class LogBuffer
auto cnt = std::snprintf(_wptr, capacity(), format, args...); // returns number of characters written if successful (not including '\0')
if (cnt > 0)
{
_wptr = std::min(_wptr + cnt, _buf.data() + MAX_CAPACITY - 1);
_wptr = (std::min)(_wptr + cnt, _buf.data() + MAX_CAPACITY - 1);
}
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/TestUnorderedOffsetCommitQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ auto checkTimeMsConsumedToSortOffsets(std::size_t testNum, std::size_t step)
std::mt19937 g(rd());
for (std::size_t iBegin = 0; iBegin < ackSequence.size(); iBegin += step)
{
std::size_t iEnd = std::min(iBegin + step, ackSequence.size());
std::size_t iEnd = (std::min)(iBegin + step, ackSequence.size());
std::shuffle(ackSequence.begin() + static_cast<int64_t>(iBegin), ackSequence.begin() + static_cast<int64_t>(iEnd), g);
}

Expand Down

0 comments on commit 5ce1f8c

Please sign in to comment.