diff --git a/sdk/core/azure-core/inc/azure/core/uuid.hpp b/sdk/core/azure-core/inc/azure/core/uuid.hpp index 50e1ec9f4..8d198e25b 100644 --- a/sdk/core/azure-core/inc/azure/core/uuid.hpp +++ b/sdk/core/azure-core/inc/azure/core/uuid.hpp @@ -28,7 +28,7 @@ namespace Azure { namespace Core { class Uuid final { private: - static constexpr int UuidSize = 16; + static constexpr size_t UuidSize = 16; uint8_t m_uuid[UuidSize]; // The UUID reserved variants. @@ -86,13 +86,14 @@ namespace Azure { namespace Core { #if defined(AZ_PLATFORM_WINDOWS) std::random_device rd; - for (int i = 0; i < UuidSize; i += 4) + for (size_t i = 0; i < UuidSize; i += 4) { const uint32_t x = rd(); std::memcpy(uuid + i, &x, 4); } #elif defined(AZ_PLATFORM_POSIX) - int ret = RAND_bytes(uuid, UuidSize); + // This static cast is safe since we know Uuid size, which is a const, will always fit an int. + int ret = RAND_bytes(uuid, static_cast(UuidSize)); if (ret <= 0) { abort(); diff --git a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp index 04a33e0f6..485add350 100644 --- a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp @@ -25,14 +25,14 @@ namespace Azure { namespace Core { namespace Http { // Run time error template constexpr static const char* DefaultFailedToGetNewConnectionTemplate = "Fail to get a new connection for: "; - constexpr static int DefaultMaxOpenNewConnectionIntentsAllowed = 10; + constexpr static int32_t DefaultMaxOpenNewConnectionIntentsAllowed = 10; // After 3 connections are received from the pool and failed to send a request, the next // connections would ask the pool to be clean and spawn new connection. - constexpr static int RequestPoolResetAfterConnectionFailed = 3; + constexpr static int32_t RequestPoolResetAfterConnectionFailed = 3; // 90 sec -> cleaner wait time before next clean routine - constexpr static int DefaultCleanerIntervalMilliseconds = 1000 * 90; + constexpr static int32_t DefaultCleanerIntervalMilliseconds = 1000 * 90; // 60 sec -> expired connection is when it waits for 60 sec or more and it's not re-used - constexpr static int DefaultConnectionExpiredMilliseconds = 1000 * 60; + constexpr static int32_t DefaultConnectionExpiredMilliseconds = 1000 * 60; // Define the maximun allowed connections per host-index in the pool. If this number is reached // for the host-index, next connections trying to be added to the pool will be ignored. constexpr static size_t MaxConnectionsPerIndex = 1024; diff --git a/sdk/core/azure-core/src/private/curl_connection.hpp b/sdk/core/azure-core/src/private/curl_connection.hpp index 04a33e0f6..485add350 100644 --- a/sdk/core/azure-core/src/private/curl_connection.hpp +++ b/sdk/core/azure-core/src/private/curl_connection.hpp @@ -25,14 +25,14 @@ namespace Azure { namespace Core { namespace Http { // Run time error template constexpr static const char* DefaultFailedToGetNewConnectionTemplate = "Fail to get a new connection for: "; - constexpr static int DefaultMaxOpenNewConnectionIntentsAllowed = 10; + constexpr static int32_t DefaultMaxOpenNewConnectionIntentsAllowed = 10; // After 3 connections are received from the pool and failed to send a request, the next // connections would ask the pool to be clean and spawn new connection. - constexpr static int RequestPoolResetAfterConnectionFailed = 3; + constexpr static int32_t RequestPoolResetAfterConnectionFailed = 3; // 90 sec -> cleaner wait time before next clean routine - constexpr static int DefaultCleanerIntervalMilliseconds = 1000 * 90; + constexpr static int32_t DefaultCleanerIntervalMilliseconds = 1000 * 90; // 60 sec -> expired connection is when it waits for 60 sec or more and it's not re-used - constexpr static int DefaultConnectionExpiredMilliseconds = 1000 * 60; + constexpr static int32_t DefaultConnectionExpiredMilliseconds = 1000 * 60; // Define the maximun allowed connections per host-index in the pool. If this number is reached // for the host-index, next connections trying to be added to the pool will be ignored. constexpr static size_t MaxConnectionsPerIndex = 1024; diff --git a/sdk/core/azure-core/src/private/package_version.hpp b/sdk/core/azure-core/src/private/package_version.hpp index 3f846eb1c..f056f8d62 100644 --- a/sdk/core/azure-core/src/private/package_version.hpp +++ b/sdk/core/azure-core/src/private/package_version.hpp @@ -8,6 +8,8 @@ #pragma once +#include + #define AZURE_CORE_VERSION_MAJOR 1 #define AZURE_CORE_VERSION_MINOR 0 #define AZURE_CORE_VERSION_PATCH 0 @@ -24,13 +26,13 @@ namespace Azure { namespace Core { namespace _detail { class PackageVersion final { public: /// Major numeric identifier. - static constexpr int Major = AZURE_CORE_VERSION_MAJOR; + static constexpr int32_t Major = AZURE_CORE_VERSION_MAJOR; /// Minor numeric identifier. - static constexpr int Minor = AZURE_CORE_VERSION_MINOR; + static constexpr int32_t Minor = AZURE_CORE_VERSION_MINOR; /// Patch numeric identifier. - static constexpr int Patch = AZURE_CORE_VERSION_PATCH; + static constexpr int32_t Patch = AZURE_CORE_VERSION_PATCH; /// Indicates whether the SDK is in a pre-release state. static constexpr bool IsPreRelease = sizeof(AZURE_CORE_VERSION_PRERELEASE) != sizeof(""); diff --git a/sdk/core/azure-core/test/ut/operation_test.hpp b/sdk/core/azure-core/test/ut/operation_test.hpp index 802218558..b585eeb79 100644 --- a/sdk/core/azure-core/test/ut/operation_test.hpp +++ b/sdk/core/azure-core/test/ut/operation_test.hpp @@ -21,7 +21,7 @@ namespace Azure { namespace Core { namespace Test { private: std::string m_operationToken; std::string m_value; - int m_count = 0; + int32_t m_count = 0; private: std::unique_ptr PollInternal(Context const&) override diff --git a/sdk/identity/azure-identity/src/private/package_version.hpp b/sdk/identity/azure-identity/src/private/package_version.hpp index 15a40f54d..f0d3447b1 100644 --- a/sdk/identity/azure-identity/src/private/package_version.hpp +++ b/sdk/identity/azure-identity/src/private/package_version.hpp @@ -8,6 +8,8 @@ #pragma once +#include + #define AZURE_IDENTITY_VERSION_MAJOR 1 #define AZURE_IDENTITY_VERSION_MINOR 0 #define AZURE_IDENTITY_VERSION_PATCH 0 @@ -24,13 +26,13 @@ namespace Azure { namespace Identity { namespace _detail { class PackageVersion final { public: /// Major numeric identifier. - static constexpr int Major = AZURE_IDENTITY_VERSION_MAJOR; + static constexpr int32_t Major = AZURE_IDENTITY_VERSION_MAJOR; /// Minor numeric identifier. - static constexpr int Minor = AZURE_IDENTITY_VERSION_MINOR; + static constexpr int32_t Minor = AZURE_IDENTITY_VERSION_MINOR; /// Patch numeric identifier. - static constexpr int Patch = AZURE_IDENTITY_VERSION_PATCH; + static constexpr int32_t Patch = AZURE_IDENTITY_VERSION_PATCH; /// Indicates whether the SDK is in a pre-release state. static constexpr bool IsPreRelease = sizeof(AZURE_IDENTITY_VERSION_PRERELEASE) != sizeof(""); diff --git a/sdk/keyvault/azure-security-keyvault-common/src/private/package_version.hpp b/sdk/keyvault/azure-security-keyvault-common/src/private/package_version.hpp index ecead5256..5ab12ca06 100644 --- a/sdk/keyvault/azure-security-keyvault-common/src/private/package_version.hpp +++ b/sdk/keyvault/azure-security-keyvault-common/src/private/package_version.hpp @@ -8,6 +8,8 @@ #pragma once +#include + #define AZURE_SECURITY_KEYVAULT_COMMON_VERSION_MAJOR 4 #define AZURE_SECURITY_KEYVAULT_COMMON_VERSION_MINOR 0 #define AZURE_SECURITY_KEYVAULT_COMMON_VERSION_PATCH 0 @@ -25,13 +27,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Common { n class PackageVersion final { public: /// Major numeric identifier. - static constexpr int Major = AZURE_SECURITY_KEYVAULT_COMMON_VERSION_MAJOR; + static constexpr int32_t Major = AZURE_SECURITY_KEYVAULT_COMMON_VERSION_MAJOR; /// Minor numeric identifier. - static constexpr int Minor = AZURE_SECURITY_KEYVAULT_COMMON_VERSION_MINOR; + static constexpr int32_t Minor = AZURE_SECURITY_KEYVAULT_COMMON_VERSION_MINOR; /// Patch numeric identifier. - static constexpr int Patch = AZURE_SECURITY_KEYVAULT_COMMON_VERSION_PATCH; + static constexpr int32_t Patch = AZURE_SECURITY_KEYVAULT_COMMON_VERSION_PATCH; /// Indicates whether the SDK is in a pre-release state. static constexpr bool IsPreRelease diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp b/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp index 20660221e..7dca16762 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp @@ -8,6 +8,8 @@ #pragma once +#include + #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MAJOR 4 #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MINOR 0 #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_PATCH 0 @@ -25,13 +27,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam class PackageVersion final { public: /// Major numeric identifier. - static constexpr int Major = AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MAJOR; + static constexpr int32_t Major = AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MAJOR; /// Minor numeric identifier. - static constexpr int Minor = AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MINOR; + static constexpr int32_t Minor = AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MINOR; /// Patch numeric identifier. - static constexpr int Patch = AZURE_SECURITY_KEYVAULT_KEYS_VERSION_PATCH; + static constexpr int32_t Patch = AZURE_SECURITY_KEYVAULT_KEYS_VERSION_PATCH; /// Indicates whether the SDK is in a pre-release state. static constexpr bool IsPreRelease