summaryrefslogtreecommitdiff
path: root/node/Buffer.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-01 10:22:57 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-01 10:22:57 -0800
commit2bf9145ae65385bf968542619ffcf204cf6241d8 (patch)
treeb97d30342ef7c34fe0a1b236635d78ec29ed40d9 /node/Buffer.hpp
parent127bcb02ffd09b522678c7e50aae21a1ecd87e4e (diff)
downloadinfinitytier-2bf9145ae65385bf968542619ffcf204cf6241d8.tar.gz
infinitytier-2bf9145ae65385bf968542619ffcf204cf6241d8.zip
Outgoing side of packet counter for link quality reporting. Also some cleanup and a cluster mode build fix.
Diffstat (limited to 'node/Buffer.hpp')
-rw-r--r--node/Buffer.hpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp
index 1a478894..37f39e7b 100644
--- a/node/Buffer.hpp
+++ b/node/Buffer.hpp
@@ -79,8 +79,7 @@ public:
inline const_reverse_iterator rbegin() const { return const_reverse_iterator(begin()); }
inline const_reverse_iterator rend() const { return const_reverse_iterator(end()); }
- Buffer()
- throw() :
+ Buffer() :
_l(0)
{
}
@@ -419,87 +418,70 @@ public:
/**
* Set buffer data length to zero
*/
- inline void clear()
- throw()
- {
- _l = 0;
- }
+ inline void clear() { _l = 0; }
/**
* Zero buffer up to size()
*/
- inline void zero()
- throw()
- {
- memset(_b,0,_l);
- }
+ inline void zero() { memset(_b,0,_l); }
/**
* Zero unused capacity area
*/
- inline void zeroUnused()
- throw()
- {
- memset(_b + _l,0,C - _l);
- }
+ inline void zeroUnused() { memset(_b + _l,0,C - _l); }
/**
* Unconditionally and securely zero buffer's underlying memory
*/
- inline void burn()
- throw()
- {
- Utils::burn(_b,sizeof(_b));
- }
+ inline void burn() { Utils::burn(_b,sizeof(_b)); }
/**
* @return Constant pointer to data in buffer
*/
- inline const void *data() const throw() { return _b; }
+ inline const void *data() const { return _b; }
+
+ /**
+ * @return Non-constant pointer to data in buffer
+ */
+ inline void *unsafeData() { return _b; }
/**
* @return Size of data in buffer
*/
- inline unsigned int size() const throw() { return _l; }
+ inline unsigned int size() const { return _l; }
/**
* @return Capacity of buffer
*/
- inline unsigned int capacity() const throw() { return C; }
+ inline unsigned int capacity() const { return C; }
template<unsigned int C2>
inline bool operator==(const Buffer<C2> &b) const
- throw()
{
return ((_l == b._l)&&(!memcmp(_b,b._b,_l)));
}
template<unsigned int C2>
inline bool operator!=(const Buffer<C2> &b) const
- throw()
{
return ((_l != b._l)||(memcmp(_b,b._b,_l)));
}
template<unsigned int C2>
inline bool operator<(const Buffer<C2> &b) const
- throw()
{
return (memcmp(_b,b._b,std::min(_l,b._l)) < 0);
}
template<unsigned int C2>
inline bool operator>(const Buffer<C2> &b) const
- throw()
{
return (b < *this);
}
template<unsigned int C2>
inline bool operator<=(const Buffer<C2> &b) const
- throw()
{
return !(b < *this);
}
template<unsigned int C2>
inline bool operator>=(const Buffer<C2> &b) const
- throw()
{
return !(*this < b);
}