Index | Thread | Search

From:
Florian Obser <florian@openbsd.org>
Subject:
Re: dig warnings
To:
Theo Buehler <tb@theobuehler.org>
Cc:
tech@openbsd.org
Date:
Fri, 17 May 2024 09:13:28 +0200

Download raw body.

Thread
On 2024-05-17 04:20 +02, Theo Buehler <tb@theobuehler.org> wrote:
> zap a unused-but-set variable

OK florian

> and make the declarations of _final match their definitions.

would it make sense to do this the other way around? Would a compiler be
able to catch mistakes that way?

OK florian to whichever way is appropriate / correct

>
> Index: lib/dns/rdataset.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/dig/lib/dns/rdataset.c,v
> diff -u -p -r1.14 rdataset.c
> --- lib/dns/rdataset.c	26 Jun 2022 09:43:39 -0000	1.14
> +++ lib/dns/rdataset.c	3 May 2024 23:05:26 -0000
> @@ -198,7 +198,7 @@ towiresorted(dns_rdataset_t *rdataset, c
>  	dns_rdata_t rdata = DNS_RDATA_INIT;
>  	isc_region_t r;
>  	isc_result_t result;
> -	unsigned int i, count = 0, added;
> +	unsigned int i, count = 0;
>  	isc_buffer_t savedbuffer, rdlen;
>  	unsigned int headlen;
>  	int question = 0;
> @@ -287,7 +287,6 @@ towiresorted(dns_rdataset_t *rdataset, c
>  
>  	savedbuffer = *target;
>  	i = 0;
> -	added = 0;
>  
>  	do {
>  		/*
> @@ -335,7 +334,6 @@ towiresorted(dns_rdataset_t *rdataset, c
>  			isc_buffer_putuint16(&rdlen,
>  					     (uint16_t)(target->used -
>  							    rdlen.used - 2));
> -			added++;
>  		}
>  
>  		if (shuffle) {
> Index: lib/isc/include/isc/sha2.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/dig/lib/isc/include/isc/sha2.h,v
> diff -u -p -r1.4 sha2.h
> --- lib/isc/include/isc/sha2.h	24 Feb 2020 13:49:38 -0000	1.4
> +++ lib/isc/include/isc/sha2.h	14 May 2024 20:41:31 -0000
> @@ -92,18 +92,18 @@ typedef isc_sha512_t isc_sha384_t;
>  
>  void isc_sha224_init (isc_sha224_t *);
>  void isc_sha224_update (isc_sha224_t *, const uint8_t *, size_t);
> -void isc_sha224_final (uint8_t[ISC_SHA224_DIGESTLENGTH], isc_sha224_t *);
> +void isc_sha224_final (uint8_t[], isc_sha224_t *);
>  
>  void isc_sha256_init (isc_sha256_t *);
>  void isc_sha256_update (isc_sha256_t *, const uint8_t *, size_t);
> -void isc_sha256_final (uint8_t[ISC_SHA256_DIGESTLENGTH], isc_sha256_t *);
> +void isc_sha256_final (uint8_t[], isc_sha256_t *);
>  
>  void isc_sha384_init (isc_sha384_t *);
>  void isc_sha384_update (isc_sha384_t *, const uint8_t *, size_t);
> -void isc_sha384_final (uint8_t[ISC_SHA384_DIGESTLENGTH], isc_sha384_t *);
> +void isc_sha384_final (uint8_t[], isc_sha384_t *);
>  
>  void isc_sha512_init (isc_sha512_t *);
>  void isc_sha512_update (isc_sha512_t *, const uint8_t *, size_t);
> -void isc_sha512_final (uint8_t[ISC_SHA512_DIGESTLENGTH], isc_sha512_t *);
> +void isc_sha512_final (uint8_t[], isc_sha512_t *);
>  
>  #endif /* ISC_SHA2_H */
>

-- 
In my defence, I have been left unsupervised.