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

Replace custom isc_u?intNN_t types with C99 u?intNN_t types

This commit is contained in:
Ondřej Surý
2018-03-28 14:19:37 +02:00
parent 055278c936
commit cb6a185c69
390 changed files with 2812 additions and 2528 deletions

View File

@@ -269,10 +269,10 @@ isc_buffer_compact(isc_buffer_t *b) {
b->used = length;
}
isc_uint8_t
uint8_t
isc_buffer_getuint8(isc_buffer_t *b) {
unsigned char *cp;
isc_uint8_t result;
uint8_t result;
/*
* Read an unsigned 8-bit integer from 'b' and return it.
@@ -283,13 +283,13 @@ isc_buffer_getuint8(isc_buffer_t *b) {
cp = isc_buffer_current(b);
b->current += 1;
result = ((isc_uint8_t)(cp[0]));
result = ((uint8_t)(cp[0]));
return (result);
}
void
isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val) {
isc__buffer_putuint8(isc_buffer_t *b, uint8_t val) {
isc_result_t result;
REQUIRE(ISC_BUFFER_VALID(b));
if (ISC_UNLIKELY(b->autore)) {
@@ -301,10 +301,10 @@ isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val) {
ISC__BUFFER_PUTUINT8(b, val);
}
isc_uint16_t
uint16_t
isc_buffer_getuint16(isc_buffer_t *b) {
unsigned char *cp;
isc_uint16_t result;
uint16_t result;
/*
* Read an unsigned 16-bit integer in network byte order from 'b',
@@ -323,7 +323,7 @@ isc_buffer_getuint16(isc_buffer_t *b) {
}
void
isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val) {
isc__buffer_putuint16(isc_buffer_t *b, uint16_t val) {
isc_result_t result;
REQUIRE(ISC_BUFFER_VALID(b));
if (ISC_UNLIKELY(b->autore)) {
@@ -336,7 +336,7 @@ isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val) {
}
void
isc__buffer_putuint24(isc_buffer_t *b, isc_uint32_t val) {
isc__buffer_putuint24(isc_buffer_t *b, uint32_t val) {
isc_result_t result;
REQUIRE(ISC_BUFFER_VALID(b));
if (ISC_UNLIKELY(b->autore)) {
@@ -348,10 +348,10 @@ isc__buffer_putuint24(isc_buffer_t *b, isc_uint32_t val) {
ISC__BUFFER_PUTUINT24(b, val);
}
isc_uint32_t
uint32_t
isc_buffer_getuint32(isc_buffer_t *b) {
unsigned char *cp;
isc_uint32_t result;
uint32_t result;
/*
* Read an unsigned 32-bit integer in network byte order from 'b',
@@ -372,7 +372,7 @@ isc_buffer_getuint32(isc_buffer_t *b) {
}
void
isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val) {
isc__buffer_putuint32(isc_buffer_t *b, uint32_t val) {
isc_result_t result;
REQUIRE(ISC_BUFFER_VALID(b));
if (ISC_UNLIKELY(b->autore)) {
@@ -384,10 +384,10 @@ isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val) {
ISC__BUFFER_PUTUINT32(b, val);
}
isc_uint64_t
uint64_t
isc_buffer_getuint48(isc_buffer_t *b) {
unsigned char *cp;
isc_uint64_t result;
uint64_t result;
/*
* Read an unsigned 48-bit integer in network byte order from 'b',
@@ -399,21 +399,21 @@ isc_buffer_getuint48(isc_buffer_t *b) {
cp = isc_buffer_current(b);
b->current += 6;
result = ((isc_int64_t)(cp[0])) << 40;
result |= ((isc_int64_t)(cp[1])) << 32;
result |= ((isc_int64_t)(cp[2])) << 24;
result |= ((isc_int64_t)(cp[3])) << 16;
result |= ((isc_int64_t)(cp[4])) << 8;
result |= ((isc_int64_t)(cp[5]));
result = ((int64_t)(cp[0])) << 40;
result |= ((int64_t)(cp[1])) << 32;
result |= ((int64_t)(cp[2])) << 24;
result |= ((int64_t)(cp[3])) << 16;
result |= ((int64_t)(cp[4])) << 8;
result |= ((int64_t)(cp[5]));
return (result);
}
void
isc__buffer_putuint48(isc_buffer_t *b, isc_uint64_t val) {
isc__buffer_putuint48(isc_buffer_t *b, uint64_t val) {
isc_result_t result;
isc_uint16_t valhi;
isc_uint32_t vallo;
uint16_t valhi;
uint32_t vallo;
REQUIRE(ISC_BUFFER_VALID(b));
if (ISC_UNLIKELY(b->autore)) {
@@ -422,8 +422,8 @@ isc__buffer_putuint48(isc_buffer_t *b, isc_uint64_t val) {
}
REQUIRE(isc_buffer_availablelength(b) >= 6);
valhi = (isc_uint16_t)(val >> 32);
vallo = (isc_uint32_t)(val & 0xFFFFFFFF);
valhi = (uint16_t)(val >> 32);
vallo = (uint32_t)(val & 0xFFFFFFFF);
ISC__BUFFER_PUTUINT16(b, valhi);
ISC__BUFFER_PUTUINT32(b, vallo);
}
@@ -468,7 +468,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
}
void
isc_buffer_putdecint(isc_buffer_t *b, isc_int64_t v) {
isc_buffer_putdecint(isc_buffer_t *b, int64_t v) {
unsigned int l=0;
unsigned char *cp;
char buf[21];
@@ -572,7 +572,7 @@ isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
isc_result_t
isc_buffer_reserve(isc_buffer_t **dynbuffer, unsigned int size) {
unsigned char *bdata;
isc_uint64_t len;
uint64_t len;
REQUIRE(dynbuffer != NULL);
REQUIRE(ISC_BUFFER_VALID(*dynbuffer));