ports/92658: [PATCH] sysutils/heirloom: [Unbreak AMD64 build]

Vasil Dimov vd at FreeBSD.org
Fri Feb 3 09:34:08 PST 2006


On Wed, Feb 01, 2006 at 10:50:07PM +0000, Jeffrey H. Johnson wrote:
> The following reply was made to PR ports/92658; it has been noted by GNATS.
> 
> From: "Jeffrey H. Johnson" <CPE1704TKS at bellsouth.net>
> To: Larry Rosenman <ler at lerctr.org>, FreeBSD-gnats-submit at freebsd.org
> Cc: kris at obsecurity.org, mnag at FreeBSD.org, ports at FreeBSD.org,
>  ports-amd64 at FreeBSD.org, CPE1704TKS at bellsouth.net
> Subject: Re: ports/92658: [PATCH] sysutils/heirloom: [Unbreak AMD64 build] 
> Date: Wed, 01 Feb 2006 17:41:58 -0500
> 
>  OK, I have an update here:
>  
>  -----------------------------------
>  --- spell/spellin.c.orig      Wed Feb  1 23:34:58 2006
>  +++ spell/spellin.c   Wed Feb  1 23:27:02 2006
>  @@ -103,7 +103,7 @@
>          z = huff((1L<<HASHWIDTH)/atof(argv[1]));
>          fprintf(stderr, "%s: expected code widths = %f\n",
>              argv[0], z);
>  -       for (count = 0; scanf("%lo", (long *)&h) == 1; ++count) {
>  +       for (count = 0; scanf("%o", (long *)&h) == 1; ++count) {
>                  if ((t = h >> (HASHWIDTH - INDEXWIDTH)) != u) {
>                          if (bp != B)
>                                  wp++;
>  -----------------------------------
>  
>  This should work on all architectures where int32_t is the same size
>  as int, which I *believe* should cover all current FreeBSD platforms.

Do you like the following:

--- spellin.c.diff begins here ---
--- spell/spellin.c.orig	Fri Feb  3 19:13:19 2006
+++ spell/spellin.c	Fri Feb  3 19:19:20 2006
@@ -77,6 +77,7 @@
 main(int argc, char **argv)
 {
 	int32_t h, k, d;
+	unsigned hu;
 	int32_t  i;
 	int32_t count;
 	int32_t w1;
@@ -103,7 +104,8 @@
 	z = huff((1L<<HASHWIDTH)/atof(argv[1]));
 	fprintf(stderr, "%s: expected code widths = %f\n",
 	    argv[0], z);
-	for (count = 0; scanf("%lo", (long *)&h) == 1; ++count) {
+	for (count = 0; scanf("%o", &hu) == 1; ++count) {
+		h = (int32_t)hu;
 		if ((t = h >> (HASHWIDTH - INDEXWIDTH)) != u) {
 			if (bp != B)
 				wp++;
--- spellin.c.diff ends here ---

It is aimed at the sizeof(int) != sizeof(int32_t) case.
Unfortunately there is no way to scanf int32_t portably.

-- 
Vasil Dimov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20060203/c0e796c1/attachment.bin


More information about the freebsd-ports mailing list