You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@xbc.nu> on 2002/11/07 19:48:52 UTC

Re: svn commit: rev 3662 - trunk/subversion/mod_dav_svn trunk/subversion/tests/clients/cmdline/svntest

philip@tigris.org wrote:

>Modified: trunk/subversion/mod_dav_svn/update.c
>==============================================================================
>--- trunk/subversion/mod_dav_svn/update.c	(original)
>+++ trunk/subversion/mod_dav_svn/update.c	Tue Nov  5 17:53:50 2002
>@@ -454,7 +454,8 @@
>     }
> #undef NSLEN
>                 
>-  qname = apr_xml_quote_string (b->pool, name, 1);
>+  /* apr_xml_quote_string doesn't realloc if there is nothing to quote */
>+  qname = apr_xml_quote_string (b->pool, apr_pstrdup (b->pool, name), 1);
>   if (value)
>     {
>       if (! b->changed_props)
>  
>

How about this patch instead?

Index: subversion/mod_dav_svn/update.c
===================================================================
--- subversion/mod_dav_svn/update.c     (revision 3683)
+++ subversion/mod_dav_svn/update.c     (working copy)
@@ -454,8 +454,11 @@
     }
 #undef NSLEN

-  /* apr_xml_quote_string doesn't realloc if there is nothing to quote */
-  qname = apr_xml_quote_string (b->pool, apr_pstrdup (b->pool, name), 1);
+  qname = apr_xml_quote_string (b->pool, name, 1);
+  /* apr_xml_quote_string doesn't realloc if there is nothing to
+     quote, so dup the name only if necessary. */
+  if (qname == name)
+    qname = apr_pstrdup (b->pool, name);
   if (value)
     {
       if (! b->changed_props)
Index: subversion/libsvn_ra_dav/log.c
===================================================================
--- subversion/libsvn_ra_dav/log.c      (revision 3683)
+++ subversion/libsvn_ra_dav/log.c      (working copy)
@@ -25,6 +25,7 @@
 #include <apr_tables.h>
 #include <apr_strings.h>
 #include <apr_portable.h>
+#include <apr_xml.h>

 #include <ne_basic.h>
 #include <ne_utils.h>
@@ -364,13 +365,11 @@

   for (i = 0; i < paths->nelts; i++)
     {
-      const char *this_path = ((const char **)paths->elts)[i];
-      /* ### todo: want to xml-escape the path, but can't use
-         apr_xml_quote_string() here because we don't use apr_util
-         yet.  Should use svn_xml_escape_blah() instead? */
-      svn_stringbuf_appendcstr(request_body,
-                               apr_psprintf(ras->pool,
-                                            "<S:path>%s</S:path>", this_path));

+      const char *this_path =
+        apr_xml_quote_string(ras->pool, ((const char **)paths->elts)[i], 1);
+      svn_stringbuf_appendcstr(request_body, "<S:path>");
+      svn_stringbuf_appendcstr(request_body, this_path);
+      svn_stringbuf_appendcstr(request_body, "</S:path>");
     }

   svn_stringbuf_appendcstr(request_body, log_request_tail);



-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 3662 - trunk/subversion/mod_dav_svn trunk/subversion/tests/clients/cmdline/svntest

Posted by br...@xbc.nu.
Quoting Greg Stein <gs...@lyra.org>:

> On Thu, Nov 07, 2002 at 08:48:52PM +0100, Branko Cibej wrote:
> >...
> > How about this patch instead?
> 
> +1, but for a tweak below:
> 
> >...
> > +++ subversion/libsvn_ra_dav/log.c      (working copy)
> >...
> > +      const char *this_path =
> > +        apr_xml_quote_string(ras->pool, ((const char **)paths->elts)[i], 1);
> > +      svn_stringbuf_appendcstr(request_body, "<S:path>");
> > +      svn_stringbuf_appendcstr(request_body, this_path);
> > +      svn_stringbuf_appendcstr(request_body, "</S:path>");
> 
> Since the value does not go into an attribute, there is no reason to
> escape the quotes. Thus, pass 0 for the third arg to quote_string().

Ouch, of course. Will commit this tonight if nobody beats me to it.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 3662 - trunk/subversion/mod_dav_svn trunk/subversion/tests/clients/cmdline/svntest

Posted by Greg Stein <gs...@lyra.org>.
On Thu, Nov 07, 2002 at 08:48:52PM +0100, Branko Cibej wrote:
>...
> How about this patch instead?

+1, but for a tweak below:

>...
> +++ subversion/libsvn_ra_dav/log.c      (working copy)
>...
> +      const char *this_path =
> +        apr_xml_quote_string(ras->pool, ((const char **)paths->elts)[i], 1);
> +      svn_stringbuf_appendcstr(request_body, "<S:path>");
> +      svn_stringbuf_appendcstr(request_body, this_path);
> +      svn_stringbuf_appendcstr(request_body, "</S:path>");

Since the value does not go into an attribute, there is no reason to escape
the quotes. Thus, pass 0 for the third arg to quote_string().

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org