Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 May 2014 15:32:16 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266238 - head/contrib/ldns/ldns
Message-ID:  <201405161532.s4GFWGvh006504@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Fri May 16 15:32:16 2014
New Revision: 266238
URL: http://svnweb.freebsd.org/changeset/base/266238

Log:
  Don't cast away the const qualifier.  Fixes gcc build.

Modified:
  head/contrib/ldns/ldns/util.h
  head/contrib/ldns/ldns/util.h.in

Modified: head/contrib/ldns/ldns/util.h
==============================================================================
--- head/contrib/ldns/ldns/util.h	Fri May 16 15:02:12 2014	(r266237)
+++ head/contrib/ldns/ldns/util.h	Fri May 16 15:32:16 2014	(r266238)
@@ -70,9 +70,9 @@ INLINE uint16_t
 ldns_read_uint16(const void *src)
 {
 #ifdef ALLOW_UNALIGNED_ACCESSES
-	return ntohs(*(uint16_t *) src);
+	return ntohs(*(const uint16_t *) src);
 #else
-	uint8_t *p = (uint8_t *) src;
+	const uint8_t *p = (const uint8_t *) src;
 	return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
 #endif
 }
@@ -81,9 +81,9 @@ INLINE uint32_t
 ldns_read_uint32(const void *src)
 {
 #ifdef ALLOW_UNALIGNED_ACCESSES
-	return ntohl(*(uint32_t *) src);
+	return ntohl(*(const uint32_t *) src);
 #else
-	uint8_t *p = (uint8_t *) src;
+	const uint8_t *p = (const uint8_t *) src;
 	return (  ((uint32_t) p[0] << 24)
 		| ((uint32_t) p[1] << 16)
 		| ((uint32_t) p[2] << 8)

Modified: head/contrib/ldns/ldns/util.h.in
==============================================================================
--- head/contrib/ldns/ldns/util.h.in	Fri May 16 15:02:12 2014	(r266237)
+++ head/contrib/ldns/ldns/util.h.in	Fri May 16 15:32:16 2014	(r266238)
@@ -70,9 +70,9 @@ INLINE uint16_t
 ldns_read_uint16(const void *src)
 {
 #ifdef ALLOW_UNALIGNED_ACCESSES
-	return ntohs(*(uint16_t *) src);
+	return ntohs(*(const uint16_t *) src);
 #else
-	uint8_t *p = (uint8_t *) src;
+	const uint8_t *p = (const uint8_t *) src;
 	return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
 #endif
 }
@@ -81,9 +81,9 @@ INLINE uint32_t
 ldns_read_uint32(const void *src)
 {
 #ifdef ALLOW_UNALIGNED_ACCESSES
-	return ntohl(*(uint32_t *) src);
+	return ntohl(*(const uint32_t *) src);
 #else
-	uint8_t *p = (uint8_t *) src;
+	const uint8_t *p = (const uint8_t *) src;
 	return (  ((uint32_t) p[0] << 24)
 		| ((uint32_t) p[1] << 16)
 		| ((uint32_t) p[2] << 8)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405161532.s4GFWGvh006504>