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

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

From: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA_at_GMail.Com>
Date: Sun, 25 Jan 2009 16:29:28 +0100

2009-01-25 07:23:35 Daniel Shahaf napisaƂ(a):
> > @@ -1074,6 +1075,14 @@ output_unified_diff_modified(void *baton
> > {
> > output_baton->hunk_extra_context[--p] = '\0';
> > }
> > + const char *invalid_character =
> > + svn_utf__last_valid(output_baton->hunk_extra_context,
> > + SVN_DIFF__EXTRA_CONTEXT_LENGTH - 1);
>
> s/SVN_DIFF__EXTRA_CONTEXT_LENGTH - 1/SVN_DIFF__EXTRA_CONTEXT_LENGTH + 1/ ?

15 lines earlier there is:
          /* Save the extra context for later use.
           * Note that the last byte of the hunk_extra_context array is never
           * touched after it is zero-initialized, so the array is always
           * 0-terminated. */
          strncpy(output_baton->hunk_extra_context,
                  output_baton->extra_context->data,
                  SVN_DIFF__EXTRA_CONTEXT_LENGTH);

svn_utf__last_valid()'s doc string contains:
> /* Return a pointer to the first character after the last valid UTF-8
> * multi-byte character in the string SRC of length LEN. If SRC is a valid
> * UTF-8 the return value will point to the byte after SRC+LEN, otherwise
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> * it will point to the start of the first invalid multi-byte character.
> * In either case all the characters between SRC and the return pointer are
> * valid UTF-8.

So IMHO current code is correct.

-- 
Arfrever Frehtes Taifersar Arahesis

Received on 2009-01-25 16:31:17 CET

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.