mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
Replace custom isc_u?intNN_t types with C99 u?intNN_t types
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
/*! \file */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <isc/base64.h>
|
||||
#include <isc/hex.h>
|
||||
@@ -157,27 +159,27 @@ static void
|
||||
buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region);
|
||||
|
||||
static isc_result_t
|
||||
uint32_tobuffer(isc_uint32_t, isc_buffer_t *target);
|
||||
uint32_tobuffer(uint32_t, isc_buffer_t *target);
|
||||
|
||||
static isc_result_t
|
||||
uint16_tobuffer(isc_uint32_t, isc_buffer_t *target);
|
||||
uint16_tobuffer(uint32_t, isc_buffer_t *target);
|
||||
|
||||
static isc_result_t
|
||||
uint8_tobuffer(isc_uint32_t, isc_buffer_t *target);
|
||||
uint8_tobuffer(uint32_t, isc_buffer_t *target);
|
||||
|
||||
static isc_result_t
|
||||
name_tobuffer(const dns_name_t *name, isc_buffer_t *target);
|
||||
|
||||
static isc_uint32_t
|
||||
static uint32_t
|
||||
uint32_fromregion(isc_region_t *region);
|
||||
|
||||
static isc_uint16_t
|
||||
static uint16_t
|
||||
uint16_fromregion(isc_region_t *region);
|
||||
|
||||
static isc_uint8_t
|
||||
static uint8_t
|
||||
uint8_fromregion(isc_region_t *region);
|
||||
|
||||
static isc_uint8_t
|
||||
static uint8_t
|
||||
uint8_consume_fromregion(isc_region_t *region);
|
||||
|
||||
static isc_result_t
|
||||
@@ -219,7 +221,7 @@ static void
|
||||
warn_badmx(isc_token_t *token, isc_lex_t *lexer,
|
||||
dns_rdatacallbacks_t *callbacks);
|
||||
|
||||
static isc_uint16_t
|
||||
static uint16_t
|
||||
uint16_consume_fromregion(isc_region_t *region);
|
||||
|
||||
static isc_result_t
|
||||
@@ -727,7 +729,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
|
||||
isc_buffer_t ss;
|
||||
isc_buffer_t st;
|
||||
isc_boolean_t use_default = ISC_FALSE;
|
||||
isc_uint32_t activelength;
|
||||
uint32_t activelength;
|
||||
unsigned int length;
|
||||
|
||||
REQUIRE(dctx != NULL);
|
||||
@@ -822,7 +824,7 @@ dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx,
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
*target = st;
|
||||
INSIST(target->used < 65536);
|
||||
dns_compress_rollback(cctx, (isc_uint16_t)target->used);
|
||||
dns_compress_rollback(cctx, (uint16_t)target->used);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
@@ -1732,7 +1734,7 @@ buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
uint32_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
|
||||
uint32_tobuffer(uint32_t value, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
@@ -1743,7 +1745,7 @@ uint32_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
uint16_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
|
||||
uint16_tobuffer(uint32_t value, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
if (value > 0xffff)
|
||||
@@ -1751,12 +1753,12 @@ uint16_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
if (region.length < 2)
|
||||
return (ISC_R_NOSPACE);
|
||||
isc_buffer_putuint16(target, (isc_uint16_t)value);
|
||||
isc_buffer_putuint16(target, (uint16_t)value);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
uint8_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
|
||||
uint8_tobuffer(uint32_t value, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
if (value > 0xff)
|
||||
@@ -1764,7 +1766,7 @@ uint8_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
if (region.length < 1)
|
||||
return (ISC_R_NOSPACE);
|
||||
isc_buffer_putuint8(target, (isc_uint8_t)value);
|
||||
isc_buffer_putuint8(target, (uint8_t)value);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1775,27 +1777,27 @@ name_tobuffer(const dns_name_t *name, isc_buffer_t *target) {
|
||||
return (isc_buffer_copyregion(target, &r));
|
||||
}
|
||||
|
||||
static isc_uint32_t
|
||||
static uint32_t
|
||||
uint32_fromregion(isc_region_t *region) {
|
||||
isc_uint32_t value;
|
||||
uint32_t value;
|
||||
|
||||
REQUIRE(region->length >= 4);
|
||||
value = (isc_uint32_t)region->base[0] << 24;
|
||||
value |= (isc_uint32_t)region->base[1] << 16;
|
||||
value |= (isc_uint32_t)region->base[2] << 8;
|
||||
value |= (isc_uint32_t)region->base[3];
|
||||
value = (uint32_t)region->base[0] << 24;
|
||||
value |= (uint32_t)region->base[1] << 16;
|
||||
value |= (uint32_t)region->base[2] << 8;
|
||||
value |= (uint32_t)region->base[3];
|
||||
return(value);
|
||||
}
|
||||
|
||||
static isc_uint16_t
|
||||
static uint16_t
|
||||
uint16_consume_fromregion(isc_region_t *region) {
|
||||
isc_uint16_t r = uint16_fromregion(region);
|
||||
uint16_t r = uint16_fromregion(region);
|
||||
|
||||
isc_region_consume(region, 2);
|
||||
return r;
|
||||
}
|
||||
|
||||
static isc_uint16_t
|
||||
static uint16_t
|
||||
uint16_fromregion(isc_region_t *region) {
|
||||
|
||||
REQUIRE(region->length >= 2);
|
||||
@@ -1803,7 +1805,7 @@ uint16_fromregion(isc_region_t *region) {
|
||||
return ((region->base[0] << 8) | region->base[1]);
|
||||
}
|
||||
|
||||
static isc_uint8_t
|
||||
static uint8_t
|
||||
uint8_fromregion(isc_region_t *region) {
|
||||
|
||||
REQUIRE(region->length >= 1);
|
||||
@@ -1811,9 +1813,9 @@ uint8_fromregion(isc_region_t *region) {
|
||||
return (region->base[0]);
|
||||
}
|
||||
|
||||
static isc_uint8_t
|
||||
static uint8_t
|
||||
uint8_consume_fromregion(isc_region_t *region) {
|
||||
isc_uint8_t r = uint8_fromregion(region);
|
||||
uint8_t r = uint8_fromregion(region);
|
||||
|
||||
isc_region_consume(region, 1);
|
||||
return r;
|
||||
@@ -1885,11 +1887,11 @@ static const char atob_digits[86] =
|
||||
|
||||
|
||||
struct state {
|
||||
isc_int32_t Ceor;
|
||||
isc_int32_t Csum;
|
||||
isc_int32_t Crot;
|
||||
isc_int32_t word;
|
||||
isc_int32_t bcount;
|
||||
int32_t Ceor;
|
||||
int32_t Csum;
|
||||
int32_t Crot;
|
||||
int32_t word;
|
||||
int32_t bcount;
|
||||
};
|
||||
|
||||
#define Ceor state->Ceor
|
||||
@@ -1923,15 +1925,15 @@ byte_atob(int c, isc_buffer_t *target, struct state *state) {
|
||||
}
|
||||
} else if ((s = strchr(atob_digits, c)) != NULL) {
|
||||
if (bcount == 0) {
|
||||
word = (isc_int32_t)(s - atob_digits);
|
||||
word = (int32_t)(s - atob_digits);
|
||||
++bcount;
|
||||
} else if (bcount < 4) {
|
||||
word = times85(word);
|
||||
word += (isc_int32_t)(s - atob_digits);
|
||||
word += (int32_t)(s - atob_digits);
|
||||
++bcount;
|
||||
} else {
|
||||
word = times85(word);
|
||||
word += (isc_int32_t)(s - atob_digits);
|
||||
word += (int32_t)(s - atob_digits);
|
||||
RETERR(putbyte((word >> 24) & 0xff, target, state));
|
||||
RETERR(putbyte((word >> 16) & 0xff, target, state));
|
||||
RETERR(putbyte((word >> 8) & 0xff, target, state));
|
||||
@@ -2076,25 +2078,25 @@ byte_btoa(int c, isc_buffer_t *target, struct state *state) {
|
||||
isc_buffer_add(target, 1);
|
||||
} else {
|
||||
register int tmp = 0;
|
||||
register isc_int32_t tmpword = word;
|
||||
register int32_t tmpword = word;
|
||||
|
||||
if (tmpword < 0) {
|
||||
/*
|
||||
* Because some don't support u_long.
|
||||
*/
|
||||
tmp = 32;
|
||||
tmpword -= (isc_int32_t)(85 * 85 * 85 * 85 * 32);
|
||||
tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
|
||||
}
|
||||
if (tmpword < 0) {
|
||||
tmp = 64;
|
||||
tmpword -= (isc_int32_t)(85 * 85 * 85 * 85 * 32);
|
||||
tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
|
||||
}
|
||||
if (tr.length < 5)
|
||||
return (ISC_R_NOSPACE);
|
||||
tr.base[0] = atob_digits[(tmpword /
|
||||
(isc_int32_t)(85 * 85 * 85 * 85))
|
||||
(int32_t)(85 * 85 * 85 * 85))
|
||||
+ tmp];
|
||||
tmpword %= (isc_int32_t)(85 * 85 * 85 * 85);
|
||||
tmpword %= (int32_t)(85 * 85 * 85 * 85);
|
||||
tr.base[1] = atob_digits[tmpword / (85 * 85 * 85)];
|
||||
tmpword %= (85 * 85 * 85);
|
||||
tr.base[2] = atob_digits[tmpword / (85 * 85)];
|
||||
|
Reference in New Issue
Block a user