summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-02-10 16:56:40 +0100
committerJosJuice <josjuice@gmail.com>2017-02-11 12:56:48 +0100
commitc96bcace2f64796a5098b58ae620a158e9d3e9dc (patch)
tree6e9c4ebd634b7a2cb4ebd0cfe807ecfa0a074a7d /Source/Core
parentfb2098917b7fcbe64c8287019aa877b0a860dd0d (diff)
VolumeWiiCrypted: Use constant naming style for constants
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.cpp16
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
index 7976e1d758..cb5fe4464f 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
@@ -60,26 +60,26 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, bool de
FileMon::FindFilename(_ReadOffset);
- std::vector<u8> read_buffer(s_block_total_size);
+ std::vector<u8> read_buffer(BLOCK_TOTAL_SIZE);
while (_Length > 0)
{
// Calculate block offset
- u64 Block = _ReadOffset / s_block_data_size;
- u64 Offset = _ReadOffset % s_block_data_size;
+ u64 Block = _ReadOffset / BLOCK_DATA_SIZE;
+ u64 Offset = _ReadOffset % BLOCK_DATA_SIZE;
if (m_LastDecryptedBlockOffset != Block)
{
// Read the current block
- if (!m_pReader->Read(m_VolumeOffset + m_dataOffset + Block * s_block_total_size,
- s_block_total_size, read_buffer.data()))
+ if (!m_pReader->Read(m_VolumeOffset + m_dataOffset + Block * BLOCK_TOTAL_SIZE,
+ BLOCK_TOTAL_SIZE, read_buffer.data()))
return false;
// Decrypt the block's data.
// 0x3D0 - 0x3DF in m_pBuffer will be overwritten,
// but that won't affect anything, because we won't
// use the content of m_pBuffer anymore after this
- mbedtls_aes_crypt_cbc(m_AES_ctx.get(), MBEDTLS_AES_DECRYPT, s_block_data_size,
- &read_buffer[0x3D0], &read_buffer[s_block_header_size],
+ mbedtls_aes_crypt_cbc(m_AES_ctx.get(), MBEDTLS_AES_DECRYPT, BLOCK_DATA_SIZE,
+ &read_buffer[0x3D0], &read_buffer[BLOCK_HEADER_SIZE],
m_LastDecryptedBlock);
m_LastDecryptedBlockOffset = Block;
@@ -90,7 +90,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, bool de
}
// Copy the decrypted data
- u64 MaxSizeToCopy = s_block_data_size - Offset;
+ u64 MaxSizeToCopy = BLOCK_DATA_SIZE - Offset;
u64 CopySize = (_Length > MaxSizeToCopy) ? MaxSizeToCopy : _Length;
memcpy(_pBuffer, &m_LastDecryptedBlock[Offset], (size_t)CopySize);
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h
index d578dd5ba0..623ce5366f 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.h
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.h
@@ -54,9 +54,9 @@ public:
u64 GetRawSize() const override;
private:
- static const unsigned int s_block_header_size = 0x0400;
- static const unsigned int s_block_data_size = 0x7C00;
- static const unsigned int s_block_total_size = s_block_header_size + s_block_data_size;
+ static constexpr unsigned int BLOCK_HEADER_SIZE = 0x0400;
+ static constexpr unsigned int BLOCK_DATA_SIZE = 0x7C00;
+ static constexpr unsigned int BLOCK_TOTAL_SIZE = BLOCK_HEADER_SIZE + BLOCK_DATA_SIZE;
std::unique_ptr<IBlobReader> m_pReader;
std::unique_ptr<mbedtls_aes_context> m_AES_ctx;
@@ -65,7 +65,7 @@ private:
u64 m_dataOffset;
mutable u64 m_LastDecryptedBlockOffset;
- mutable unsigned char m_LastDecryptedBlock[s_block_data_size];
+ mutable unsigned char m_LastDecryptedBlock[BLOCK_DATA_SIZE];
};
} // namespace