From 5b0b6e8e2a8bbd7db683dda19a94b38dd45637e4 Mon Sep 17 00:00:00 2001 From: Daniel Belcher Date: Fri, 22 Mar 2019 00:14:43 -0700 Subject: [PATCH] - Disable use of min/max macros defined by Windows headers. --- src/CalcManager/Ratpack/conv.cpp | 2 +- src/CalcManager/Ratpack/logic.cpp | 4 ++-- src/CalcManager/Ratpack/ratpak.h | 2 +- src/CalcManager/pch.h | 6 +++++- src/CalcViewModel/pch.h | 4 ++++ src/Calculator/Controls/CalculationResult.cpp | 4 ++-- src/Calculator/pch.h | 4 ++++ src/CalculatorUnitTests/pch.h | 6 +++++- 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/CalcManager/Ratpack/conv.cpp b/src/CalcManager/Ratpack/conv.cpp index cfd2ec40..ca69b844 100644 --- a/src/CalcManager/Ratpack/conv.cpp +++ b/src/CalcManager/Ratpack/conv.cpp @@ -1271,7 +1271,7 @@ PNUMBER RatToNumber(_In_ PRAT prat, uint32_t radix, int32_t precision) // Convert p and q of rational form from internal base to requested base. // Scale by largest power of BASEX possible. long scaleby = min(temprat->pp->exp, temprat->pq->exp); - scaleby = max(scaleby, 0); + scaleby = max(scaleby, 0l); temprat->pp->exp -= scaleby; temprat->pq->exp -= scaleby; diff --git a/src/CalcManager/Ratpack/logic.cpp b/src/CalcManager/Ratpack/logic.cpp index ab5a63ed..c4c26330 100644 --- a/src/CalcManager/Ratpack/logic.cpp +++ b/src/CalcManager/Ratpack/logic.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. //--------------------------------------------------------------------------- @@ -16,7 +16,7 @@ #include "pch.h" #include "ratpak.h" - +using namespace std; void lshrat( PRAT *pa, PRAT b, uint32_t radix, int32_t precision) diff --git a/src/CalcManager/Ratpack/ratpak.h b/src/CalcManager/Ratpack/ratpak.h index 3ae06734..914682ca 100644 --- a/src/CalcManager/Ratpack/ratpak.h +++ b/src/CalcManager/Ratpack/ratpak.h @@ -225,7 +225,7 @@ memmove( (x)->pp->mant, &((x)->pp->mant[trim]), sizeof(MANTTYPE)*((x)->pp->cdigi (x)->pp->cdigit -= trim; \ (x)->pp->exp += trim; \ } \ - trim = min((x)->pp->exp,(x)->pq->exp);\ + trim = std::min((x)->pp->exp,(x)->pq->exp);\ (x)->pp->exp -= trim;\ (x)->pq->exp -= trim;\ } diff --git a/src/CalcManager/pch.h b/src/CalcManager/pch.h index 4690713c..ff0ca451 100644 --- a/src/CalcManager/pch.h +++ b/src/CalcManager/pch.h @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once @@ -7,6 +7,10 @@ #define WIN32_LEAN_AND_MEAN #endif +// Windows headers define min/max macros. +// Disable it for project code. +#define NOMINMAX + #include #include #include diff --git a/src/CalcViewModel/pch.h b/src/CalcViewModel/pch.h index 1d03c5e5..17128bc6 100644 --- a/src/CalcViewModel/pch.h +++ b/src/CalcViewModel/pch.h @@ -10,6 +10,10 @@ #define WIN32_LEAN_AND_MEAN #endif +// Windows headers define min/max macros. +// Disable it for project code. +#define NOMINMAX + #include #include diff --git a/src/Calculator/Controls/CalculationResult.cpp b/src/Calculator/Controls/CalculationResult.cpp index 5ee59944..8b32b194 100644 --- a/src/Calculator/Controls/CalculationResult.cpp +++ b/src/Calculator/Controls/CalculationResult.cpp @@ -207,10 +207,10 @@ void CalculationResult::UpdateTextState() { double widthDiff = abs(m_textBlock->ActualWidth - containerSize); double fontSizeChange = INCREMENTOFFSET; - + if (widthDiff > WIDTHCUTOFF) { - fontSizeChange = min(max(floor(WIDTHTOFONTSCALAR * widthDiff) - WIDTHTOFONTOFFSET, INCREMENTOFFSET), MAXFONTINCREMENT); + fontSizeChange = min(max(floor(WIDTHTOFONTSCALAR * widthDiff) - WIDTHTOFONTOFFSET, INCREMENTOFFSET), MAXFONTINCREMENT); } if (m_textBlock->ActualWidth < containerSize && abs(m_textBlock->FontSize - m_startingFontSize) > FONTTOLERANCE && !m_haveCalculatedMax) { diff --git a/src/Calculator/pch.h b/src/Calculator/pch.h index 92d16671..2542c474 100644 --- a/src/Calculator/pch.h +++ b/src/Calculator/pch.h @@ -8,6 +8,10 @@ #pragma once +// Windows headers define min/max macros. +// Disable it for project code. +#define NOMINMAX + #include #include #include diff --git a/src/CalculatorUnitTests/pch.h b/src/CalculatorUnitTests/pch.h index a7e7c976..5e6d7b2e 100644 --- a/src/CalculatorUnitTests/pch.h +++ b/src/CalculatorUnitTests/pch.h @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // @@ -12,6 +12,10 @@ #define WIN32_LEAN_AND_MEAN #endif +// Windows headers define min/max macros. +// Disable it for project code. +#define NOMINMAX + #define UNIT_TESTS #include