Make AZURE_ASSERT and related macros internal (#3059)
This commit is contained in:
parent
52adaaa057
commit
764b839dec
@ -6,6 +6,8 @@
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- `azure/core/azure_assert.hpp` header is moved to internal. `AzureNoReturnPath()` function is removed from global namespace. Associated macros, such as `AZURE_ASSERT` are renamed to indicate that they are internal. If your code was using the `AZURE_ASSERT` macro, consider using the standard library's `assert` as an alternative.
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
### Other Changes
|
||||
|
||||
@ -65,6 +65,7 @@ set(
|
||||
inc/azure/core/http/raw_response.hpp
|
||||
inc/azure/core/http/policies/policy.hpp
|
||||
inc/azure/core/http/transport.hpp
|
||||
inc/azure/core/internal/azure_assert.hpp
|
||||
inc/azure/core/internal/client_options.hpp
|
||||
inc/azure/core/internal/contract.hpp
|
||||
inc/azure/core/internal/cryptography/sha_hash.hpp
|
||||
@ -75,7 +76,6 @@ set(
|
||||
inc/azure/core/internal/json/json.hpp
|
||||
inc/azure/core/internal/strings.hpp
|
||||
inc/azure/core/io/body_stream.hpp
|
||||
inc/azure/core/azure_assert.hpp
|
||||
inc/azure/core/rtti.hpp
|
||||
inc/azure/core/base64.hpp
|
||||
inc/azure/core/case_insensitive_containers.hpp
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#pragma once
|
||||
|
||||
// azure/core
|
||||
#include "azure/core/azure_assert.hpp"
|
||||
#include "azure/core/base64.hpp"
|
||||
#include "azure/core/case_insensitive_containers.hpp"
|
||||
#include "azure/core/context.hpp"
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Provide assert macros to use with pre-conditions.
|
||||
*
|
||||
* @remark Asserts are turned ON when `NDEBUG` is NOT defined (for Debug build). For Release build,
|
||||
* `std::abort()` is directly called if the condition is false, without calling assert().
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "platform.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#if defined(NDEBUG)
|
||||
|
||||
/*
|
||||
* NDEBUG = defined = Build is on Release
|
||||
* Define AZURE_ASSERT to call abort directly on exp == false
|
||||
*/
|
||||
|
||||
#define AZURE_ASSERT(exp) \
|
||||
do \
|
||||
{ \
|
||||
if (!(exp)) \
|
||||
{ \
|
||||
std::abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define AZURE_ASSERT_MSG(exp, msg) AZURE_ASSERT(exp)
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* NDEBUG = NOT defined = Build is on Debug
|
||||
* Define AZURE_ASSERT to call assert to provide better debug experience.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#define AZURE_ASSERT(exp) assert((exp))
|
||||
#define AZURE_ASSERT_MSG(exp, msg) assert(((void)msg, (exp)))
|
||||
|
||||
#endif
|
||||
|
||||
[[noreturn]] void AzureNoReturnPath(std::string const& msg);
|
||||
|
||||
#define AZURE_ASSERT_FALSE(exp) AZURE_ASSERT(!(exp))
|
||||
#define AZURE_UNREACHABLE_CODE() AzureNoReturnPath("unreachable code!")
|
||||
#define AZURE_NOT_IMPLEMENTED() AzureNoReturnPath("not implemented code!")
|
||||
@ -8,9 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/core/azure_assert.hpp"
|
||||
#include "azure/core/datetime.hpp"
|
||||
#include "azure/core/dll_import_export.hpp"
|
||||
#include "azure/core/internal/azure_assert.hpp"
|
||||
#include "azure/core/rtti.hpp"
|
||||
|
||||
#include <atomic>
|
||||
@ -210,7 +210,7 @@ namespace Azure { namespace Core {
|
||||
if (ptr->Key == key)
|
||||
{
|
||||
#if defined(AZ_CORE_RTTI)
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
typeid(T) == ptr->ValueType, "Type mismatch for Context::TryGetValue().");
|
||||
#endif
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/core/azure_assert.hpp"
|
||||
#include "azure/core/internal/azure_assert.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
@ -64,8 +64,8 @@ namespace Azure { namespace Core { namespace Cryptography {
|
||||
*/
|
||||
void Append(const uint8_t* data, size_t length)
|
||||
{
|
||||
AZURE_ASSERT(data || length == 0);
|
||||
AZURE_ASSERT_MSG(!m_isDone, "Cannot call Append after calling Final().");
|
||||
_azure_ASSERT(data || length == 0);
|
||||
_azure_ASSERT_MSG(!m_isDone, "Cannot call Append after calling Final().");
|
||||
OnAppend(data, length);
|
||||
}
|
||||
|
||||
@ -80,8 +80,8 @@ namespace Azure { namespace Core { namespace Cryptography {
|
||||
*/
|
||||
std::vector<uint8_t> Final(const uint8_t* data, size_t length)
|
||||
{
|
||||
AZURE_ASSERT(data || length == 0);
|
||||
AZURE_ASSERT_MSG(!m_isDone, "Cannot call Final() multiple times.");
|
||||
_azure_ASSERT(data || length == 0);
|
||||
_azure_ASSERT_MSG(!m_isDone, "Cannot call Final() multiple times.");
|
||||
m_isDone = true;
|
||||
return OnFinal(data, length);
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/core/azure_assert.hpp"
|
||||
#include "azure/core/internal/azure_assert.hpp"
|
||||
#include "azure/core/nullable.hpp"
|
||||
|
||||
#include <string>
|
||||
@ -113,7 +113,7 @@ public:
|
||||
break;
|
||||
}
|
||||
// Unknown comparison
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,7 +140,8 @@ public:
|
||||
*/
|
||||
const std::string& ToString() const
|
||||
{
|
||||
AZURE_ASSERT_MSG(m_value.HasValue(), "Empty ETag, check HasValue() before calling ToString().");
|
||||
_azure_ASSERT_MSG(
|
||||
m_value.HasValue(), "Empty ETag, check HasValue() before calling ToString().");
|
||||
|
||||
return m_value.Value();
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ namespace Azure { namespace Core { namespace Http {
|
||||
: m_method(std::move(httpMethod)), m_url(std::move(url)), m_bodyStream(bodyStream),
|
||||
m_retryModeEnabled(false), m_shouldBufferResponse(shouldBufferResponse)
|
||||
{
|
||||
AZURE_ASSERT_MSG(bodyStream, "The bodyStream pointer cannot be null.");
|
||||
_azure_ASSERT_MSG(bodyStream, "The bodyStream pointer cannot be null.");
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@ -76,7 +76,7 @@ namespace Azure { namespace Core { namespace Http {
|
||||
response.m_statusCode,
|
||||
response.m_reasonPhrase)
|
||||
{
|
||||
AZURE_ASSERT(m_bodyStream == nullptr);
|
||||
_azure_ASSERT(m_bodyStream == nullptr);
|
||||
// Copy body
|
||||
m_body = response.GetBody();
|
||||
}
|
||||
|
||||
59
sdk/core/azure-core/inc/azure/core/internal/azure_assert.hpp
Normal file
59
sdk/core/azure-core/inc/azure/core/internal/azure_assert.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Provide assert macros to use with pre-conditions.
|
||||
*
|
||||
* @remark Asserts are turned ON when `NDEBUG` is NOT defined (for Debug build). For Release build,
|
||||
* `std::abort()` is directly called if the condition is false, without calling assert().
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/core/platform.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#if defined(NDEBUG)
|
||||
|
||||
/*
|
||||
* NDEBUG = defined = Build is on Release
|
||||
* Define _azure_ASSERT to call abort directly on exp == false
|
||||
*/
|
||||
|
||||
#define _azure_ASSERT(exp) \
|
||||
do \
|
||||
{ \
|
||||
if (!(exp)) \
|
||||
{ \
|
||||
std::abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define _azure_ASSERT_MSG(exp, msg) _azure_ASSERT(exp)
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* NDEBUG = NOT defined = Build is on Debug
|
||||
* Define _azure_ASSERT to call assert to provide better debug experience.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#define _azure_ASSERT(exp) assert((exp))
|
||||
#define _azure_ASSERT_MSG(exp, msg) assert(((void)msg, (exp)))
|
||||
|
||||
#endif
|
||||
|
||||
namespace Azure { namespace Core { namespace _internal {
|
||||
[[noreturn]] void AzureNoReturnPath(std::string const& msg);
|
||||
}}} // namespace Azure::Core::_internal
|
||||
|
||||
#define _azure_ASSERT_FALSE(exp) _azure_ASSERT(!(exp))
|
||||
#define _azure_UNREACHABLE_CODE() ::Azure::Core::_internal::AzureNoReturnPath("unreachable code!")
|
||||
#define _azure_NOT_IMPLEMENTED() \
|
||||
::Azure::Core::_internal::AzureNoReturnPath("not implemented code!")
|
||||
@ -64,7 +64,7 @@ namespace Azure { namespace Core { namespace IO {
|
||||
*/
|
||||
virtual void Rewind()
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
false,
|
||||
"The specified BodyStream doesn't support Rewind which is required to guarantee fault "
|
||||
"tolerance when retrying any operation. Consider creating a MemoryBodyStream or "
|
||||
@ -86,7 +86,7 @@ namespace Azure { namespace Core { namespace IO {
|
||||
size_t count,
|
||||
Azure::Core::Context const& context = Azure::Core::Context())
|
||||
{
|
||||
AZURE_ASSERT(buffer || count == 0);
|
||||
_azure_ASSERT(buffer || count == 0);
|
||||
|
||||
context.ThrowIfCancelled();
|
||||
return OnRead(buffer, count, context);
|
||||
@ -152,7 +152,7 @@ namespace Azure { namespace Core { namespace IO {
|
||||
*/
|
||||
explicit MemoryBodyStream(const uint8_t* data, size_t length) : m_data(data), m_length(length)
|
||||
{
|
||||
AZURE_ASSERT(data || length == 0);
|
||||
_azure_ASSERT(data || length == 0);
|
||||
}
|
||||
|
||||
int64_t Length() const override { return this->m_length; }
|
||||
@ -199,7 +199,7 @@ namespace Azure { namespace Core { namespace IO {
|
||||
RandomAccessFileBodyStream(int fileDescriptor, int64_t offset, int64_t length)
|
||||
: m_fileDescriptor(fileDescriptor), m_baseOffset(offset), m_length(length), m_offset(0)
|
||||
{
|
||||
AZURE_ASSERT(fileDescriptor >= 0 && offset >= 0 && length >= 0);
|
||||
_azure_ASSERT(fileDescriptor >= 0 && offset >= 0 && length >= 0);
|
||||
}
|
||||
|
||||
RandomAccessFileBodyStream() : m_fileDescriptor(0), m_baseOffset(0), m_length(0), m_offset(0)
|
||||
@ -224,7 +224,7 @@ namespace Azure { namespace Core { namespace IO {
|
||||
RandomAccessFileBodyStream(void* fileHandle, int64_t offset, int64_t length)
|
||||
: m_filehandle(fileHandle), m_baseOffset(offset), m_length(length), m_offset(0)
|
||||
{
|
||||
AZURE_ASSERT(fileHandle && offset >= 0 && length >= 0);
|
||||
_azure_ASSERT(fileHandle && offset >= 0 && length >= 0);
|
||||
}
|
||||
|
||||
RandomAccessFileBodyStream() : m_filehandle(NULL), m_baseOffset(0), m_length(0), m_offset(0)
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <azure/core/azure_assert.hpp>
|
||||
#include "azure/core/internal/azure_assert.hpp"
|
||||
|
||||
#include <new> // for placement new
|
||||
#include <type_traits>
|
||||
@ -234,7 +234,7 @@ public:
|
||||
*/
|
||||
const T& Value() const& noexcept
|
||||
{
|
||||
AZURE_ASSERT_MSG(m_hasValue, "Empty Nullable, check HasValue() first.");
|
||||
_azure_ASSERT_MSG(m_hasValue, "Empty Nullable, check HasValue() first.");
|
||||
|
||||
return m_value;
|
||||
}
|
||||
@ -245,7 +245,7 @@ public:
|
||||
*/
|
||||
T& Value() & noexcept
|
||||
{
|
||||
AZURE_ASSERT_MSG(m_hasValue, "Empty Nullable, check HasValue() first.");
|
||||
_azure_ASSERT_MSG(m_hasValue, "Empty Nullable, check HasValue() first.");
|
||||
|
||||
return m_value;
|
||||
}
|
||||
@ -256,7 +256,7 @@ public:
|
||||
*/
|
||||
T&& Value() && noexcept
|
||||
{
|
||||
AZURE_ASSERT_MSG(m_hasValue, "Empty Nullable, check HasValue() first.");
|
||||
_azure_ASSERT_MSG(m_hasValue, "Empty Nullable, check HasValue() first.");
|
||||
|
||||
return std::move(m_value);
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "azure/core/azure_assert.hpp"
|
||||
#include "azure/core/internal/azure_assert.hpp"
|
||||
|
||||
[[noreturn]] void AzureNoReturnPath(std::string const& msg)
|
||||
[[noreturn]] void Azure::Core::_internal::AzureNoReturnPath(std::string const& msg)
|
||||
{
|
||||
// void msg for Release build where Assert is ignored
|
||||
(void)msg;
|
||||
AZURE_ASSERT_MSG(false, msg);
|
||||
_azure_ASSERT_MSG(false, msg);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
}
|
||||
default:
|
||||
// imposible to get here
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1026,7 +1026,7 @@ size_t CurlSession::ResponseBufferParser::Parse(
|
||||
{
|
||||
// Should never happen that parser is not statusLIne or Headers and we still try
|
||||
// to parse more.
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
// clean internal buffer
|
||||
this->m_internalBuffer.clear();
|
||||
@ -1064,7 +1064,7 @@ size_t CurlSession::ResponseBufferParser::Parse(
|
||||
{
|
||||
// Should never happen that parser is not statusLIne or Headers and we still try
|
||||
// to parse more.
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ static_assert(sizeof(void*) >= sizeof(HANDLE), "We must be able to cast HANDLE t
|
||||
// Keep reading until buffer is all fill out of the end of stream content is reached
|
||||
size_t BodyStream::ReadToCount(uint8_t* buffer, size_t count, Context const& context)
|
||||
{
|
||||
AZURE_ASSERT(buffer || count == 0);
|
||||
_azure_ASSERT(buffer || count == 0);
|
||||
|
||||
size_t totalRead = 0;
|
||||
|
||||
@ -92,7 +92,7 @@ size_t MemoryBodyStream::OnRead(uint8_t* buffer, size_t count, Context const& co
|
||||
|
||||
FileBodyStream::FileBodyStream(const std::string& filename)
|
||||
{
|
||||
AZURE_ASSERT_MSG(filename.size() > 0, "The file name must not be an empty string.");
|
||||
_azure_ASSERT_MSG(filename.size() > 0, "The file name must not be an empty string.");
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
HANDLE fileHandle = INVALID_HANDLE_VALUE;
|
||||
|
||||
@ -187,7 +187,7 @@ namespace Azure { namespace Storage {
|
||||
~StartBlobCopyOperation() override {}
|
||||
|
||||
private:
|
||||
std::string GetResumeToken() const override { AZURE_NOT_IMPLEMENTED(); }
|
||||
std::string GetResumeToken() const override { _azure_NOT_IMPLEMENTED(); }
|
||||
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> PollInternal(
|
||||
const Azure::Core::Context& context) override;
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
#include "azure/storage/blobs/blob_client.hpp"
|
||||
|
||||
#include <azure/core/azure_assert.hpp>
|
||||
#include <azure/core/http/policies/policy.hpp>
|
||||
#include <azure/core/internal/azure_assert.hpp>
|
||||
#include <azure/storage/common/internal/concurrent_transfer.hpp>
|
||||
#include <azure/storage/common/internal/constants.hpp>
|
||||
#include <azure/storage/common/internal/file_io.hpp>
|
||||
@ -554,7 +554,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.SourceIfNoneMatch = options.SourceAccessConditions.IfNoneMatch;
|
||||
if (options.TransactionalContentHash.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 transactional content hash.");
|
||||
protocolLayerOptions.TransactionalContentHash = options.TransactionalContentHash;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "azure/storage/blobs/blob_lease_client.hpp"
|
||||
|
||||
#include <azure/core/azure_assert.hpp>
|
||||
#include <azure/core/internal/azure_assert.hpp>
|
||||
#include <azure/core/uuid.hpp>
|
||||
|
||||
namespace Azure { namespace Storage { namespace Blobs {
|
||||
@ -53,13 +53,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
@ -79,7 +79,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,13 +118,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
@ -144,7 +144,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,13 +182,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
@ -207,7 +207,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,13 +254,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
@ -285,7 +285,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,13 +323,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
@ -348,7 +348,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
}}} // namespace Azure::Storage::Blobs
|
||||
|
||||
@ -103,7 +103,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
*this = m_pageBlobClient->GetManagedDiskPageRangesDiff(
|
||||
m_previousSnapshotUrl.Value(), m_operationOptions, context);
|
||||
}
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
|
||||
}}} // namespace Azure::Storage::Blobs
|
||||
|
||||
@ -152,7 +152,7 @@ namespace Azure { namespace Storage {
|
||||
const std::vector<uint8_t>& data,
|
||||
const std::vector<uint8_t>& key)
|
||||
{
|
||||
AZURE_ASSERT_MSG(data.size() <= std::numeric_limits<ULONG>::max(), "Data size is too big.");
|
||||
_azure_ASSERT_MSG(data.size() <= std::numeric_limits<ULONG>::max(), "Data size is too big.");
|
||||
|
||||
static AlgorithmProviderInstance AlgorithmProvider(AlgorithmType::HmacSha256);
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
protocolLayerOptions.ContentLength = 0;
|
||||
if (options.ContentHash.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.ContentHash.Value().Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash.");
|
||||
}
|
||||
@ -377,7 +377,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
{
|
||||
Blobs::_detail::BlobRestClient::Blob::SetBlobExpiryOptions protocolLayerOptions;
|
||||
protocolLayerOptions.ExpiryOrigin = expiryOrigin;
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
!(options.ExpiresOn.HasValue() && options.TimeToExpire.HasValue()),
|
||||
"ExpiresOn and TimeToExpire are mutually exclusive.");
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
*this = m_dataLakePathClient->RemoveAccessControlListRecursive(
|
||||
m_acls, m_operationOptions, context);
|
||||
}
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
|
||||
}}}} // namespace Azure::Storage::Files::DataLake
|
||||
|
||||
@ -226,7 +226,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
~StartFileCopyOperation() override {}
|
||||
|
||||
private:
|
||||
std::string GetResumeToken() const override { AZURE_NOT_IMPLEMENTED(); }
|
||||
std::string GetResumeToken() const override { _azure_NOT_IMPLEMENTED(); }
|
||||
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> PollInternal(
|
||||
const Azure::Core::Context& context) override;
|
||||
|
||||
@ -166,7 +166,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
if (!options.HttpHeaders.ContentHash.Value.empty())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.HttpHeaders.ContentHash.Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash.");
|
||||
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
|
||||
@ -240,7 +240,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
if (options.RangeHashAlgorithm.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.RangeHashAlgorithm.Value() == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash.");
|
||||
if (options.RangeHashAlgorithm.Value() == HashAlgorithm::Md5)
|
||||
@ -350,7 +350,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_ASSERT_MSG(false, "Either FilePermission or FilePermissionKey must be set.");
|
||||
_azure_ASSERT_MSG(false, "Either FilePermission or FilePermissionKey must be set.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -487,7 +487,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
+ std::string("-") + std::to_string(offset + content.Length() - 1);
|
||||
if (options.TransactionalContentHash.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash.");
|
||||
}
|
||||
@ -940,7 +940,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
if (!options.HttpHeaders.ContentHash.Value.empty())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.HttpHeaders.ContentHash.Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash.");
|
||||
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
|
||||
@ -1044,7 +1044,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
if (!options.HttpHeaders.ContentHash.Value.empty())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.HttpHeaders.ContentHash.Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash.");
|
||||
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
|
||||
@ -1088,7 +1088,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
const UploadFileRangeFromUriOptions& options,
|
||||
const Azure::Core::Context& context) const
|
||||
{
|
||||
AZURE_ASSERT_MSG(sourceRange.Length.HasValue(), "Source length cannot be null.");
|
||||
_azure_ASSERT_MSG(sourceRange.Length.HasValue(), "Source length cannot be null.");
|
||||
int64_t rangeLength = sourceRange.Length.Value();
|
||||
|
||||
auto protocolLayerOptions = _detail::ShareRestClient::File::UploadRangeFromUrlOptions();
|
||||
@ -1099,14 +1099,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
|
||||
if (options.TransactionalContentHash.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64,
|
||||
"This operation only supports CRC64 content hash.");
|
||||
}
|
||||
protocolLayerOptions.SourceContentCrc64 = options.TransactionalContentHash;
|
||||
if (options.SourceAccessCondition.IfMatchContentHash.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.SourceAccessCondition.IfMatchContentHash.Value().Algorithm
|
||||
== HashAlgorithm::Crc64,
|
||||
"This operation only supports CRC64 Source-If-Match condition.");
|
||||
@ -1114,7 +1114,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
protocolLayerOptions.SourceIfMatchCrc64 = options.SourceAccessCondition.IfMatchContentHash;
|
||||
if (options.SourceAccessCondition.IfNoneMatchContentHash.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
_azure_ASSERT_MSG(
|
||||
options.SourceAccessCondition.IfNoneMatchContentHash.Value().Algorithm
|
||||
== HashAlgorithm::Crc64,
|
||||
"This operation only supports CRC64 Source-If-None-Match condition.");
|
||||
|
||||
@ -62,7 +62,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,8 +73,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
(void)options;
|
||||
if (m_fileClient.HasValue())
|
||||
{
|
||||
AZURE_ASSERT_MSG(false, "Share lease doesn't support renew");
|
||||
AZURE_NOT_IMPLEMENTED();
|
||||
_azure_ASSERT_MSG(false, "Share lease doesn't support renew");
|
||||
_azure_NOT_IMPLEMENTED();
|
||||
}
|
||||
else if (m_shareClient.HasValue())
|
||||
{
|
||||
@ -97,7 +97,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_UNREACHABLE_CODE();
|
||||
_azure_UNREACHABLE_CODE();
|
||||
}
|
||||
}
|
||||
}}}} // namespace Azure::Storage::Files::Shares
|
||||
|
||||
Loading…
Reference in New Issue
Block a user