Skip to content

Commit 5ce1f8c

Browse files
stertingenkenneth-jia
authored andcommitted
Wrap std::min in parens to avoid conflicts with macros
1 parent 6f70d1f commit 5ce1f8c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/kafka/Log.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct Log
3232
static const std::vector<std::string> levelNames = {"EMERG", "ALERT", "CRIT", "ERR", "WARNING", "NOTICE", "INFO", "DEBUG", "INVALID"};
3333
static const std::size_t maxIndex = levelNames.size() - 1;
3434

35-
return levelNames[std::min(level, maxIndex)];
35+
return levelNames[(std::min)(level, maxIndex)];
3636
}
3737
};
3838

@@ -57,7 +57,7 @@ class LogBuffer
5757
auto cnt = std::snprintf(_wptr, capacity(), format, args...); // returns number of characters written if successful (not including '\0')
5858
if (cnt > 0)
5959
{
60-
_wptr = std::min(_wptr + cnt, _buf.data() + MAX_CAPACITY - 1);
60+
_wptr = (std::min)(_wptr + cnt, _buf.data() + MAX_CAPACITY - 1);
6161
}
6262
return *this;
6363
}

tests/unit/TestUnorderedOffsetCommitQueue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ auto checkTimeMsConsumedToSortOffsets(std::size_t testNum, std::size_t step)
134134
std::mt19937 g(rd());
135135
for (std::size_t iBegin = 0; iBegin < ackSequence.size(); iBegin += step)
136136
{
137-
std::size_t iEnd = std::min(iBegin + step, ackSequence.size());
137+
std::size_t iEnd = (std::min)(iBegin + step, ackSequence.size());
138138
std::shuffle(ackSequence.begin() + static_cast<int64_t>(iBegin), ackSequence.begin() + static_cast<int64_t>(iEnd), g);
139139
}
140140

0 commit comments

Comments
 (0)