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

Re: svn commit: r17273 - in branches/svndiff1/subversion: libsvn_delta mod_dav_svn

From: Daniel Berlin <dberlin_at_dberlin.org>
Date: 2005-11-10 01:55:56 CET

> > Author: dberlin
> > Date: Wed Nov 9 11:51:14 2005
> > New Revision: 17273
>
> > +static int sort_encoding_pref(const void *accept_rec1, const void
> *accept_rec2)
> > +{
> > + float diff = ((accept_rec *) accept_rec1)->quality -
> > + ((accept_rec *) accept_rec2)->quality;
>
> I cast to (const accept_rec *) to avoid dropping const.
>
You know that this can't do anything interesting in C, right, because of
the rules of whether const matters or not? Sad, but true.

However, it "looks" better, so i'll do it.

> > + {
> > + *svndiff_version = 0;
> > + return SVN_NO_ERROR;
> > + }
> > +
> > + qsort(encoding_prefs->elts, (size_t) encoding_prefs->nelts,
> > + sizeof(accept_rec), sort_encoding_pref);
> > + for (i = 0; i < encoding_prefs->nelts; i++)
> > + {
> > + struct accept_rec rec = APR_ARRAY_IDX (encoding_prefs, i,
> > + struct accept_rec);
> > + if (strcmp (rec.name, "svndiff1") == 0)
> > + {
> > + *svndiff_version = 1;
> > + break;
> > + }
> > + else if (strcmp (rec.name, "svndiff") == 0)
> > + {
> > + *svndiff_version = 0;
> > + break;
> > + }
> > + }
> > + return SVN_NO_ERROR;
>
> If neither strcmp matches *svndiff_version does not get set, is that
> intended? If so it should be documented.

It doesn't actually matter in it's only current use, but i'll just reset
it to zero at the top of the function for the sake of some hypothetical
person who isn't zeroing out their structures.

>
> > +}
> >
> >
> > static dav_error * dav_svn_get_resource(request_rec *r,
> > @@ -1334,6 +1512,7 @@
> > && strcmp(ct, SVN_SVNDIFF_MIME_TYPE) == 0;
> > }
> >
> > + svn_dav__negotiate_encoding_prefs (r, &comb->priv.svndiff_version);
>
> That would leak an error if svn_dav__negotiate_encoding_prefs ever
> returned one, since it never does perhaps it should be void?
>

I will, but I just cribbed almost all this code from dlr.
I wasn't sure whether i should fix the style, etc, because it looks like
it fits in the with the rest of mod_dav_svn. cough cough. :)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 10 01:56:26 2005

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.