Clean up some stuff, including a few spots where exceptions were not being handled correctly.

This commit is contained in:
Adam Ierymenko 2013-10-18 14:16:53 -04:00
parent 03b909603a
commit ca93b4a1ac
15 changed files with 42 additions and 66 deletions

View file

@ -301,6 +301,25 @@ public:
append(b._b,b._l);
}
/**
* Increment size and return pointer to field of specified size
*
* The memory isn't actually written, so this is a shortcut for a multi-step
* process involving getting the current pointer and adding size.
*
* @param l Length of field to append
* @return Pointer to beginning of appended field of length 'l'
*/
inline char *appendField(unsigned int l)
throw(std::out_of_range)
{
if ((_l + l) > C)
throw std::out_of_range("Buffer: append beyond capacity");
char *r = _b + _l;
_l += l;
return r;
}
/**
* Increment size by a given number of bytes
*