[Xastir-dev] Proposal to clean up some warnings

Tom Russo russo at bogodyn.org
Wed Jun 9 14:43:46 EDT 2010


On Wed, Jun 09, 2010 at 11:16:57AM -0700, we recorded a bogon-computron collision of the <curt.we7u at gmail.com> flavor, containing:
> On Wed, 9 Jun 2010, Curt, WE7U wrote:
> 
> > I'm not seeing _any_ compiler warnings such as you describe when I
> > do a "make clean;make".
> 
> Here's the complete set of warnings I see on a 64-bit machine:

The warnings below are all from the RTree library (a library we got from
a public-domain source, very old C code):

> index.c: In function ?Xastir_RTreeSearch?:
> index.c:86: warning: cast from pointer to integer of different size

Ugh.  Just looked at that one.  Turns out that in the RTree structure,
there's an element called "child" that usually contains a pointer to a
childe node of the tree.  If the node is a leaf node, however, the child
field (which is of type Node *) is re-used to hold the integer ID of the
data record represented by that leaf node.  So in a number of cases, there's
casts to int of the contents of the child field --- the code is careful 
only to do so when the child field contains an integer, not a pointer, but
it's throwing size warnings like that.  Feh.

line 86 casts a child field to an int.

> index.c: In function ?Xastir_RTreeInsertRect2?:
> index.c:147: warning: cast to pointer from integer of different size

And that one is where it casts an int to a pointer to store in child.

> index.c: In function ?Xastir_RTreeDeleteRect2?:
> index.c:287: warning: cast to pointer from integer of different size

And this one casts an int to a pointer to compare it to the contents of
a child field.

A bit messy, but since the code is carefully using the child field of the
struct as an int only when it has in fact stored an int there, it won't
be broken on 64-bit.  Would be nice to be able to clean that up, though.

The RTree code is essentially unmodified from the original library from which
we took it (which was obtained from www.superliminal.com).

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236        http://kevan.org/brain.cgi?DDTNM
 "It is better to live on your feet than to die with your knees."
  -- Mil Millington on running, in Instructions for Living Someone Else's Life




More information about the Xastir-dev mailing list