Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2006 19:34:04 +0200
From:      Vasil Dimov <vd@FreeBSD.org>
To:        "Jeffrey H\. Johnson" <CPE1704TKS@bellsouth.net>
Cc:        mnag@FreeBSD.org, ports@FreeBSD.org, kris@obsecurity.org, bug-followup@FreeBSD.org
Subject:   Re: ports/92658: [PATCH] sysutils/heirloom: [Unbreak AMD64 build]
Message-ID:  <20060203173404.GA14142@qlovarnika.bg.datamax>
In-Reply-To: <200602012250.k11Mo7w1026196@freefall.freebsd.org>
References:  <200602012250.k11Mo7w1026196@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--M9NhX3UHpAaciwkO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 GNAT=
S.
>=20
> From: "Jeffrey H. Johnson" <CPE1704TKS@bellsouth.net>
> To: Larry Rosenman <ler@lerctr.org>, FreeBSD-gnats-submit@freebsd.org
> Cc: kris@obsecurity.org, mnag@FreeBSD.org, ports@FreeBSD.org,
>  ports-amd64@FreeBSD.org, CPE1704TKS@bellsouth.net
> Subject: Re: ports/92658: [PATCH] sysutils/heirloom: [Unbreak AMD64 build=
]=20
> Date: Wed, 01 Feb 2006 17:41:58 -0500
>=20
>  OK, I have an update here:
> =20
>  -----------------------------------
>  --- 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 =3D huff((1L<<HASHWIDTH)/atof(argv[1]));
>          fprintf(stderr, "%s: expected code widths =3D %f\n",
>              argv[0], z);
>  -       for (count =3D 0; scanf("%lo", (long *)&h) =3D=3D 1; ++count) {
>  +       for (count =3D 0; scanf("%o", (long *)&h) =3D=3D 1; ++count) {
>                  if ((t =3D h >> (HASHWIDTH - INDEXWIDTH)) !=3D u) {
>                          if (bp !=3D B)
>                                  wp++;
>  -----------------------------------
> =20
>  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 =3D huff((1L<<HASHWIDTH)/atof(argv[1]));
 	fprintf(stderr, "%s: expected code widths =3D %f\n",
 	    argv[0], z);
-	for (count =3D 0; scanf("%lo", (long *)&h) =3D=3D 1; ++count) {
+	for (count =3D 0; scanf("%o", &hu) =3D=3D 1; ++count) {
+		h =3D (int32_t)hu;
 		if ((t =3D h >> (HASHWIDTH - INDEXWIDTH)) !=3D u) {
 			if (bp !=3D B)
 				wp++;
--- spellin.c.diff ends here ---

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

--=20
Vasil Dimov

--M9NhX3UHpAaciwkO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----

iD8DBQFD45QMFw6SP/bBpCARAszPAKCbpPJMj7WVpQ6p60+v0Y7g0BQptwCgp/Nz
D4PrPPDo0a9+bZmVczJIKaE=
=w5Pp
-----END PGP SIGNATURE-----

--M9NhX3UHpAaciwkO--



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