The size differencs in rpmal.c were intetional (but stoopid).
union looks fine.
73 de Jeff
On Nov 12, 2007, at 8:42 AM, Ralf S. Engelschall wrote:
> RPM Package Manager, CVS Repository
> http://rpm5.org/cvs/
>
> ______________________________________________________________________
> ______
>
> Server: rpm5.org Name: Ralf S. Engelschall
> Root: /v/rpm/cvs Email: rse@rpm5.org
> Module: rpm Date: 12-Nov-2007
> 14:42:20
> Branch: HEAD Handle: 2007111213422000
>
> Modified files:
> rpm/lib rpmal.c
>
> Log:
> One more ISO-C invalid but in this particular case semantically
> acceptable conversions from integers to a pointers:
>
> rpmal.c: In function 'alKey2Num':
> rpmal.c:154: warning: cast from pointer to integer of different
> size
> rpmal.c: In function 'alNum2Key':
> rpmal.c:163: warning: cast to pointer from integer of different
> size
> rpmal.c: In function 'rpmalMakeIndex':
> rpmal.c:673: warning: cast to pointer from integer of different
> size
>
> Fixed again by using the only really portable ISO-C solution: a
> "union".
>
> Summary:
> Revision Changes Path
> 2.62 +7 -3 rpm/lib/rpmal.c
>
> ______________________________________________________________________
> ______
>
> patch -p0 <<'@@ .'
> Index: rpm/lib/rpmal.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.61 -r2.62 rpmal.c
> --- rpm/lib/rpmal.c 30 Sep 2007 20:38:25 -0000 2.61
> +++ rpm/lib/rpmal.c 12 Nov 2007 13:42:20 -0000 2.62
> @@ -151,7 +151,9 @@
> /*@*/
> {
> /*@-nullret -temptrans -retalias @*/
> - return ((alNum)pkgKey);
> + union { alKey key; alNum num; } u;
> + u.key = pkgKey;
> + return u.num;
> /*@=nullret =temptrans =retalias @*/
> }
>
> @@ -160,7 +162,9 @@
> /*@*/
> {
> /*@-nullret -temptrans -retalias @*/
> - return ((alKey)pkgNum);
> + union { alKey key; alNum num; } u;
> + u.num = pkgNum;
> + return u.key;
> /*@=nullret =temptrans =retalias @*/
> }
>
> @@ -670,7 +674,7 @@
> ai->k = 0;
> for (i = 0; i < al->size; i++) {
> alp = al->list + i;
> - rpmalAddProvides(al, (alKey)i, alp->provides, alp->tscolor);
> + rpmalAddProvides(al, alNum2Key(NULL, (alNum)i), alp->provides,
> alp->tscolor);
> }
>
> /* Reset size to the no. of provides added. */
> @@ .
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> CVS Sources Repository rpm-cvs@rpm5.org
Received on Mon Nov 12 14:53:04 2007