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

Re: CVS update: subversion/subversion/include svn_delta.h

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-03-02 00:09:21 CET

On Thu, Mar 01, 2001 at 11:10:54AM -0600, Ben Collins-Sussman wrote:
> Greg Stein <gstein@lyra.org> writes:
> > > svn_error_t *apply_string_as_delta (svn_string_t *string
> > > svn_txdelta_window_handler_t *handler,
> > > void *baton);
> > >
> > I have a function almost exactly like the above in libsvn_ra_dav/fetch.c.
> > Take a look at fetch_file_reader(). It happens to have a baton that carries
> > the "handler" and "baton" that GregH quoted above, but passing those
> > explicitly is easy. Then, it takes a buffer/length pair and applies that.
> Interesting... I may just steal your routine, GregS.
> Two questions about it:
> * I notice that you *statically* declare and initialize a window
> struct, and even an svn_string_t. Isn't this a dangerous,
> non-robust practice? :)

Why would it be dangerous? Nobody can write outside of those bounds, and
nobody should be attempting to free() the pointer.

It does point out, though, that the svn_txdelta_window_handler_t should take
a "const svn_txdelta_window_t" and that the "ops" member should be "const
svn_txdelta_op_t *".

Personally, I would also change new_data to "const char *" and a length.

> * Your function isn't pushing a 0 after pushing its window. Is that
> being done by the caller? Shouldn't it be done by your func?

0 signifies the end of stream. It isn't done after each window. Take a look
at the function again, though: if len==0, it does push a NULL.


Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:24 2006

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