Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add NOMINMAX and LEAN_AND_MEAN + clang-format
  • Loading branch information
antkmsft committed Feb 12, 2024
commit a44cf8fd0a71361757163c1cbff2daa967ec5e82
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#if defined(AZ_PLATFORM_WINDOWS)
#if defined(_DEBUG) && defined(_MSC_VER)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
// MSVC CRT error callback.
// This function is called when a CRT error is detected.
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/azure-core/src/cryptography/md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "azure/core/platform.hpp"

#if defined(AZ_PLATFORM_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX

// Windows needs to go before bcrypt
#include <windows.h>

Expand Down
3 changes: 3 additions & 0 deletions sdk/core/azure-core/src/cryptography/sha_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <azure/core/platform.hpp>

#if defined(AZ_PLATFORM_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX

// Windows needs to go before bcrypt
#include <windows.h>

Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core/src/datetime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ DateTime GetMaxDateTime()

constexpr auto repMax = (std::numeric_limits<DateTime::clock::duration::rep>::max)();

return DateTime(DateTime::time_point(
DateTime::duration(systemClockMax + (std::min)(systemClockEpoch, (repMax - systemClockMax)))));
return DateTime(DateTime::time_point(DateTime::duration(
systemClockMax + (std::min)(systemClockEpoch, (repMax - systemClockMax)))));
}

template <typename T>
Expand Down
7 changes: 7 additions & 0 deletions sdk/core/azure-core/src/http/winhttp/win_http_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
#include "azure/core/http/win_http_transport.hpp"
#include "azure/core/url.hpp"

#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#if !defined(NOMINMAX)
#define NOMINMAX
#endif

#include <Windows.h>

#include <memory>
Expand Down
7 changes: 7 additions & 0 deletions sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include "win_http_request.hpp"
#endif

#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#if !defined(NOMINMAX)
#define NOMINMAX
#endif

#include <Windows.h>

#include <algorithm>
Expand Down
3 changes: 2 additions & 1 deletion sdk/core/perf/src/random_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void RandomBuffer(uint8_t* buffer, size_t length)
*(start_addr++) = RandomChar();
}

std::uniform_int_distribution<uint64_t> distribution(0ULL, (std::numeric_limits<uint64_t>::max)());
std::uniform_int_distribution<uint64_t> distribution(
0ULL, (std::numeric_limits<uint64_t>::max)());
while (start_addr + rand_int_size <= end_addr)
{
*reinterpret_cast<uint64_t*>(start_addr) = distribution(random_generator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
#include <vector>

#if defined(AZ_PLATFORM_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <wincrypt.h>

#if !defined(WINAPI_PARTITION_DESKTOP) || WINAPI_PARTITION_DESKTOP // not UWP
#pragma warning(push)
Expand Down
3 changes: 2 additions & 1 deletion sdk/identity/azure-identity/src/token_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ template <
T L = 0, // Left hand side
T R = 1, // Right hand side
size_t N = 0, // Counter (for array)
bool X = (((std::numeric_limits<T>::max)() - L) < R)> // Condition to stop (integer overflow of T)
bool X
= (((std::numeric_limits<T>::max)() - L) < R)> // Condition to stop (integer overflow of T)
struct SortedFibonacciSequence
{
static constexpr auto Get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <azure/core/cryptography/hash.hpp>
#include <azure/core/platform.hpp>
#if defined(AZ_PLATFORM_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
// Windows needs to go before bcrypt
#include <windows.h>

Expand Down