aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/data_src.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/utils/data_src.cpp
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
Diffstat (limited to 'src/lib/utils/data_src.cpp')
-rw-r--r--src/lib/utils/data_src.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/utils/data_src.cpp b/src/lib/utils/data_src.cpp
index 7da94d7c0..169f8e186 100644
--- a/src/lib/utils/data_src.cpp
+++ b/src/lib/utils/data_src.cpp
@@ -19,7 +19,7 @@ namespace Botan {
/*
* Read a single byte from the DataSource
*/
-size_t DataSource::read_byte(byte& out)
+size_t DataSource::read_byte(uint8_t& out)
{
return read(&out, 1);
}
@@ -27,7 +27,7 @@ size_t DataSource::read_byte(byte& out)
/*
* Peek a single byte from the DataSource
*/
-size_t DataSource::peek_byte(byte& out) const
+size_t DataSource::peek_byte(uint8_t& out) const
{
return peek(&out, 1, 0);
}
@@ -37,7 +37,7 @@ size_t DataSource::peek_byte(byte& out) const
*/
size_t DataSource::discard_next(size_t n)
{
- byte buf[64] = { 0 };
+ uint8_t buf[64] = { 0 };
size_t discarded = 0;
while(n)
@@ -56,7 +56,7 @@ size_t DataSource::discard_next(size_t n)
/*
* Read from a memory buffer
*/
-size_t DataSource_Memory::read(byte out[], size_t length)
+size_t DataSource_Memory::read(uint8_t out[], size_t length)
{
size_t got = std::min<size_t>(m_source.size() - m_offset, length);
copy_mem(out, m_source.data() + m_offset, got);
@@ -72,7 +72,7 @@ bool DataSource_Memory::check_available(size_t n)
/*
* Peek into a memory buffer
*/
-size_t DataSource_Memory::peek(byte out[], size_t length,
+size_t DataSource_Memory::peek(uint8_t out[], size_t length,
size_t peek_offset) const
{
const size_t bytes_left = m_source.size() - m_offset;
@@ -95,8 +95,8 @@ bool DataSource_Memory::end_of_data() const
* DataSource_Memory Constructor
*/
DataSource_Memory::DataSource_Memory(const std::string& in) :
- m_source(reinterpret_cast<const byte*>(in.data()),
- reinterpret_cast<const byte*>(in.data()) + in.length()),
+ m_source(reinterpret_cast<const uint8_t*>(in.data()),
+ reinterpret_cast<const uint8_t*>(in.data()) + in.length()),
m_offset(0)
{
}
@@ -106,7 +106,7 @@ DataSource_Memory::DataSource_Memory(const std::string& in) :
/*
* Read from a stream
*/
-size_t DataSource_Stream::read(byte out[], size_t length)
+size_t DataSource_Stream::read(uint8_t out[], size_t length)
{
m_source.read(reinterpret_cast<char*>(out), length);
if(m_source.bad())
@@ -129,7 +129,7 @@ bool DataSource_Stream::check_available(size_t n)
/*
* Peek into a stream
*/
-size_t DataSource_Stream::peek(byte out[], size_t length, size_t offset) const
+size_t DataSource_Stream::peek(uint8_t out[], size_t length, size_t offset) const
{
if(end_of_data())
throw Invalid_State("DataSource_Stream: Cannot peek when out of data");
@@ -138,7 +138,7 @@ size_t DataSource_Stream::peek(byte out[], size_t length, size_t offset) const
if(offset)
{
- secure_vector<byte> buf(offset);
+ secure_vector<uint8_t> buf(offset);
m_source.read(reinterpret_cast<char*>(buf.data()), buf.size());
if(m_source.bad())
throw Stream_IO_Error("DataSource_Stream::peek: Source failure");