Skip to content

Commit a14a017

Browse files
committed
Don't use min from Windows.h
If `NOMINMAX` defined then this code will result in an error. Use ternary operator instead to avoid possible issue.
1 parent 6118c5a commit a14a017

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/callstack.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,14 +715,14 @@ VOID FastCallStack::getStackTrace (UINT32 maxdepth, const context_t& context)
715715
framePointer = (UINT_PTR*)*framePointer;
716716
}
717717
#elif defined(_M_X64)*/
718-
UINT32 maxframes = min(62, maxdepth + 10);
718+
UINT32 maxframes = (62 < maxdepth + 10) ? 62 : maxdepth + 10
719719
UINT_PTR* myFrames = new UINT_PTR[maxframes];
720720
ZeroMemory(myFrames, sizeof(UINT_PTR) * maxframes);
721721
ULONG BackTraceHash;
722722
maxframes = RtlCaptureStackBackTrace(0, maxframes, reinterpret_cast<PVOID*>(myFrames), &BackTraceHash);
723723
m_hashValue = BackTraceHash;
724724
UINT32 startIndex = 0;
725-
725+
726726
// Find the frame matching context.fp to skip VLD internal frames
727727
while (count < maxframes) {
728728
if (myFrames[count] == 0)
@@ -731,7 +731,7 @@ VOID FastCallStack::getStackTrace (UINT32 maxdepth, const context_t& context)
731731
startIndex = count;
732732
count++;
733733
}
734-
734+
735735
count = startIndex;
736736
while (count < maxframes) {
737737
if (myFrames[count] == 0)

0 commit comments

Comments
 (0)