aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-08-08 12:43:11 -0400
committerJack Lloyd <[email protected]>2015-08-08 12:43:11 -0400
commit822ebd826c090c5abbdb2ca672e4a2c45b2440dc (patch)
treee0687fe7cef807928d616759ed2605cbb0fd3afc /src/lib
parent549aaeccca01671ca94b422fe589c772349983ff (diff)
parentb42dbb7c541f96f44d2fdbc6aec56cb95f937f39 (diff)
Merge branch 'master' of https://github.com/randombit/botan
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/filters/secqueue.cpp48
-rw-r--r--src/lib/filters/secqueue.h9
2 files changed, 29 insertions, 28 deletions
diff --git a/src/lib/filters/secqueue.cpp b/src/lib/filters/secqueue.cpp
index 718223876..120e8dd0d 100644
--- a/src/lib/filters/secqueue.cpp
+++ b/src/lib/filters/secqueue.cpp
@@ -60,9 +60,9 @@ class SecureQueueNode
*/
SecureQueue::SecureQueue()
{
- bytes_read = 0;
+ m_bytes_read = 0;
set_next(nullptr, 0);
- head = tail = new SecureQueueNode;
+ m_head = m_tail = new SecureQueueNode;
}
/*
@@ -71,11 +71,11 @@ SecureQueue::SecureQueue()
SecureQueue::SecureQueue(const SecureQueue& input) :
Fanout_Filter(), DataSource()
{
- bytes_read = 0;
+ m_bytes_read = 0;
set_next(nullptr, 0);
- head = tail = new SecureQueueNode;
- SecureQueueNode* temp = input.head;
+ m_head = m_tail = new SecureQueueNode;
+ SecureQueueNode* temp = input.m_head;
while(temp)
{
write(&temp->buffer[temp->start], temp->end - temp->start);
@@ -88,14 +88,14 @@ SecureQueue::SecureQueue(const SecureQueue& input) :
*/
void SecureQueue::destroy()
{
- SecureQueueNode* temp = head;
+ SecureQueueNode* temp = m_head;
while(temp)
{
SecureQueueNode* holder = temp->next;
delete temp;
temp = holder;
}
- head = tail = nullptr;
+ m_head = m_tail = nullptr;
}
/*
@@ -104,8 +104,8 @@ void SecureQueue::destroy()
SecureQueue& SecureQueue::operator=(const SecureQueue& input)
{
destroy();
- head = tail = new SecureQueueNode;
- SecureQueueNode* temp = input.head;
+ m_head = m_tail = new SecureQueueNode;
+ SecureQueueNode* temp = input.m_head;
while(temp)
{
write(&temp->buffer[temp->start], temp->end - temp->start);
@@ -119,17 +119,17 @@ SecureQueue& SecureQueue::operator=(const SecureQueue& input)
*/
void SecureQueue::write(const byte input[], size_t length)
{
- if(!head)
- head = tail = new SecureQueueNode;
+ if(!m_head)
+ m_head = m_tail = new SecureQueueNode;
while(length)
{
- const size_t n = tail->write(input, length);
+ const size_t n = m_tail->write(input, length);
input += n;
length -= n;
if(length)
{
- tail->next = new SecureQueueNode;
- tail = tail->next;
+ m_tail->next = new SecureQueueNode;
+ m_tail = m_tail->next;
}
}
}
@@ -140,20 +140,20 @@ void SecureQueue::write(const byte input[], size_t length)
size_t SecureQueue::read(byte output[], size_t length)
{
size_t got = 0;
- while(length && head)
+ while(length && m_head)
{
- const size_t n = head->read(output, length);
+ const size_t n = m_head->read(output, length);
output += n;
got += n;
length -= n;
- if(head->size() == 0)
+ if(m_head->size() == 0)
{
- SecureQueueNode* holder = head->next;
- delete head;
- head = holder;
+ SecureQueueNode* holder = m_head->next;
+ delete m_head;
+ m_head = holder;
}
}
- bytes_read += got;
+ m_bytes_read += got;
return got;
}
@@ -162,7 +162,7 @@ size_t SecureQueue::read(byte output[], size_t length)
*/
size_t SecureQueue::peek(byte output[], size_t length, size_t offset) const
{
- SecureQueueNode* current = head;
+ SecureQueueNode* current = m_head;
while(offset && current)
{
@@ -193,7 +193,7 @@ size_t SecureQueue::peek(byte output[], size_t length, size_t offset) const
*/
size_t SecureQueue::get_bytes_read() const
{
- return bytes_read;
+ return m_bytes_read;
}
/*
@@ -201,7 +201,7 @@ size_t SecureQueue::get_bytes_read() const
*/
size_t SecureQueue::size() const
{
- SecureQueueNode* current = head;
+ SecureQueueNode* current = m_head;
size_t count = 0;
while(current)
diff --git a/src/lib/filters/secqueue.h b/src/lib/filters/secqueue.h
index b548f367f..33afd478a 100644
--- a/src/lib/filters/secqueue.h
+++ b/src/lib/filters/secqueue.h
@@ -32,7 +32,7 @@ class BOTAN_DLL SecureQueue : public Fanout_Filter, public DataSource
bool empty() const;
- bool check_available(size_t n) { return n <= size(); }
+ bool check_available(size_t n) override { return n <= size(); }
/**
* @return number of bytes available in the queue
@@ -59,11 +59,12 @@ class BOTAN_DLL SecureQueue : public Fanout_Filter, public DataSource
SecureQueue(const SecureQueue& other);
~SecureQueue() { destroy(); }
+
private:
- size_t bytes_read;
void destroy();
- class SecureQueueNode* head;
- class SecureQueueNode* tail;
+ size_t m_bytes_read;
+ class SecureQueueNode* m_head;
+ class SecureQueueNode* m_tail;
};
}