Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
This commit is contained in:
parent
eca98eeb3e
commit
7d8f115185
158 changed files with 669 additions and 634 deletions
|
@ -44,7 +44,7 @@ public:
|
|||
} // namespace
|
||||
|
||||
std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce,
|
||||
size_t slot_id) {
|
||||
std::size_t slot_id) {
|
||||
if (!IsNormalKeyAvailable(slot_id)) {
|
||||
LOG_ERROR(HW_AES, "Key slot {} not available. Will use zero key.", slot_id);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& non
|
|||
}
|
||||
|
||||
std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce,
|
||||
size_t slot_id) {
|
||||
std::size_t slot_id) {
|
||||
if (!IsNormalKeyAvailable(slot_id)) {
|
||||
LOG_ERROR(HW_AES, "Key slot {} not available. Will use zero key.", slot_id);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace HW {
|
||||
namespace AES {
|
||||
|
||||
constexpr size_t CCM_NONCE_SIZE = 12;
|
||||
constexpr size_t CCM_MAC_SIZE = 16;
|
||||
constexpr std::size_t CCM_NONCE_SIZE = 12;
|
||||
constexpr std::size_t CCM_MAC_SIZE = 16;
|
||||
|
||||
using CCMNonce = std::array<u8, CCM_NONCE_SIZE>;
|
||||
|
||||
|
@ -24,7 +24,8 @@ using CCMNonce = std::array<u8, CCM_NONCE_SIZE>;
|
|||
* @param slot_id The slot ID of the key to use for encryption
|
||||
* @returns a vector of u8 containing the encrypted data with MAC at the end
|
||||
*/
|
||||
std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce, size_t slot_id);
|
||||
std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce,
|
||||
std::size_t slot_id);
|
||||
|
||||
/**
|
||||
* Decrypts and verify the MAC of the given data using AES-CCM algorithm.
|
||||
|
@ -34,7 +35,7 @@ std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& non
|
|||
* @returns a vector of u8 containing the decrypted data; an empty vector if the verification fails
|
||||
*/
|
||||
std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce,
|
||||
size_t slot_id);
|
||||
std::size_t slot_id);
|
||||
|
||||
} // namespace AES
|
||||
} // namespace HW
|
||||
|
|
|
@ -62,7 +62,7 @@ AESKey HexToKey(const std::string& hex) {
|
|||
}
|
||||
|
||||
AESKey key;
|
||||
for (size_t i = 0; i < key.size(); ++i) {
|
||||
for (std::size_t i = 0; i < key.size(); ++i) {
|
||||
key[i] = static_cast<u8>(std::stoi(hex.substr(i * 2, 2), 0, 16));
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ void LoadPresetKeys() {
|
|||
continue;
|
||||
}
|
||||
|
||||
size_t slot_id;
|
||||
std::size_t slot_id;
|
||||
char key_type;
|
||||
if (std::sscanf(name.c_str(), "slot0x%zXKey%c", &slot_id, &key_type) != 2) {
|
||||
LOG_ERROR(HW_AES, "Invalid key name {}", name);
|
||||
|
@ -145,23 +145,23 @@ void SetGeneratorConstant(const AESKey& key) {
|
|||
generator_constant = key;
|
||||
}
|
||||
|
||||
void SetKeyX(size_t slot_id, const AESKey& key) {
|
||||
void SetKeyX(std::size_t slot_id, const AESKey& key) {
|
||||
key_slots.at(slot_id).SetKeyX(key);
|
||||
}
|
||||
|
||||
void SetKeyY(size_t slot_id, const AESKey& key) {
|
||||
void SetKeyY(std::size_t slot_id, const AESKey& key) {
|
||||
key_slots.at(slot_id).SetKeyY(key);
|
||||
}
|
||||
|
||||
void SetNormalKey(size_t slot_id, const AESKey& key) {
|
||||
void SetNormalKey(std::size_t slot_id, const AESKey& key) {
|
||||
key_slots.at(slot_id).SetNormalKey(key);
|
||||
}
|
||||
|
||||
bool IsNormalKeyAvailable(size_t slot_id) {
|
||||
bool IsNormalKeyAvailable(std::size_t slot_id) {
|
||||
return key_slots.at(slot_id).normal.is_initialized();
|
||||
}
|
||||
|
||||
AESKey GetNormalKey(size_t slot_id) {
|
||||
AESKey GetNormalKey(std::size_t slot_id) {
|
||||
return key_slots.at(slot_id).normal.value_or(AESKey{});
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace HW {
|
||||
namespace AES {
|
||||
|
||||
enum KeySlotID : size_t {
|
||||
enum KeySlotID : std::size_t {
|
||||
|
||||
// Used to decrypt the SSL client cert/private-key stored in ClCertA.
|
||||
SSLKey = 0x0D,
|
||||
|
@ -31,19 +31,19 @@ enum KeySlotID : size_t {
|
|||
MaxKeySlotID = 0x40,
|
||||
};
|
||||
|
||||
constexpr size_t AES_BLOCK_SIZE = 16;
|
||||
constexpr std::size_t AES_BLOCK_SIZE = 16;
|
||||
|
||||
using AESKey = std::array<u8, AES_BLOCK_SIZE>;
|
||||
|
||||
void InitKeys();
|
||||
|
||||
void SetGeneratorConstant(const AESKey& key);
|
||||
void SetKeyX(size_t slot_id, const AESKey& key);
|
||||
void SetKeyY(size_t slot_id, const AESKey& key);
|
||||
void SetNormalKey(size_t slot_id, const AESKey& key);
|
||||
void SetKeyX(std::size_t slot_id, const AESKey& key);
|
||||
void SetKeyY(std::size_t slot_id, const AESKey& key);
|
||||
void SetNormalKey(std::size_t slot_id, const AESKey& key);
|
||||
|
||||
bool IsNormalKeyAvailable(size_t slot_id);
|
||||
AESKey GetNormalKey(size_t slot_id);
|
||||
bool IsNormalKeyAvailable(std::size_t slot_id);
|
||||
AESKey GetNormalKey(std::size_t slot_id);
|
||||
|
||||
} // namespace AES
|
||||
} // namespace HW
|
||||
|
|
|
@ -114,8 +114,8 @@ static void MemoryFill(const Regs::MemoryFillConfig& config) {
|
|||
// fill with 32-bit values
|
||||
if (end > start) {
|
||||
u32 value = config.value_32bit;
|
||||
size_t len = (end - start) / sizeof(u32);
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
std::size_t len = (end - start) / sizeof(u32);
|
||||
for (std::size_t i = 0; i < len; ++i)
|
||||
memcpy(&start[i * sizeof(u32)], &value, sizeof(u32));
|
||||
}
|
||||
} else {
|
||||
|
@ -348,12 +348,12 @@ static void TextureCopy(const Regs::DisplayTransferConfig& config) {
|
|||
return;
|
||||
}
|
||||
|
||||
size_t contiguous_input_size =
|
||||
std::size_t contiguous_input_size =
|
||||
config.texture_copy.size / input_width * (input_width + input_gap);
|
||||
Memory::RasterizerFlushRegion(config.GetPhysicalInputAddress(),
|
||||
static_cast<u32>(contiguous_input_size));
|
||||
|
||||
size_t contiguous_output_size =
|
||||
std::size_t contiguous_output_size =
|
||||
config.texture_copy.size / output_width * (output_width + output_gap);
|
||||
// Only need to flush output if it has a gap
|
||||
const auto FlushInvalidate_fn = (output_gap != 0) ? Memory::RasterizerFlushAndInvalidateRegion
|
||||
|
|
|
@ -30,11 +30,11 @@ constexpr float SCREEN_REFRESH_RATE = 60;
|
|||
#else
|
||||
// NOTE: Yeah, hacking in a static_assert here just to workaround the lacking MSVC compiler
|
||||
// really is this annoying. This macro just forwards its first argument to GPU_REG_INDEX
|
||||
// and then performs a (no-op) cast to size_t iff the second argument matches the expected
|
||||
// field offset. Otherwise, the compiler will fail to compile this code.
|
||||
// and then performs a (no-op) cast to std::size_t iff the second argument matches the
|
||||
// expected field offset. Otherwise, the compiler will fail to compile this code.
|
||||
#define GPU_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) \
|
||||
((typename std::enable_if<backup_workaround_index == GPU_REG_INDEX(field_name), size_t>::type) \
|
||||
GPU_REG_INDEX(field_name))
|
||||
((typename std::enable_if<backup_workaround_index == GPU_REG_INDEX(field_name), \
|
||||
std::size_t>::type) GPU_REG_INDEX(field_name))
|
||||
#endif
|
||||
|
||||
// MMIO region 0x1EFxxxxx
|
||||
|
@ -268,7 +268,7 @@ struct Regs {
|
|||
|
||||
INSERT_PADDING_WORDS(0x9c3);
|
||||
|
||||
static constexpr size_t NumIds() {
|
||||
static constexpr std::size_t NumIds() {
|
||||
return sizeof(Regs) / sizeof(u32);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ struct Regs {
|
|||
u32 backlight_bottom;
|
||||
INSERT_PADDING_WORDS(0x16F);
|
||||
|
||||
static constexpr size_t NumIds() {
|
||||
static constexpr std::size_t NumIds() {
|
||||
return sizeof(Regs) / sizeof(u32);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace Y2R {
|
|||
|
||||
using namespace Service::Y2R;
|
||||
|
||||
static const size_t MAX_TILES = 1024 / 8;
|
||||
static const size_t TILE_SIZE = 8 * 8;
|
||||
static const std::size_t MAX_TILES = 1024 / 8;
|
||||
static const std::size_t TILE_SIZE = 8 * 8;
|
||||
using ImageTile = std::array<u32, TILE_SIZE>;
|
||||
|
||||
/// Converts a image strip from the source YUV format into individual 8x8 RGB32 tiles.
|
||||
|
@ -78,15 +78,15 @@ static void ConvertYUVToRGB(InputFormat input_format, const u8* input_Y, const u
|
|||
|
||||
/// Simulates an incoming CDMA transfer. The N parameter is used to automatically convert 16-bit
|
||||
/// formats to 8-bit.
|
||||
template <size_t N>
|
||||
static void ReceiveData(u8* output, ConversionBuffer& buf, size_t amount_of_data) {
|
||||
template <std::size_t N>
|
||||
static void ReceiveData(u8* output, ConversionBuffer& buf, std::size_t amount_of_data) {
|
||||
const u8* input = Memory::GetPointer(buf.address);
|
||||
|
||||
size_t output_unit = buf.transfer_unit / N;
|
||||
std::size_t output_unit = buf.transfer_unit / N;
|
||||
ASSERT(amount_of_data % output_unit == 0);
|
||||
|
||||
while (amount_of_data > 0) {
|
||||
for (size_t i = 0; i < output_unit; ++i) {
|
||||
for (std::size_t i = 0; i < output_unit; ++i) {
|
||||
output[i] = input[i * N];
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ void PerformConversion(ConversionConfiguration& cvt) {
|
|||
ASSERT(cvt.input_line_width % 8 == 0);
|
||||
ASSERT(cvt.block_alignment != BlockAlignment::Block8x8 || cvt.input_lines % 8 == 0);
|
||||
// Tiles per row
|
||||
size_t num_tiles = cvt.input_line_width / 8;
|
||||
std::size_t num_tiles = cvt.input_line_width / 8;
|
||||
ASSERT(num_tiles <= MAX_TILES);
|
||||
|
||||
// Buffer used as a CDMA source/target.
|
||||
|
@ -288,7 +288,7 @@ void PerformConversion(ConversionConfiguration& cvt) {
|
|||
unsigned int row_height = std::min(cvt.input_lines - y, 8u);
|
||||
|
||||
// Total size in pixels of incoming data required for this strip.
|
||||
const size_t row_data_size = row_height * cvt.input_line_width;
|
||||
const std::size_t row_data_size = row_height * cvt.input_line_width;
|
||||
|
||||
u8* input_Y = data_buffer.get();
|
||||
u8* input_U = input_Y + 8 * cvt.input_line_width;
|
||||
|
@ -329,7 +329,7 @@ void PerformConversion(ConversionConfiguration& cvt) {
|
|||
|
||||
u32* output_buffer = reinterpret_cast<u32*>(data_buffer.get());
|
||||
|
||||
for (size_t i = 0; i < num_tiles; ++i) {
|
||||
for (std::size_t i = 0; i < num_tiles; ++i) {
|
||||
int image_strip_width = 0;
|
||||
int output_stride = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue