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

Re: svn commit: r11340 - trunk/subversion/libsvn_ra_dav

From: Joe Orton <joe_at_manyfish.co.uk>
Date: 2004-10-13 00:27:31 CEST

On Tue, Oct 12, 2004 at 04:05:24PM -0500, Philip Martin wrote:
> --- trunk/subversion/libsvn_ra_dav/util.c (original)
> +++ trunk/subversion/libsvn_ra_dav/util.c Tue Oct 12 16:05:23 2004
> @@ -399,7 +399,19 @@
> case ELEM_human_readable:
> {
> if (cdata && *err)
> - (*err)->message = apr_pstrdup((*err)->pool, cdata);
> + {
> + /* On the server dav_error_response_tag() will add a leading
> + and trailing newline if DEBUG_CR is defined in mod_dav.h,
> + so remove any such characters here. */
> + apr_size_t len;
> + if (*cdata == '\n')
> + ++cdata;
> + len = strlen(cdata);
> + if (cdata[len-1] == '\n')
> + --len;
> +
> + (*err)->message = apr_pstrmemdup((*err)->pool, cdata, len);

Isn't this going to do nasty things if cdata is "\n" or "" on entry?

neon has ne_shave to make this kind of code simple, I'd just do:

  message = apr_pstrdup((*err)->pool, ne_shave(cdata, " \r\n\t")).

joe

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 13 00:27:50 2004

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.