Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 2003 08:50:35 -0700 (PDT)
From:      Robert Drehmel <robert@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28823 for review
Message-ID:  <200304121550.h3CFoZKf020076@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28823

Change 28823 by robert@robert_spes on 2003/04/12 08:50:32

	Use exact (and more) casts to be able to compile this with GCC 3.3 without
	warnings, which in turn enables compilation of libstand with -Werror.

Affected files ...

.. //depot/projects/mips/lib/libc/string/bcopy.c#2 edit

Differences ...

==== //depot/projects/mips/lib/libc/string/bcopy.c#2 (text+ko) ====

@@ -40,6 +40,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/bcopy.c,v 1.5 2002/09/01 21:53:46 robert Exp $");
 
+#include <stdint.h>
+
 /*
  * sizeof(word) MUST BE A POWER OF TWO
  * SO THAT wmask BELOW IS ALL ONES
@@ -88,13 +90,13 @@
 		/*
 		 * Copy forward.
 		 */
-		t = (int)src;	/* only need low bits */
-		if ((t | (int)dst) & wmask) {
+		t = (uint32_t)(uintptr_t)src;	/* only need low bits */
+		if ((t | (uint32_t)(uintptr_t)dst) & wmask) {
 			/*
 			 * Try to align operands.  This cannot be done
 			 * unless the low bits match.
 			 */
-			if ((t ^ (int)dst) & wmask || length < wsize)
+			if ((t ^ (uint32_t)(uintptr_t)dst) & wmask || length < wsize)
 				t = length;
 			else
 				t = wsize - (t & wmask);
@@ -116,9 +118,9 @@
 		 */
 		src += length;
 		dst += length;
-		t = (int)src;
-		if ((t | (int)dst) & wmask) {
-			if ((t ^ (int)dst) & wmask || length <= wsize)
+		t = (uint32_t)(uintptr_t)src;
+		if ((t | (uint32_t)(uintptr_t)dst) & wmask) {
+			if ((t ^ (uint32_t)(uintptr_t)dst) & wmask || length <= wsize)
 				t = length;
 			else
 				t &= wmask;



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