curran / curran/google-diff-match-patch
The bool vector return of patch_apply generally does not correspond to anything the caller knows about.
- Dominant language
- Python
- Stars
- 17
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
```
Before I start, thanks for a creating a great library. It's very useful and is
much appreciated.
Using the C++ version I came across what seems like either very odd or just
plain broken behaviour with diff_match_patch::patch_apply. It returns a vector
of bools to indicate individual patch success but the size of this vector can
be larger then the size of the patch list that is input to the function.
It appears that the list of input patches can be broken up into a larger list
by patch_splitMax. Despite patch_apply passing the patch list as a reference it
takes a deep copy of it and therefore does not alter it. This means that the
vector of bools is with reference to the internal, in general larger, patch
list and is therefore of little use to the caller. In fact it's potentially
dangerous if one tries to index into the input patch list to, for example,
print out the patches that failed (as I did).
Either the patch list really should be altered on return or the bool vector
should correspond to the original input list (and the patch list passed by
reference-to-const).
Whether this is an issue with the other implementations or is confined to the
C++/Qt version I don't know.
```
Original issue reported on code.google.com by `fotherin...@gmail.com` on 19 Jan 2012 at 9:28
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.