2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

add isc_buffer_{get,put}uint8

This commit is contained in:
Brian Wellington
1999-05-18 13:44:52 +00:00
parent 2eed8ba81c
commit 71b306bf33
2 changed files with 68 additions and 0 deletions

View File

@@ -277,6 +277,40 @@ isc_buffer_compact(isc_buffer_t *b) {
b->used = length;
}
isc_uint8_t
isc_buffer_getuint8(isc_buffer_t *b) {
unsigned char *cp;
isc_uint8_t result;
/*
* Read an unsigned 8-bit integer from 'b' and return it.
*/
REQUIRE(VALID_BUFFER(b));
REQUIRE(b->used - b->current >= 1);
cp = b->base;
cp += b->current;
b->current += 1;
result = ((unsigned int)(cp[0]));
return (result);
}
void
isc_buffer_putuint8(isc_buffer_t *b, isc_uint8_t val)
{
unsigned char *cp;
REQUIRE(VALID_BUFFER(b));
REQUIRE(b->used + 1 <= b->length);
cp = b->base;
cp += b->used;
b->used += 1;
cp[0] = (val & 0x00ff);
}
isc_uint16_t
isc_buffer_getuint16(isc_buffer_t *b) {
unsigned char *cp;