Constify new work

This commit is contained in:
Willem Toorop 2015-12-22 11:32:15 +01:00
parent 5bbcbb97a1
commit fe7a1e89e3
4 changed files with 14 additions and 15 deletions

View File

@ -3085,10 +3085,9 @@ getdns_context_get_upstream_recursive_servers(getdns_context *context,
if (upstream->tsig_alg) { if (upstream->tsig_alg) {
tsig_info = _getdns_get_tsig_info(upstream->tsig_alg); tsig_info = _getdns_get_tsig_info(upstream->tsig_alg);
bindata.data = tsig_info->dname; if ((r = _getdns_dict_set_const_bindata(
bindata.size = tsig_info->dname_len; d, "tsig_algorithm",
if ((r = getdns_dict_set_bindata( tsig_info->dname_len, tsig_info->dname)))
d, "tsig_algorithm", &bindata)))
break; break;
if (upstream->tsig_dname_len) { if (upstream->tsig_dname_len) {

View File

@ -268,7 +268,7 @@ static uint8_t *_dname_label_copy(uint8_t *dst, const uint8_t *src, size_t dst_l
return r; return r;
} }
inline void _dname_canonicalize(const uint8_t *src, uint8_t *dst) inline static void _dname_canonicalize(const uint8_t *src, uint8_t *dst)
{ {
const uint8_t *next_label; const uint8_t *next_label;
@ -280,7 +280,7 @@ inline void _dname_canonicalize(const uint8_t *src, uint8_t *dst)
} }
} }
inline void _dname_canonicalize2(uint8_t *dname) inline static void _dname_canonicalize2(uint8_t *dname)
{ {
_dname_canonicalize(dname, dname); _dname_canonicalize(dname, dname);
} }

View File

@ -402,13 +402,13 @@ _getdns_network_validate_tsig(getdns_network_req *req)
{ {
_getdns_rr_iter rr_spc, *rr; _getdns_rr_iter rr_spc, *rr;
_getdns_rdf_iter rdf_spc, *rdf; _getdns_rdf_iter rdf_spc, *rdf;
uint8_t *request_mac; const uint8_t *request_mac;
uint16_t request_mac_len; uint16_t request_mac_len;
uint8_t tsig_vars[MAXIMUM_TSIG_SPACE]; uint8_t tsig_vars[MAXIMUM_TSIG_SPACE];
gldns_buffer gbuf; gldns_buffer gbuf;
uint8_t *dname; const uint8_t *dname;
size_t dname_len; size_t dname_len;
uint8_t *response_mac; const uint8_t *response_mac;
uint16_t response_mac_len; uint16_t response_mac_len;
uint8_t other_len; uint8_t other_len;
uint8_t result_mac[EVP_MAX_MD_SIZE]; uint8_t result_mac[EVP_MAX_MD_SIZE];

View File

@ -197,7 +197,7 @@ attach_edns_cookie(getdns_network_req *req)
/* Will find a matching OPT RR, but leaves the caller to validate it*/ /* Will find a matching OPT RR, but leaves the caller to validate it*/
static int static int
match_edns_opt_rr(uint16_t code, uint8_t *response, size_t response_len, match_edns_opt_rr(uint16_t code, uint8_t *response, size_t response_len,
uint8_t **position, uint16_t *option_len) const uint8_t **position, uint16_t *option_len)
{ {
_getdns_rr_iter rr_iter_storage, *rr_iter; _getdns_rr_iter rr_iter_storage, *rr_iter;
const uint8_t *pos; const uint8_t *pos;
@ -226,10 +226,10 @@ match_edns_opt_rr(uint16_t code, uint8_t *response, size_t response_len,
#if defined(STUB_DEBUG) && STUB_DEBUG #if defined(STUB_DEBUG) && STUB_DEBUG
char str_spc[8192], *str = str_spc; char str_spc[8192], *str = str_spc;
size_t str_len = sizeof(str_spc); size_t str_len = sizeof(str_spc);
uint8_t *data = rr_iter->pos; uint8_t *data = (uint8_t *)rr_iter->pos;
size_t data_len = rr_iter->nxt - rr_iter->pos; size_t data_len = rr_iter->nxt - rr_iter->pos;
(void) gldns_wire2str_rr_scan( (void) gldns_wire2str_rr_scan(
&data, &data_len, &str, &str_len, rr_iter->pkt, rr_iter->pkt_end - rr_iter->pkt); &data, &data_len, &str, &str_len, (uint8_t *)rr_iter->pkt, rr_iter->pkt_end - rr_iter->pkt);
DEBUG_STUB("OPT RR: %s", str_spc); DEBUG_STUB("OPT RR: %s", str_spc);
#endif #endif
@ -262,7 +262,7 @@ static int
match_and_process_server_cookie( match_and_process_server_cookie(
getdns_upstream *upstream, uint8_t *response, size_t response_len) getdns_upstream *upstream, uint8_t *response, size_t response_len)
{ {
uint8_t *position = NULL; const uint8_t *position = NULL;
uint16_t option_len = 0; uint16_t option_len = 0;
int found = match_edns_opt_rr(EDNS_COOKIE_OPCODE, response, int found = match_edns_opt_rr(EDNS_COOKIE_OPCODE, response,
response_len, &position, &option_len); response_len, &position, &option_len);
@ -299,7 +299,7 @@ process_keepalive(
getdns_upstream *upstream, getdns_network_req *netreq, getdns_upstream *upstream, getdns_network_req *netreq,
uint8_t *response, size_t response_len) uint8_t *response, size_t response_len)
{ {
uint8_t *position = NULL; const uint8_t *position = NULL;
uint16_t option_len = 0; uint16_t option_len = 0;
int found = match_edns_opt_rr(GLDNS_EDNS_KEEPALIVE, response, int found = match_edns_opt_rr(GLDNS_EDNS_KEEPALIVE, response,
response_len, &position, &option_len); response_len, &position, &option_len);