[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: path canonicalization problem (issue #559)

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2002-01-22 00:06:50 CET

On Mon, Jan 21, 2002 at 05:15:14PM -0600, Karl Fogel wrote:
> Garrett Rooney <rooneg@electricjellyfish.net> writes:
> > > > + if (svn_path_is_url ((const svn_string_t *)path))
> > >
> > > This cast relies on the members of svn_string_t being ordered the same
> > > as svn_stringbuf_t. It's true at present, but is it guaranteed?
> >
> > that's one of the things i was wondering. if it is guaranteed, it
> > would be quite useful, as one can do what i just did, and pass
> > stringbufs to functions that take const string_t *'s. if this is
> > guaranteed, we should probably document it though.
>
> Even if they are ordered the same (which I believe is guaranteed),
> they may not be padded the same. Structure members may be padded for
> alignment purposes, therefore a cast like this is technically not
> valid.
>
> I mean, *probably* it would work on every platform, because the first
> two members of both structs are the same type, and one would imagine
> that all alignment algorithms do a single left-to-right pass. But we
> shouldn't count on this, that's getting really edgy. :-)
>
> Instead, why not just declare a local svn_string_t variable and
> manually set its `data' and `len' fields to be the same as `path's?

ok, you guys have convinced me... i'll do that in the next version of
the patch i produce.

-garrett

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:57 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.