// My own diff-invention:
template <class t="">
void calcDiff( const T p1, int size1, const T p2, int size2, DiffList& diffList, int match, int maxSearchRange )</class>
The attached bug.cpp has extracted this function, and added a short "testCalcDiff" function and a short main program that uses "testCalcDiff" to demonstrate the bug. The fix is also there, just change "#if 0" to "#if 1". I suggest to go through both versions with your favorite debugger, to understand the bug and the proposed fix.
comparison files and screenshots of bug
The bug is in the following function:
// My own diff-invention:
template <class t="">
void calcDiff( const T p1, int size1, const T p2, int size2, DiffList& diffList, int match, int maxSearchRange )</class>
The attached bug.cpp has extracted this function, and added a short "testCalcDiff" function and a short main program that uses "testCalcDiff" to demonstrate the bug. The fix is also there, just change "#if 0" to "#if 1". I suggest to go through both versions with your favorite debugger, to understand the bug and the proposed fix.