+2003-11-25 Perry
+ PATCH: [ 849138 ] Fix stringdiffs for diff in first word
+ (Code was trying to access word#-1 when diff hit in first word)
+ WinMerge: stringdiffs.cpp stringdiffs.h
+
2003-11-25 Kimmo
Missed one diff in PATCH: [ 847697 ] Move desc texts into doc classes
WinMerge: MergeDoc.cpp
// Add a diff from start to before sync
int s1 = m_words1[bw1].start;
- int e1 = m_words1[w1-1].end;
+ int e1 = w1 ? m_words1[w1-1].end : 0;
int s2 = m_words2[bw2].start;
- int e2 = m_words2[w2-1].end;
+ int e2 = w2 ? m_words2[w2-1].end : 0;
if (m_whitespace == 0)
{
// Compare all whitespace
if (begin<i)
{
// just finished a word
- // e is last nonspace character
- int e = (i<str.GetLength() ? i-1 : i);
+ // e is first non-word character (space or at end)
+ int e = i-1;
word wd(begin, e, hash(str, begin, e));
words->Add(wd);
}
// Implementation types
private:
struct word {
- int start;
- int end;
+ int start; // index of first character of word in original string
+ int end; // index of last character of word in original string
int hash;
word(int s=0, int e=0, int h=0) : start(s), end(e), hash(h) { }
int length() const { return end+1-start; }