SmallString: MSVC warning fix
This commit is contained in:
parent
0538b95d9b
commit
96ece5de1c
|
@ -160,7 +160,7 @@ void SHA1Digest::Reset()
|
||||||
count[0] = count[1] = 0;
|
count[0] = count[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SHA1Digest::DigestToString(const std::span<u8, DIGEST_SIZE> digest)
|
std::string SHA1Digest::DigestToString(const std::span<const u8, DIGEST_SIZE> digest)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret.reserve(DIGEST_SIZE * 2);
|
ret.reserve(DIGEST_SIZE * 2);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
|
||||||
#include <span>
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class SHA1Digest
|
class SHA1Digest
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
void Final(u8 digest[DIGEST_SIZE]);
|
void Final(u8 digest[DIGEST_SIZE]);
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
static std::string DigestToString(const std::span<u8, DIGEST_SIZE> digest);
|
static std::string DigestToString(const std::span<const u8, DIGEST_SIZE> digest);
|
||||||
|
|
||||||
static std::array<u8, DIGEST_SIZE> GetDigest(const void* data, size_t len);
|
static std::array<u8, DIGEST_SIZE> GetDigest(const void* data, size_t len);
|
||||||
static std::array<u8, DIGEST_SIZE> GetDigest(std::span<const u8> data);
|
static std::array<u8, DIGEST_SIZE> GetDigest(std::span<const u8> data);
|
||||||
|
|
|
@ -186,7 +186,7 @@ void SmallStringBase::append_hex(const void* data, size_t len, bool comma_separa
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static constexpr auto hex_char = [](char x) { return (x >= 0xA) ? ((x - 0xA) + 'a') : (x + '0'); };
|
static constexpr auto hex_char = [](char x) { return static_cast<char>((x >= 0xA) ? ((x - 0xA) + 'a') : (x + '0')); };
|
||||||
const u8* bytes = static_cast<const u8*>(data);
|
const u8* bytes = static_cast<const u8*>(data);
|
||||||
|
|
||||||
if (!comma_separate)
|
if (!comma_separate)
|
||||||
|
|
|
@ -171,7 +171,7 @@ std::optional<std::vector<u8>> StringUtil::DecodeHex(const std::string_view in)
|
||||||
|
|
||||||
std::string StringUtil::EncodeHex(const void* data, size_t length)
|
std::string StringUtil::EncodeHex(const void* data, size_t length)
|
||||||
{
|
{
|
||||||
static constexpr auto hex_char = [](char x) { return (x >= 0xA) ? ((x - 0xA) + 'a') : (x + '0'); };
|
static constexpr auto hex_char = [](char x) { return static_cast<char>((x >= 0xA) ? ((x - 0xA) + 'a') : (x + '0')); };
|
||||||
|
|
||||||
const u8* bytes = static_cast<const u8*>(data);
|
const u8* bytes = static_cast<const u8*>(data);
|
||||||
|
|
||||||
|
|
|
@ -491,9 +491,7 @@ bool GPUDevice::OpenPipelineCache(const std::string& path, Error* error)
|
||||||
const size_t cache_size = data->size();
|
const size_t cache_size = data->size();
|
||||||
const std::array<u8, SHA1Digest::DIGEST_SIZE> cache_hash = SHA1Digest::GetDigest(data->cspan());
|
const std::array<u8, SHA1Digest::DIGEST_SIZE> cache_hash = SHA1Digest::GetDigest(data->cspan());
|
||||||
|
|
||||||
INFO_LOG("Loading {} byte pipeline cache with hash {}", s_pipeline_cache_size,
|
INFO_LOG("Loading {} byte pipeline cache with hash {}", cache_size, SHA1Digest::DigestToString(cache_hash));
|
||||||
SHA1Digest::DigestToString(s_pipeline_cache_hash));
|
|
||||||
|
|
||||||
if (!ReadPipelineCache(std::move(data.value()), error))
|
if (!ReadPipelineCache(std::move(data.value()), error))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue