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

[PATCH] Fix corner case bug in libsvn_diff

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2006-02-07 23:28:41 CET

Hi,

While testing the new diff stuff (ignore whitespace etc.), I changed the
token read chunk size from 128K to 4, and found an old corner case bug.
The problem is that the code will return a spurious empty token if the
file is exactly n*CHUNK_SIZE bytes long (n>0). This confuses the diff
algorithm, which thinks that the file has an extra line. Attached is a
fix for this, which seems a little clumsy. If anyone has a better
solution, feel free to suggest/commit.

Note that this is in 1.3 (and probably earlier)

Thanks,
//Peter

[[[
Fix corner case in libsvn_diff, when a file has a length that is an exact
multiple of the read chunk size (128K).

* subversion/libsvn_diff/diff_file.c
  (svn_diff__file_datasource_get_next_token): Avoid returning a token
  of length 0.
]]]

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

Received on Tue Feb 7 23:29:03 2006

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.