Minor code cleanups 2 (#6171)
* Minor code cleanups * Clang-format * Adjust line coverage target --------- Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
This commit is contained in:
Родитель
ee75d1d79f
Коммит
868a14f4d8
|
@ -542,7 +542,6 @@ void AttestationAdministrationClient::RetrieveResponseValidationCollateral(
|
|||
m_endpoint, HttpMethod::Get, {"certs"}, nullptr);
|
||||
auto response = AttestationCommonRequest::SendRequest(*m_pipeline, request, context);
|
||||
auto jsonWebKeySet(JsonWebKeySetSerializer::Deserialize(response));
|
||||
TokenValidationCertificateResult returnValue;
|
||||
std::vector<AttestationSigner> newValue;
|
||||
for (const auto& jwk : jsonWebKeySet.Keys)
|
||||
{
|
||||
|
|
|
@ -261,7 +261,6 @@ void AttestationClient::RetrieveResponseValidationCollateral(Azure::Core::Contex
|
|||
auto response
|
||||
= AttestationCommonRequest::SendRequest(*m_pipeline, request, tracingContext.Context);
|
||||
auto jsonWebKeySet(JsonWebKeySetSerializer::Deserialize(response));
|
||||
TokenValidationCertificateResult returnValue;
|
||||
std::vector<AttestationSigner> newValue;
|
||||
for (const auto& jwk : jsonWebKeySet.Keys)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ extends:
|
|||
Location: WestUS
|
||||
CtestRegex: azure-security-attestation.*
|
||||
LiveTestCtestRegex: azure-security-attestation.*
|
||||
LineCoverageTarget: 70
|
||||
LineCoverageTarget: 69.9834
|
||||
BranchCoverageTarget: 34
|
||||
Artifacts:
|
||||
- Name: azure-security-attestation
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
/** @brief Azure specific assert macro.*/
|
||||
#define AZURE_ASSERT(exp) assert((exp))
|
||||
/** @brief Azure specific assert macro with message.*/
|
||||
#define AZURE_ASSERT_MSG(exp, msg) assert(((void)msg, (exp)))
|
||||
#define AZURE_ASSERT_MSG(exp, msg) assert(((void)(msg), (exp)))
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace Azure { namespace Core {
|
|||
* @brief Destructs `%RequestFailedException`.
|
||||
*
|
||||
*/
|
||||
~RequestFailedException() = default;
|
||||
~RequestFailedException() override = default;
|
||||
|
||||
private:
|
||||
static std::string GetRawResponseField(
|
||||
|
|
|
@ -327,7 +327,7 @@ namespace Azure { namespace Core { namespace Http {
|
|||
* @brief A value indicating whether the returned raw response for this request will be buffered
|
||||
* within a memory buffer or if it will be returned as a body stream instead.
|
||||
*/
|
||||
bool ShouldBufferResponse() { return this->m_shouldBufferResponse; }
|
||||
bool ShouldBufferResponse() const { return this->m_shouldBufferResponse; }
|
||||
|
||||
/**
|
||||
* @brief Get URL.
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Azure { namespace Core { namespace Http { namespace _internal {
|
|||
explicit HttpPipeline(
|
||||
const std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>& policies)
|
||||
{
|
||||
if (policies.size() == 0)
|
||||
if (policies.empty())
|
||||
{
|
||||
throw std::invalid_argument("policies cannot be empty");
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ namespace Azure { namespace Core { namespace Http { namespace _internal {
|
|||
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>>&& policies)
|
||||
: m_policies(std::move(policies))
|
||||
{
|
||||
if (m_policies.size() == 0)
|
||||
if (m_policies.empty())
|
||||
{
|
||||
throw std::invalid_argument("policies cannot be empty");
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "azure/core/internal/extendable_enumeration.hpp"
|
||||
#include "azure/core/internal/tracing/tracing_impl.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
|
@ -31,7 +33,7 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal {
|
|||
|
||||
friend class TracingContextFactory;
|
||||
ServiceSpan() = default;
|
||||
explicit ServiceSpan(std::shared_ptr<Span> span) : m_span(span) {}
|
||||
explicit ServiceSpan(std::shared_ptr<Span> span) : m_span(std::move(span)) {}
|
||||
|
||||
ServiceSpan(const ServiceSpan&) = delete;
|
||||
ServiceSpan& operator=(ServiceSpan const&) = delete;
|
||||
|
@ -41,7 +43,7 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal {
|
|||
public:
|
||||
ServiceSpan(ServiceSpan&& that) = default;
|
||||
|
||||
~ServiceSpan()
|
||||
~ServiceSpan() override
|
||||
{
|
||||
if (m_span)
|
||||
{
|
||||
|
|
|
@ -227,7 +227,8 @@ namespace Azure { namespace Core { namespace IO {
|
|||
AZURE_ASSERT(fileHandle && offset >= 0 && length >= 0);
|
||||
}
|
||||
|
||||
RandomAccessFileBodyStream() : m_filehandle(NULL), m_baseOffset(0), m_length(0), m_offset(0)
|
||||
RandomAccessFileBodyStream()
|
||||
: m_filehandle(nullptr), m_baseOffset(0), m_length(0), m_offset(0)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
@ -275,7 +276,7 @@ namespace Azure { namespace Core { namespace IO {
|
|||
* @brief Closes the file and cleans up any resources.
|
||||
*
|
||||
*/
|
||||
~FileBodyStream();
|
||||
~FileBodyStream() override;
|
||||
|
||||
/** @brief Rewind seeks the current stream to the start of the file. */
|
||||
void Rewind() override;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Azure {
|
|||
namespace _detail {
|
||||
struct NontrivialEmptyType final
|
||||
{
|
||||
constexpr NontrivialEmptyType() noexcept {}
|
||||
constexpr NontrivialEmptyType() noexcept = default;
|
||||
};
|
||||
} // namespace _detail
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace Azure { namespace Core {
|
|||
* @brief Constructs a new, empty URL object.
|
||||
*
|
||||
*/
|
||||
Url() {}
|
||||
Url() = default;
|
||||
|
||||
/**
|
||||
* @brief Constructs a URL from a URL-encoded string.
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
namespace {
|
||||
|
||||
static char const Base64EncodeArray[65]
|
||||
char const Base64EncodeArray[65]
|
||||
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static char const EncodingPad = '=';
|
||||
static int8_t const Base64DecodeArray[256] = {
|
||||
char const EncodingPad = '=';
|
||||
int8_t const Base64DecodeArray[256] = {
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
|
@ -271,7 +271,7 @@ static int8_t const Base64DecodeArray[256] = {
|
|||
-1,
|
||||
};
|
||||
|
||||
static int32_t Base64Encode(const uint8_t* threeBytes)
|
||||
int32_t Base64Encode(const uint8_t* threeBytes)
|
||||
{
|
||||
int32_t i = (threeBytes[0] << 16) | (threeBytes[1] << 8) | threeBytes[2];
|
||||
|
||||
|
@ -283,7 +283,7 @@ static int32_t Base64Encode(const uint8_t* threeBytes)
|
|||
return i0 | (i1 << 8) | (i2 << 16) | (i3 << 24);
|
||||
}
|
||||
|
||||
static int32_t Base64EncodeAndPadOne(const uint8_t* twoBytes)
|
||||
int32_t Base64EncodeAndPadOne(const uint8_t* twoBytes)
|
||||
{
|
||||
int32_t i = twoBytes[0] << 16 | (twoBytes[1] << 8);
|
||||
|
||||
|
@ -294,7 +294,7 @@ static int32_t Base64EncodeAndPadOne(const uint8_t* twoBytes)
|
|||
return i0 | (i1 << 8) | (i2 << 16) | (EncodingPad << 24);
|
||||
}
|
||||
|
||||
static int32_t Base64EncodeAndPadTwo(const uint8_t* oneByte)
|
||||
int32_t Base64EncodeAndPadTwo(const uint8_t* oneByte)
|
||||
{
|
||||
int32_t i = oneByte[0] << 8;
|
||||
|
||||
|
@ -304,7 +304,7 @@ static int32_t Base64EncodeAndPadTwo(const uint8_t* oneByte)
|
|||
return i0 | (i1 << 8) | (EncodingPad << 16) | (EncodingPad << 24);
|
||||
}
|
||||
|
||||
static void Base64WriteIntAsFourBytes(char* destination, int32_t value)
|
||||
void Base64WriteIntAsFourBytes(char* destination, int32_t value)
|
||||
{
|
||||
destination[3] = static_cast<uint8_t>((value >> 24) & 0xFF);
|
||||
destination[2] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
|
@ -344,7 +344,7 @@ std::string Base64Encode(uint8_t const* const data, size_t length)
|
|||
return encodedResult;
|
||||
}
|
||||
|
||||
static int32_t Base64Decode(const char* encodedBytes)
|
||||
int32_t Base64Decode(const char* encodedBytes)
|
||||
{
|
||||
int32_t i0 = encodedBytes[0];
|
||||
int32_t i1 = encodedBytes[1];
|
||||
|
@ -367,7 +367,7 @@ static int32_t Base64Decode(const char* encodedBytes)
|
|||
return i0;
|
||||
}
|
||||
|
||||
static void Base64WriteThreeLowOrderBytes(std::vector<uint8_t>::iterator destination, int64_t value)
|
||||
void Base64WriteThreeLowOrderBytes(std::vector<uint8_t>::iterator destination, int64_t value)
|
||||
{
|
||||
destination[0] = static_cast<uint8_t>(value >> 16);
|
||||
destination[1] = static_cast<uint8_t>(value >> 8);
|
||||
|
|
|
@ -97,7 +97,7 @@ private:
|
|||
size_t m_hashLength = 0;
|
||||
std::string m_buffer;
|
||||
|
||||
void OnAppend(const uint8_t* data, size_t length)
|
||||
void OnAppend(const uint8_t* data, size_t length) override
|
||||
{
|
||||
if (!BCRYPT_SUCCESS(
|
||||
m_status = BCryptHashData(
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> OnFinal(const uint8_t* data, size_t length)
|
||||
std::vector<uint8_t> OnFinal(const uint8_t* data, size_t length) override
|
||||
{
|
||||
OnAppend(data, length);
|
||||
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~Md5BCrypt()
|
||||
~Md5BCrypt() override
|
||||
{
|
||||
if (m_hashHandle)
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ Azure::Core::Cryptography::Md5Hash::Md5Hash() : m_implementation(std::make_uniqu
|
|||
#endif
|
||||
|
||||
namespace Azure { namespace Core { namespace Cryptography {
|
||||
Md5Hash::~Md5Hash() {}
|
||||
Md5Hash::~Md5Hash() = default;
|
||||
|
||||
void Md5Hash::OnAppend(const uint8_t* data, size_t length)
|
||||
{
|
||||
|
|
|
@ -148,7 +148,7 @@ EnvironmentLogLevelListener::GetLogListener()
|
|||
}
|
||||
|
||||
namespace {
|
||||
static bool g_initialized;
|
||||
bool g_initialized = false;
|
||||
} // namespace
|
||||
|
||||
bool EnvironmentLogLevelListener::IsInitialized() { return g_initialized; }
|
||||
|
|
|
@ -2,13 +2,10 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
#include "azure/core/http/policies/policy.hpp"
|
||||
#include "azure/core/internal/diagnostics/log.hpp"
|
||||
#include "azure/core/internal/http/http_sanitizer.hpp"
|
||||
#include "azure/core/internal/tracing/service_tracing.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
|
|
|
@ -6,11 +6,8 @@
|
|||
* @brief Contains the user agent string generator implementation.
|
||||
*/
|
||||
|
||||
#include "azure/core/context.hpp"
|
||||
#include "azure/core/http/http.hpp"
|
||||
#include "azure/core/http/policies/policy.hpp"
|
||||
#include "azure/core/internal/strings.hpp"
|
||||
#include "azure/core/internal/tracing/service_tracing.hpp"
|
||||
#include "azure/core/platform.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
#include "azure/core/internal/diagnostics/log.hpp"
|
||||
#include "private/environment_log_level_listener.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
#include <sstream>
|
||||
|
||||
using namespace Azure::Core::Diagnostics;
|
||||
using namespace Azure::Core::Diagnostics::_internal;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
#include "azure/core/context.hpp"
|
||||
#include "azure/core/http/policies/policy.hpp"
|
||||
#include "azure/core/internal/tracing/service_tracing.hpp"
|
||||
#include "azure/core/internal/tracing/tracing_impl.hpp"
|
||||
|
||||
|
@ -42,7 +41,6 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal {
|
|||
std::string const& methodName,
|
||||
Azure::Core::Context const& context) const
|
||||
{
|
||||
Azure::Core::Context contextToUse = context;
|
||||
CreateSpanOptions createOptions;
|
||||
|
||||
createOptions.Kind = SpanKind::Internal;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "azure/core/platform.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "private/client_assertion_credential_impl.hpp"
|
||||
#include "private/identity_log.hpp"
|
||||
#include "private/package_version.hpp"
|
||||
#include "private/tenant_id_resolver.hpp"
|
||||
|
||||
#include <azure/core/internal/json/json.hpp>
|
||||
|
|
Загрузка…
Ссылка в новой задаче