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

Re: svn commit: r37272 - trunk/subversion/libsvn_diff

From: Greg Stein <gstein_at_gmail.com>
Date: Wed, 15 Apr 2009 16:06:27 +0200

please use the traditional ### for marking TODOs and other points of
question/interest/concern...

On Wed, Apr 15, 2009 at 15:53, Stefan Sperling <stsp_at_elego.de> wrote:
> Author: stsp
> Date: Wed Apr 15 06:53:26 2009
> New Revision: 37272
>
> Log:
> * subversion/libsvn_diff/parse-diff.c
>  (svn_diff__parse_next_patch): svn_io_file_open() expects filenames
>   to be UTF8-encoded, so convert filenames found in patch to UTF8.
>   This will need to be extended later so that users can specify the
>   actual encoding of the patch file, in case the patch file is not
>   in native encoding.
>
> Modified:
>   trunk/subversion/libsvn_diff/parse-diff.c
>
> Modified: trunk/subversion/libsvn_diff/parse-diff.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_diff/parse-diff.c?pathrev=37272&r1=37271&r2=37272
> ==============================================================================
> --- trunk/subversion/libsvn_diff/parse-diff.c   Wed Apr 15 05:23:13 2009        (r37271)
> +++ trunk/subversion/libsvn_diff/parse-diff.c   Wed Apr 15 06:53:26 2009        (r37272)
> @@ -20,6 +20,7 @@
>  #include "svn_error.h"
>  #include "svn_io.h"
>  #include "svn_pools.h"
> +#include "svn_utf.h"
>  #include "private/svn_diff_private.h"
>
>
> @@ -79,27 +80,33 @@ svn_diff__parse_next_patch(svn_patch_t *
>       /* See if we have a diff header. */
>       if (line->len > strlen(indicator) && starts_with(line->data, indicator))
>         {
> +          const char *utf8_name;
> +
>           /* Looks like it, try to find the filename. */
>           apr_size_t tab = svn_stringbuf_find_char_backward(line, '\t');
>           if (tab >= line->len)
>             /* Not found... */
>             continue;
>
> +          /* Grab the filename and encode it in UTF-8. */
> +          /* TODO: Allow specifying the patch file's encoding.
> +           *       For now, we assume its encoding is native. */
>           line->data[tab] = '\0';
> +          SVN_ERR(svn_utf_cstring_to_utf8(&utf8_name,
> +                                          line->data + strlen(indicator),
> +                                          iterpool));
>
>           if ((! in_header) && strcmp(indicator, minus) == 0)
>             {
> -              /* First line of header. */
> -              (*patch)->old_filename =
> -                apr_pstrdup(result_pool, line->data + strlen(indicator));
> +              /* First line of header, grab old filename. */
> +              (*patch)->old_filename = apr_pstrdup(result_pool, utf8_name);
>               indicator = plus;
>               in_header = TRUE;
>             }
>           else if (in_header && strcmp(indicator, plus) == 0)
>             {
> -              /* Second line of header. */
> -              (*patch)->new_filename =
> -                apr_pstrdup(result_pool, line->data + strlen(indicator));
> +              /* Second line of header, grab new filename. */
> +              (*patch)->new_filename = apr_pstrdup(result_pool, utf8_name);
>               in_header = FALSE;
>               break; /* All good! */
>             }
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1727584
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1727665
Received on 2009-04-15 16:06:50 CEST

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.