OSDN Git Service

Change std::vector<T> output argument to return value
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 31 Mar 2019 12:08:46 +0000 (21:08 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 31 Mar 2019 12:08:46 +0000 (21:08 +0900)
--HG--
branch : stable

12 files changed:
Src/MergeDoc.cpp
Src/MergeDoc.h
Src/MergeDocDiffSync.cpp
Src/MergeDocLineDiffs.cpp
Src/MergeEditView.cpp
Src/stringdiffs.cpp
Src/stringdiffs.h
Src/stringdiffsi.h
Testing/GoogleTest/StringDiffs/stringdiffs_test.cpp
Testing/GoogleTest/StringDiffs/stringdiffs_test_adds.cpp
Testing/GoogleTest/StringDiffs/stringdiffs_test_bugs.cpp
Testing/GoogleTest/StringDiffs/stringdiffs_test_bytelevel.cpp

index c90be86..59f188c 100644 (file)
@@ -570,14 +570,12 @@ void CMergeDoc::FlagTrivialLines(void)
                                DIFFOPTIONS diffOptions = {0};
                                m_diffWrapper.GetOptions(&diffOptions);
 
-                               std::vector<strdiff::wdiff> worddiffs;
                                // Make the call to stringdiffs, which does all the hard & tedious computations
-                               strdiff::ComputeWordDiffs(m_nBuffers, str,
+                               std::vector<strdiff::wdiff> worddiffs = strdiff::ComputeWordDiffs(m_nBuffers, str,
                                        !diffOptions.bIgnoreCase,
                                        diffOptions.nIgnoreWhitespace,
                                        GetBreakType(), // whitespace only or include punctuation
-                                       GetByteColoringOption(),
-                                       &worddiffs);
+                                       GetByteColoringOption());
                                if (!worddiffs.empty())
                                {
                                        for (int file = 0; file < m_nBuffers; ++file)
@@ -1187,7 +1185,7 @@ bool CMergeDoc::ListCopy(int srcPane, int dstPane, int nDiff /* = -1*/,
 }
 
 bool CMergeDoc::WordListCopy(int srcPane, int dstPane, int nDiff, int firstWordDiff, int lastWordDiff,
-               std::vector<int> *pWordDiffIndice, bool bGroupWithPrevious /*= false*/, bool bUpdateView /*= true*/)
+               const std::vector<int> *pWordDiffIndice, bool bGroupWithPrevious /*= false*/, bool bUpdateView /*= true*/)
 {
        int nGroup = GetActiveMergeView()->m_nThisGroup;
        CMergeEditView *pViewSrc = m_pView[nGroup][srcPane];
@@ -1215,8 +1213,7 @@ bool CMergeDoc::WordListCopy(int srcPane, int dstPane, int nDiff, int firstWordD
                return false; // abort copying
        }
 
-       std::vector<WordDiff> worddiffs;
-       GetWordDiffArray(cd_dbegin, &worddiffs);
+       std::vector<WordDiff> worddiffs = GetWordDiffArray(cd_dbegin);
 
        if (worddiffs.empty())
                return false;
index 09427a8..62c6030 100644 (file)
@@ -193,7 +193,7 @@ public:
        void CopyMultipleList(int srcPane, int dstPane, int firstDiff, int lastDiff, int firstWordDiff = -1, int lastWordDiff = -1);
        void DoAutoMerge(int dstPane);
        bool SanityCheckDiff(DIFFRANGE dr) const;
-       bool WordListCopy(int srcPane, int dstPane, int nDiff, int nFirstWordDiff, int nLastWordDiff, std::vector<int> *pWordDiffIndice, bool bGroupWithPrevious = false, bool bUpdateView = true);
+       bool WordListCopy(int srcPane, int dstPane, int nDiff, int nFirstWordDiff, int nLastWordDiff, const std::vector<int> *pWordDiffIndice, bool bGroupWithPrevious = false, bool bUpdateView = true);
        bool ListCopy(int srcPane, int dstPane, int nDiff = -1, bool bGroupWithPrevious = false, bool bUpdateView = true);
        bool TrySaveAs(String& strPath, int &nLastErrorCode, String & sError,
                int nBuffer, PackingInfo * pInfoTempUnpacker);
@@ -278,7 +278,7 @@ public:
 public:
        typedef enum { BYTEDIFF, WORDDIFF } DIFFLEVEL;
        void Showlinediff(CMergeEditView *pView, bool bReversed = false);
-       void GetWordDiffArray(int nLineIndex, std::vector<WordDiff> *pWordDiffs);
+       std::vector<WordDiff> GetWordDiffArray(int nLineIndex);
        void ClearWordDiffCache(int nDiff = -1);
 private:
        void Computelinediff(CMergeEditView *pView, CRect rc[], bool bReversed);
index b1505ca..4cddc77 100644 (file)
@@ -146,8 +146,7 @@ int CMergeDoc::GetMatchCost(const String &sLine0, const String &sLine1)
        int breakType = GetBreakType(); // whitespace only or include punctuation
        bool byteColoring = GetByteColoringOption();
 
-       std::vector<strdiff::wdiff> worddiffs;
-       strdiff::ComputeWordDiffs(2, str, casitive, xwhite, breakType, byteColoring, &worddiffs);
+       std::vector<strdiff::wdiff> worddiffs = strdiff::ComputeWordDiffs(2, str, casitive, xwhite, breakType, byteColoring);
 
        int nDiffLenSum = 0;
        for (std::vector<strdiff::wdiff>::const_iterator it = worddiffs.begin(); it != worddiffs.end(); ++it)
index 4b23e6d..e831ce4 100644 (file)
@@ -79,8 +79,7 @@ void CMergeDoc::Computelinediff(CMergeEditView *pView, CRect rc[], bool bReverse
        CPoint ptStart, ptEnd;
        pView->GetSelection(ptStart, ptEnd);
 
-       vector<WordDiff> worddiffs;
-       GetWordDiffArray(ptStart.y, &worddiffs);
+       vector<WordDiff> worddiffs = GetWordDiffArray(ptStart.y);
 
        if (worddiffs.empty())
                return;
@@ -143,26 +142,27 @@ void CMergeDoc::ClearWordDiffCache(int nDiff/* = -1 */)
  * This is used by algorithm for line diff coloring
  * (Line diff coloring is distinct from the selection highlight code)
  */
-void CMergeDoc::GetWordDiffArray(int nLineIndex, vector<WordDiff> *pWordDiffs)
+std::vector<WordDiff> CMergeDoc::GetWordDiffArray(int nLineIndex)
 {
        int file;
        DIFFRANGE cd;
+       std::vector<WordDiff> worddiffs;
 
        for (file = 0; file < m_nBuffers; file++)
        {
                if (nLineIndex >= m_ptBuf[file]->GetLineCount())
-                       return;
+                       return worddiffs;
        }
 
        int nDiff = m_diffList.LineToDiff(nLineIndex);
        if (nDiff == -1)
-               return;
+               return worddiffs;
        std::map<int, std::vector<WordDiff> >::iterator itmap = m_cacheWordDiffs.find(nDiff);
        if (itmap != m_cacheWordDiffs.end())
        {
-               pWordDiffs->resize((*itmap).second.size());
-               std::copy((*itmap).second.begin(), (*itmap).second.end(), pWordDiffs->begin());
-               return;
+               worddiffs.resize((*itmap).second.size());
+               std::copy((*itmap).second.begin(), (*itmap).second.end(), worddiffs.begin());
+               return worddiffs;
        }
 
        m_diffList.GetDiff(nDiff, cd);
@@ -188,7 +188,7 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector<WordDiff> *pWordDiffs)
        for (file = 0; file < m_nBuffers; file++)
        {
                if (nLineEnd >= m_ptBuf[file]->GetLineCount())
-                       return;
+                       return worddiffs;
                nOffsets[file].reset(new int[nLineEnd - nLineBegin + 1]);
                CString strText;
                if (nLineBegin != nLineEnd || m_ptBuf[file]->GetLineLength(nLineEnd) > 0)
@@ -207,13 +207,12 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector<WordDiff> *pWordDiffs)
        int breakType = GetBreakType(); // whitespace only or include punctuation
        bool byteColoring = GetByteColoringOption();
 
-       std::vector<strdiff::wdiff> worddiffs;
        // Make the call to stringdiffs, which does all the hard & tedious computations
-       strdiff::ComputeWordDiffs(m_nBuffers, str, casitive, xwhite, breakType, byteColoring, &worddiffs);
+       std::vector<strdiff::wdiff> wdiffs = strdiff::ComputeWordDiffs(m_nBuffers, str, casitive, xwhite, breakType, byteColoring);
 
        int i;
        std::vector<strdiff::wdiff>::iterator it;
-       for (i = 0, it = worddiffs.begin(); it != worddiffs.end(); ++i, ++it)
+       for (i = 0, it = wdiffs.begin(); it != wdiffs.end(); ++i, ++it)
        {
                WordDiff wd;
                for (file = 0; file < m_nBuffers; file++)
@@ -241,15 +240,15 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector<WordDiff> *pWordDiffs)
                }
                wd.op = it->op;
 
-               pWordDiffs->push_back(wd);
+               worddiffs.push_back(wd);
        }
 
        if (!diffPerLine)
        {
-               m_cacheWordDiffs[nDiff].resize(pWordDiffs->size());
-               std::copy(pWordDiffs->begin(), pWordDiffs->end(), m_cacheWordDiffs[nDiff].begin());
+               m_cacheWordDiffs[nDiff].resize(worddiffs.size());
+               std::copy(worddiffs.begin(), worddiffs.end(), m_cacheWordDiffs[nDiff].begin());
        }
 
-       return;
+       return worddiffs;
 }
 
index d1b8124..a74567d 100644 (file)
@@ -345,14 +345,13 @@ void CMergeEditView::GetFullySelectedDiffs(int & firstDiff, int & lastDiff, int
        if (firstDiff != -1 && lastDiff != -1)
        {
                DIFFRANGE di;
-               vector<WordDiff> worddiffs;
                
                if (ptStart != ptEnd)
                {
                        if (firstWordDiff == -1)
                        {
                                VERIFY(pd->m_diffList.GetDiff(firstDiff, di));
-                               pd->GetWordDiffArray(firstLine, &worddiffs);
+                               vector<WordDiff> worddiffs = pd->GetWordDiffArray(firstLine);
                                for (size_t i = 0; i < worddiffs.size(); ++i)
                                {
                                        if (worddiffs[i].endline[m_nThisPane] > firstLine ||
@@ -371,7 +370,7 @@ void CMergeEditView::GetFullySelectedDiffs(int & firstDiff, int & lastDiff, int
                        }
 
                        VERIFY(pd->m_diffList.GetDiff(lastDiff, di));
-                       pd->GetWordDiffArray(lastLine, &worddiffs);
+                       vector<WordDiff> worddiffs = pd->GetWordDiffArray(lastLine);
                        for (size_t i = worddiffs.size() - 1; i != (size_t)-1; --i)
                        {
                                if (worddiffs[i].beginline[m_nThisPane] < lastLine ||
@@ -492,7 +491,6 @@ std::vector<TEXTBLOCK> CMergeEditView::GetAdditionalTextBlocks (int nLineIndex)
        if (pDoc->IsEditedAfterRescan(m_nThisPane))
                return emptyBlocks;
        
-       vector<WordDiff> worddiffs;
        int nDiff = pDoc->m_diffList.LineToDiff(nLineIndex);
        if (nDiff == -1)
                return emptyBlocks;
@@ -508,7 +506,7 @@ std::vector<TEXTBLOCK> CMergeEditView::GetAdditionalTextBlocks (int nLineIndex)
        if (unemptyLineCount < 2)
                return emptyBlocks;
 
-       pDoc->GetWordDiffArray(nLineIndex, &worddiffs);
+       vector<WordDiff> worddiffs = pDoc->GetWordDiffArray(nLineIndex);
        size_t nWordDiffs = worddiffs.size();
 
        bool lineInCurrentDiff = IsLineInCurrentDiff(nLineIndex);
index 56e09bf..f1ede1b 100644 (file)
@@ -57,13 +57,12 @@ void SetBreakChars(const TCHAR *breakChars)
        BreakChars = _tcsdup(breakChars);
 }
 
-void
+std::vector<wdiff>
 ComputeWordDiffs(const String& str1, const String& str2,
-       bool case_sensitive, int whitespace, int breakType, bool byte_level,
-       std::vector<wdiff> * pDiffs)
+       bool case_sensitive, int whitespace, int breakType, bool byte_level)
 {
        String strs[3] = {str1, str2, _T("")};
-       ComputeWordDiffs(2, strs, case_sensitive, whitespace, breakType, byte_level, pDiffs);
+       return ComputeWordDiffs(2, strs, case_sensitive, whitespace, breakType, byte_level);
 }
 
 struct Comp02Functor
@@ -97,14 +96,14 @@ struct Comp02Functor
 /**
  * @brief Construct our worker object and tell it to do the work
  */
-void
+std::vector<wdiff>
 ComputeWordDiffs(int nFiles, const String str[3],
-       bool case_sensitive, int whitespace, int breakType, bool byte_level,
-       std::vector<wdiff> * pDiffs)
+       bool case_sensitive, int whitespace, int breakType, bool byte_level)
 {
+       std::vector<wdiff> diffs;
        if (nFiles == 2)
        {
-               stringdiffs sdiffs(str[0], str[1], case_sensitive, whitespace, breakType, pDiffs);
+               stringdiffs sdiffs(str[0], str[1], case_sensitive, whitespace, breakType, &diffs);
                // Hash all words in both lines and then compare them word by word
                // storing differences into m_wdiffs
                sdiffs.BuildWordDiffList();
@@ -120,14 +119,14 @@ ComputeWordDiffs(int nFiles, const String str[3],
        {
                if (str[0].empty())
                {
-                       stringdiffs sdiffs(str[1], str[2], case_sensitive, whitespace, breakType, pDiffs);
+                       stringdiffs sdiffs(str[1], str[2], case_sensitive, whitespace, breakType, &diffs);
                        sdiffs.BuildWordDiffList();
                        if (byte_level)
                                sdiffs.wordLevelToByteLevel();
                        sdiffs.PopulateDiffs();
-                       for (size_t i = 0; i < pDiffs->size(); i++)
+                       for (size_t i = 0; i < diffs.size(); i++)
                        {
-                               wdiff& diff = (*pDiffs)[i];
+                               wdiff& diff = diffs[i];
                                diff.begin[2] = diff.begin[1];
                                diff.begin[1] = diff.begin[0];
                                diff.begin[0] = 0;
@@ -138,14 +137,14 @@ ComputeWordDiffs(int nFiles, const String str[3],
                }
                else if (str[1].empty())
                {
-                       stringdiffs sdiffs(str[0], str[2], case_sensitive, whitespace, breakType, pDiffs);
+                       stringdiffs sdiffs(str[0], str[2], case_sensitive, whitespace, breakType, &diffs);
                        sdiffs.BuildWordDiffList();
                        if (byte_level)
                                sdiffs.wordLevelToByteLevel();
                        sdiffs.PopulateDiffs();
-                       for (size_t i = 0; i < pDiffs->size(); i++)
+                       for (size_t i = 0; i < diffs.size(); i++)
                        {
-                               wdiff& diff = (*pDiffs)[i];
+                               wdiff& diff = diffs[i];
                                diff.begin[2] = diff.begin[1];
                                //diff.begin[0] = diff.begin[0];
                                diff.begin[1] = 0;
@@ -156,14 +155,14 @@ ComputeWordDiffs(int nFiles, const String str[3],
                }
                else if (str[2].empty())
                {
-                       stringdiffs sdiffs(str[0], str[1], case_sensitive, whitespace, breakType, pDiffs);
+                       stringdiffs sdiffs(str[0], str[1], case_sensitive, whitespace, breakType, &diffs);
                        sdiffs.BuildWordDiffList();
                        if (byte_level)
                                sdiffs.wordLevelToByteLevel();
                        sdiffs.PopulateDiffs();
-                       for (size_t i = 0; i < pDiffs->size(); i++)
+                       for (size_t i = 0; i < diffs.size(); i++)
                        {
-                               wdiff& diff = (*pDiffs)[i];
+                               wdiff& diff = diffs[i];
                                //diff.begin[1] = diff.begin[1];
                                //diff.begin[0] = diff.begin[0];
                                diff.begin[2] = 0;
@@ -190,10 +189,11 @@ ComputeWordDiffs(int nFiles, const String str[3],
                        sdiffs10.PopulateDiffs();
                        sdiffs12.PopulateDiffs();
 
-                       Make3wayDiff(*pDiffs, diffs10, diffs12, 
+                       Make3wayDiff(diffs, diffs10, diffs12, 
                                Comp02Functor(str, case_sensitive), false);
                }
        }
+       return diffs;
 }
 
 /**
@@ -338,8 +338,8 @@ stringdiffs::BuildWordDiffList_DP()
 void
 stringdiffs::BuildWordDiffList()
 {
-       BuildWordsArray(m_str1, m_words1);
-       BuildWordsArray(m_str2, m_words2);
+       m_words1 = BuildWordsArray(m_str1);
+       m_words2 = BuildWordsArray(m_str2);
 
 #ifdef _WIN64
        if (m_words1.size() > 20480 || m_words2.size() > 20480)
@@ -361,9 +361,10 @@ stringdiffs::BuildWordDiffList()
 /**
  * @brief Break line into constituent words
  */
-void
-stringdiffs::BuildWordsArray(const String & str, std::vector<word>& words)
+std::vector<stringdiffs::word>
+stringdiffs::BuildWordsArray(const String & str)
 {
+       std::vector<word> words;
        int i=0, begin=0;
 
        size_t sLen = str.length();
@@ -389,7 +390,7 @@ inspace:
                words.push_back(word(begin, e, dlspace, Hash(str, begin, e, 0)));
        }
        if (i == iLen)
-               return;
+               return words;
        begin = i;
        goto inword;
 
@@ -408,7 +409,7 @@ inword:
                }
                if (i == iLen)
                {
-                       return;
+                       return words;
                }
                else if (atspace)
                {
index f02749f..ffeef41 100644 (file)
@@ -46,12 +46,10 @@ void Close();
 
 void SetBreakChars(const TCHAR *breakChars);
 
-void ComputeWordDiffs(const String& str1, const String& str2,
-       bool case_sensitive, int whitespace, int breakType, bool byte_level,
-       std::vector<wdiff> * pDiffs);
-void ComputeWordDiffs(int nStrings, const String str[3], 
-                   bool case_sensitive, int whitespace, int breakType, bool byte_level,
-                                  std::vector<wdiff> * pDiffs);
+std::vector<wdiff> ComputeWordDiffs(const String& str1, const String& str2,
+       bool case_sensitive, int whitespace, int breakType, bool byte_level);
+std::vector<wdiff> ComputeWordDiffs(int nStrings, const String str[3], 
+                   bool case_sensitive, int whitespace, int breakType, bool byte_level);
 
 void ComputeByteDiff(const String& str1, const String& str2,
                        bool casitive, int xwhite, 
index a57b66e..ecd10df 100644 (file)
@@ -68,7 +68,7 @@ private:
 // Implementation methods
 private:
 
-       void BuildWordsArray(const String & str, std::vector<word>& words);
+       std::vector<word> BuildWordsArray(const String & str);
        unsigned Hash(const String & str, int begin, int end, unsigned h ) const;
        bool AreWordsSame(const word & word1, const word & word2) const;
        bool IsWord(const word & word1) const;
index 618cce7..0674f80 100644 (file)
@@ -58,104 +58,91 @@ namespace
        // Both strings empty
        TEST_F(StringDiffsTest, EmptyBoth)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(""), _T(""), false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(""), _T(""), false, 0, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // First string empty
        TEST_F(StringDiffsTest, EmptyFirst)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(""), _T("abcde"), false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(""), _T("abcde"), false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Second string empty
        TEST_F(StringDiffsTest, EmptySecond)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde"), _T(""), false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde"), _T(""), false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, no case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, Default1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), false, 0, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, DefaultDiffererentLen)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdef"), _T("abcde"), false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdef"), _T("abcde"), false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, no case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, DefaultWhitespaceEnd)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde "), _T("abcde"), false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde "), _T("abcde"), false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, Caseignore1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), true, 0, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, CaseignoreCase1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcde"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcde"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreWhitespace1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde "), _T("abcde"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde "), _T("abcde"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreWhitespace2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde"), _T(" abcde"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde"), _T(" abcde"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore whitespace change, words, word-level
        TEST_F(StringDiffsTest, IgnoreWhitespace3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcde abcde"), false, 1, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcde abcde"), false, 1, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore whitespace change, words, word-level
        TEST_F(StringDiffsTest, IgnoreWhitespace4)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(" abcde abcde"), _T("  abcde abcde"), false, 1, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(" abcde abcde"), _T("  abcde abcde"), false, 1, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore whitespace change, words, word-level
        TEST_F(StringDiffsTest, IgnoreWhitespace5)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(" abcde abcde"), _T("      abcde abcde"), false, 1, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(" abcde abcde"), _T("  abcde abcde"), false, 1, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
@@ -163,56 +150,49 @@ namespace
        // Whitespace at begin of first string is a difference
        TEST_F(StringDiffsTest, IgnoreWhitespace6)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(" abcde abcde"), _T("abcde abcde"), false, 1, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(" abcde abcde"), _T("abcde     abcde"), false, 1, 0, false);
                EXPECT_EQ(1, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore whitespace change, words, word-level
        TEST_F(StringDiffsTest, IgnoreWhitespace7)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcde  abcde"), false, 1, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcde      abcde"), false, 1, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), true, 2, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(" abcde"), _T("abcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(" abcde"), _T("abcde"), true, 2, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("  abcde"), _T("abcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("      abcde"), _T("abcde"), true, 2, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace4)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T(" abcde"), _T("  abcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T(" abcde"), _T("  abcde"), true, 2, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace5)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcdeabcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcdeabcde"), true, 2, 0, false);
 /// FIXME:
 //             EXPECT_EQ(0, diffs.size());
        }
@@ -220,24 +200,21 @@ namespace
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace6)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcde  abcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde abcde"), _T("abcde      abcde"), true, 2, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, no case sensitivity, ignore all whitespace, words, word-level
        TEST_F(StringDiffsTest, IgnoreAllWhitespace7)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde\tabcde"), _T("abcde abcde"), true, 2, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde\tabcde"), _T("abcde     abcde"), true, 2, 0, false);
                EXPECT_EQ(0, diffs.size());
        }
 
        // Identical strings, case sensitivity, no whitespace, words, word-level
        TEST_F(StringDiffsTest, WordBreak2Words1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde fghij"), _T("abcde fghij"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde fghij"), _T("abcde fghij"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -253,8 +230,7 @@ namespace
        // Last word is different
        TEST_F(StringDiffsTest, WordBreak2Words2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde fghij"), _T("abcde fGhij"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde fghij"), _T("abcde fGhij"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -270,8 +246,7 @@ namespace
        // Both words are different
        TEST_F(StringDiffsTest, WordBreak2Words3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde fghij"), _T("ABcde fGhij"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde fghij"), _T("ABcde fGhij"), true, 0, 0, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                EXPECT_EQ(0, pDiff->begin[0]);
@@ -289,8 +264,7 @@ namespace
        // Middle word is different
        TEST_F(StringDiffsTest, WordBreak3Words1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde fgHIj klmno"), _T("abcde fghij klmno"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde fgHIj klmno"), _T("abcde fghij klmno"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -306,8 +280,7 @@ namespace
        // Middle word is different
        TEST_F(StringDiffsTest, WordBreak3Words2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde fghij klmno"), _T("abcde fGHij klmno"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde fghij klmno"), _T("abcde fGHij klmno"), true, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -323,8 +296,7 @@ namespace
        // First two words are different
        TEST_F(StringDiffsTest, WordBreak3Words3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcDE fGHij klmno"), _T("abcde fghij klmno"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcDE fGHij klmno"), _T("abcde fghij klmno"), true, 0, 0, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                EXPECT_EQ(0, pDiff->begin[0]);
@@ -342,8 +314,7 @@ namespace
        // First two words are different
        TEST_F(StringDiffsTest, WordBreak3Words4)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde fghij klmno"), _T("abcDE fGHij klmno"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde fghij klmno"), _T("abcDE fGHij klmno"), true, 0, 0, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                EXPECT_EQ(0, pDiff->begin[0]);
@@ -361,8 +332,7 @@ namespace
        // First and last words are different generating two diffs
        TEST_F(StringDiffsTest, WordBreak3Words5)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde fghij KLmno"), _T("abcDE fghij klmno"), true, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde fghij KLmno"), _T("abcDE fghij klmno"), true, 0, 0, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 2)
@@ -383,8 +353,7 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, PunctBreak2Words1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde,fghij"), _T("ABcde,fghij"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde,fghij"), _T("ABcde,fghij"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -400,8 +369,7 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, PunctBreak2Words2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fghij"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fghij"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -417,8 +385,7 @@ namespace
        // Both words are different
        TEST_F(StringDiffsTest, PunctBreak2Words3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fGHij"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fGHij"), true, 0, 1, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 2)
@@ -439,8 +406,7 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, PunctBreak3Words1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fghij,klmno"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fghij,klmno"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -456,8 +422,7 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, PunctBreak3Words2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fGHij,klmno"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fGHij,klmno"), true, 0, 1, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                EXPECT_EQ(0, pDiff->begin[0]);
@@ -475,8 +440,7 @@ namespace
        // All three words are different
        TEST_F(StringDiffsTest, PunctBreak3Words3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fGHij,klmNO"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fGHij,klmNO"), true, 0, 1, false);
                EXPECT_EQ(3, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                EXPECT_EQ(0, pDiff->begin[0]);
@@ -499,8 +463,7 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, PunctBreak3Words4)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fghij,klmNO"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij,klmno"), _T("abcde,fghij,klmNO"), true, 0, 1, false);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                EXPECT_EQ(0, pDiff->begin[0]);
@@ -518,9 +481,8 @@ namespace
        // Match whole strings
        TEST_F(StringDiffsTest, CustomPunct1)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(""));
-               strdiff::ComputeWordDiffs(_T("Abcde:fghij"), _T("abcde:fghij"), true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde:fghij"), _T("abcde:fghij"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -536,9 +498,8 @@ namespace
        // Match whole strings
        TEST_F(StringDiffsTest, CustomPunct2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::SetBreakChars(_T(""));
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fghij"), true, 0, 1, false, &diffs);
+               strdiff::SetBreakChars(_T(""));
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fghij"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -554,9 +515,8 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, CustomPunctBreak1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::SetBreakChars(_T(":"));
-               strdiff::ComputeWordDiffs(_T("Abcde:fghij"), _T("abcde:fghij"), true, 0, 1, false, &diffs);
+               strdiff::SetBreakChars(_T(":"));
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde:fghij"), _T("abcde:fghij"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -572,9 +532,8 @@ namespace
        // First word is different
        TEST_F(StringDiffsTest, CustomPunctBreak2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::SetBreakChars(_T(";"));
-               strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fghij"), true, 0, 1, false, &diffs);
+               strdiff::SetBreakChars(_T(";"));
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("Abcde,fghij"), _T("abcde,fghij"), true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -589,16 +548,14 @@ namespace
        // Identical strings, case sensitivity, no whitespace, words, byte-level
        TEST_F(StringDiffsTest, ByteLevel1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcde"), _T("abcde"), true, 0, 0, true);
                EXPECT_TRUE(diffs.size() == 0);
        }
 
        // Identical strings, case sensitivity, no whitespace, words, byte-level
        TEST_F(StringDiffsTest, ByteLevel2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcde"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcde"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -613,8 +570,7 @@ namespace
        // Identical strings, case sensitivity, no whitespace, words, byte-level
        TEST_F(StringDiffsTest, ByteLevel3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBCde"), _T("abcde"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBCde"), _T("abcde"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -629,8 +585,7 @@ namespace
        // Identical strings, case sensitivity, no whitespace, words, byte-level
        TEST_F(StringDiffsTest, ByteLevel4)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde"), _T("abCde"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde"), _T("abCde"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -646,8 +601,7 @@ namespace
        // NOTE NOTE: This is questionable?
        TEST_F(StringDiffsTest, ByteLevel5)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcDe"), _T("abcde"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcDe"), _T("abcde"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -663,8 +617,7 @@ namespace
        // NOTE NOTE: This is questionable?
        TEST_F(StringDiffsTest, ByteLevel6)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcDe"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcDe"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff = &diffs[0];
                if (diffs.size() == 1)
@@ -680,8 +633,7 @@ namespace
        // NOTE NOTE: This is questionable?
        TEST_F(StringDiffsTest, ByteLevel7)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcdE"), _T("abcde"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcdE"), _T("abcde"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() == 1 )
@@ -698,8 +650,7 @@ namespace
        // NOTE NOTE: This is questionable?
        TEST_F(StringDiffsTest, ByteLevel8)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcdE"), true, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("aBcde"), _T("abcdE"), true, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() == 1)
index 7a92fc0..4e0addb 100644 (file)
@@ -60,9 +60,8 @@ namespace
        // Char added to begin
        TEST_F(StringDiffsAddsTest, AddBeginFirst1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("1abcdefgh"),
-                               false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("1abcdefgh"),
+                               false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -77,9 +76,8 @@ namespace
        // Char added to begin
        TEST_F(StringDiffsAddsTest, AddBeginFirst2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("1abcdefgh"), _T("abcdefgh"),
-                               false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("1abcdefgh"), _T("abcdefgh"),
+                               false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -94,9 +92,8 @@ namespace
        // Char added to begin
        TEST_F(StringDiffsAddsTest, AddBeginFirstChar1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("1abcdefgh"),
-                               false, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("1abcdefgh"),
+                               false, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -111,9 +108,8 @@ namespace
        // Char added to begin
        TEST_F(StringDiffsAddsTest, AddBeginFirstChar2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("1abcdefgh"), _T("abcdefgh"),
-                               false, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("1abcdefgh"), _T("abcdefgh"),
+                               false, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -128,9 +124,8 @@ namespace
        // Char added to end
        TEST_F(StringDiffsAddsTest, AddEndFirst1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("abcdefgh1"),
-                               false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("abcdefgh1"),
+                               false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -145,9 +140,8 @@ namespace
        // Char added to end
        TEST_F(StringDiffsAddsTest, AddEndFirst2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdefgh1"), _T("abcdefgh"),
-                               false, 0, 0, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdefgh1"), _T("abcdefgh"),
+                               false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -162,9 +156,8 @@ namespace
        // Char added to end
        TEST_F(StringDiffsAddsTest, AddEndFirstChar1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("abcdefgh1"),
-                               false, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdefgh"), _T("abcdefgh1"),
+                               false, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -179,9 +172,8 @@ namespace
        // Char added to end
        TEST_F(StringDiffsAddsTest, AddEndFirstChar2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(_T("abcdefgh1"), _T("abcdefgh"),
-                               false, 0, 0, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdefgh1"), _T("abcdefgh"),
+                               false, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() >= 1)
                {
@@ -195,11 +187,10 @@ namespace
        // exchange string left right side only
        TEST_F(StringDiffsAddsTest, ExchangeString1a)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(_T("N2130   _RobOk=_INT B_AND 512                   ;Roboter bereit"),
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("N2130   _RobOk=_INT B_AND 512                   ;Roboter bereit"),
                        _T("N2040   _RobOk=_INT B_AND 'B1000000000'          ;Roboter bereit"),
-                               false, 1, 0, true, &diffs);
+                               false, 1, 0, true);
                EXPECT_EQ(2, diffs.size());
                if (diffs.size() > 1)
                {
@@ -218,11 +209,10 @@ namespace
        // exchange string left right side only
        TEST_F(StringDiffsAddsTest, ExchangeString1b)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(_T("N2040   _RobOk=_INT B_AND 'B1000000000'          ;Roboter bereit"),
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("N2040   _RobOk=_INT B_AND 'B1000000000'          ;Roboter bereit"),
                        _T("N2130   _RobOk=_INT B_AND 512                   ;Roboter bereit"),
-                               false, 1, 0, true, &diffs);
+                               false, 1, 0, true);
                EXPECT_EQ(2, diffs.size());
                if (diffs.size() > 1)
                {
@@ -242,13 +232,12 @@ namespace
        // exchange string left right side only
        TEST_F(StringDiffsAddsTest, ExchangeString2a)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0123456789012345678901234567890123456789
                        _T("N1960 IF(R2941==2) OR (R2941==203))"),
                        _T("N1830 IF((R2941==2)   OR (R2941==3)    "),
-                               false, 1, 1, true, &diffs);
+                               false, 1, 1, true);
                EXPECT_EQ(4, diffs.size());
                if (diffs.size() > 3)
                {
@@ -277,13 +266,12 @@ namespace
        // exchange string left right side only
        TEST_F(StringDiffsAddsTest, ExchangeString2b)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0123456789012345678901234567890123456789
                        _T("N1830 IF((R2941==2)   OR (R2941==3)    "),
                        _T("N1960 IF(R2941==2) OR (R2941==203))"),
-                               false, 1, 1, true, &diffs);
+                               false, 1, 1, true);
                EXPECT_EQ(4, diffs.size());
                if (diffs.size() > 3)
                {
@@ -312,13 +300,12 @@ namespace
        // new option third run
        TEST_F(StringDiffsAddsTest, RunThird)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0123456789012345678901234567890123456789
                        _T("(sizeof *new);"),
                        _T("sizeof(*newob));"),
-                               false, 1, 0, true, &diffs);
+                               false, 1, 0, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() == 1)
index 125a6d4..1a17f8f 100644 (file)
@@ -62,12 +62,11 @@ namespace
        // (ENUMRESLANGPROC) added to middle
        TEST_F(StringDiffsBugsTest, Bug_1685466_1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
                        _T("if (EnumResourceLanguages(hinstLang, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), (ENUMRESLANGPROC)FindNextResLang, (LPARAM)&wLangID) == 0)"),
                        _T("if (EnumResourceLanguages(hinstLang, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), FindNextResLang, (LPARAM)&wLangID) == 0)"),
-                       false, 0, 1, true, &diffs);
+                       false, 0, 1, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -83,12 +82,11 @@ namespace
        // (ENUMRESLANGPROC) added to middle
        TEST_F(StringDiffsBugsTest, Bug_1685466_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
                        _T("if (EnumResourceLanguages(hinstLang, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), (ENUMRESLANGPROC)FindNextResLang, (LPARAM)&wLangID) == 0)"),
                        _T("if (EnumResourceLanguages(hinstLang, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), FindNextResLang, (LPARAM)&wLangID) == 0)"),
-                       false, 0, 1, false, &diffs);
+                       false, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -104,12 +102,11 @@ namespace
        // various changes
        TEST_F(StringDiffsBugsTest, Bug_1939279_1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
                        _T("[overlay_oid_origin, overlay_oid_target], [nil, nil]"),
                        _T("[overlay_oid_origin, overlay_oid_target, origin_file_name, target_file_name], [nil, nil, \"origin.txt\"), \"target.txt\"]"),
-                       false, 0, 1, true, &diffs);
+                       false, 0, 1, true);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 0)
                {
@@ -125,12 +122,11 @@ namespace
        // various changes
        TEST_F(StringDiffsBugsTest, Bug_1939279_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
                        _T("[overlay_oid_origin, overlay_oid_target], [nil, nil]"),
                        _T("[overlay_oid_origin, overlay_oid_target, origin_file_name, target_file_name], [nil, nil, \"origin.txt\"), \"target.txt\"]"),
-                       false, 0, 1, false, &diffs);
+                       false, 0, 1, false);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 0)
                {
@@ -146,12 +142,11 @@ namespace
        // Chars added to end
        TEST_F(StringDiffsBugsTest, Bug_2022935)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  012345678901234567890
                        _T("N42=Import"), 
                        _T("N42=Importuj"),
-                       false, 0, 1, true, &diffs);
+                       false, 0, 1, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -167,12 +162,11 @@ namespace
        // Char added to end
        TEST_F(StringDiffsBugsTest, Bug_2638045)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php"),
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php4"),
-                       false, 0, 0, false, &diffs);
+                       false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -188,12 +182,11 @@ namespace
        // Char added to end
        TEST_F(StringDiffsBugsTest, Bug_2638045_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php"),
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php4"),
-                       false, 0, 1, false, &diffs);
+                       false, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -209,12 +202,11 @@ namespace
        // Char added to end
        TEST_F(StringDiffsBugsTest, Bug_2638045_3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php"),
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php4"),
-                       false, 0, 0, true, &diffs);
+                       false, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -230,13 +222,12 @@ namespace
        // Char added to end
        TEST_F(StringDiffsBugsTest, Bug_2638045_4)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T("/"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php"),
                        _T("LIB_PHP4_DIR=$(RPM_NAME)-$(RPM_VER)/usr/lib/php4"),
-                       false, 0, 1, false, &diffs);
+                       false, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -253,12 +244,11 @@ namespace
        // word-diff
        TEST_F(StringDiffsBugsTest, Bug_2779834_1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("if (nDiff < m_diffs.size())"),
                        _T("if(nDiff < (int) m_diffs.size())"),
-                       false, 0, 0, false, &diffs);
+                       false, 0, 0, false);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 0)
                {
@@ -275,12 +265,11 @@ namespace
        // char-diff
        TEST_F(StringDiffsBugsTest, Bug_2779834_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("if (nDiff < m_diffs.size())"),
                        _T("if(nDiff < (int) m_diffs.size())"),
-                       false, 0, 0, true, &diffs);
+                       false, 0, 0, true);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 0)
                {
@@ -297,12 +286,11 @@ namespace
        // char-diff
        TEST_F(StringDiffsBugsTest, Bug_2783185_1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("const string ManualFolder = \"Manual\";"),
                        _T("private const string ManualFolder = \"Manual\";"),
-                       false, 0, 0, true, &diffs);
+                       false, 0, 0, true);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -319,12 +307,11 @@ namespace
        // word-diff
        TEST_F(StringDiffsBugsTest, Bug_2783185_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("const string ManualFolder = \"Manual\";"),
                        _T("private const string ManualFolder = \"Manual\";"),
-                       false, 0, 0, false, &diffs);
+                       false, 0, 0, false);
                EXPECT_EQ(1, diffs.size());
                if (diffs.size() > 0)
                {
@@ -341,12 +328,11 @@ namespace
        // char-diff
        TEST_F(StringDiffsBugsTest, Bug_2791879_1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abc def ghi jkl mno"),
                        _T("abc defx ghi jklx mno"),
-                       false, 0, 0, true, &diffs);
+                       false, 0, 0, true);
                EXPECT_EQ(2, diffs.size());
                if (diffs.size() > 1)
                {
@@ -368,12 +354,11 @@ namespace
        // word-diff
        TEST_F(StringDiffsBugsTest, Bug_2791879_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abc def ghi jkl mno"),
                        _T("abc defx ghi jklx mno"),
-                       false, 0, 0, false, &diffs);
+                       false, 0, 0, false);
                EXPECT_EQ(2, diffs.size());
                if (diffs.size() > 1)
                {
@@ -396,13 +381,12 @@ namespace
        // char-diff
        TEST_F(StringDiffsBugsTest, Bug_2793479_1)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T("() "));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0123456789012345678901234567890123456789012345678901234567890123456789
                        _T("static int iTranslateBytesToBC (TCHAR* pd, BYTE* src, int srclen);"),
                        _T("static int iTranslateBytesToBC(TCHAR* pd, const BYTE* src, int srclen);"),
-                       false, 0, 1, true, &diffs);
+                       false, 0, 1, true);
                EXPECT_EQ(2, diffs.size());
                if (diffs.size() > 1)
                {
@@ -425,13 +409,12 @@ namespace
        // word-diff
        TEST_F(StringDiffsBugsTest, Bug_2793479_2)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T("() "));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0123456789012345678901234567890123456789012345678901234567890123456789
                        _T("static int iTranslateBytesToBC (TCHAR* pd, BYTE* src, int srclen);"),
                        _T("static int iTranslateBytesToBC(TCHAR* pd, const BYTE* src, int srclen);"),
-                       false, 0, 1, false, &diffs);
+                       false, 0, 1, false);
                EXPECT_EQ(2, diffs.size());
                if (diffs.size() > 0)
                {
@@ -453,12 +436,11 @@ namespace
        // char-diff
        TEST_F(StringDiffsBugsTest, Bug_2797067_1)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abc def ghi jkl mno pqr stu vwx yz"),
                        _T("abc def 123 ghi jkl mno pqr stu 456 vw x yz"),
-                       false, 0, 0, true, &diffs);
+                       false, 0, 0, true);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 2)
                {
@@ -485,12 +467,11 @@ namespace
        // word-diff
        TEST_F(StringDiffsBugsTest, Bug_2797067_2)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abc def ghi jkl mno pqr stu vwx yz"),
                        _T("abc def 123 ghi jkl mno pqr stu 456 vw x yz"),
-                       false, 0, 0, false, &diffs);
+                       false, 0, 0, false);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 2)
                {
@@ -517,12 +498,11 @@ namespace
        // char-diff
        TEST_F(StringDiffsBugsTest, Bug_2797067_3)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abc def ghi jkl mno pqr stu vwx yzr"),
                        _T("abc def 123ghi jkl mno pqr stu 456vwx yzrr"),
-                       false, 0, 0, true, &diffs);
+                       false, 0, 0, true);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 2)
                {
@@ -549,12 +529,11 @@ namespace
        // word-diff
        TEST_F(StringDiffsBugsTest, Bug_2797067_4)
        {
-               std::vector<strdiff::wdiff> diffs;
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abc def ghi jkl mno pqr stu vwx yzr"),
                        _T("abc def 123ghi jkl mno pqr stu 456vwx yzrr"),
-                       false, 0, 0, false, &diffs);
+                       false, 0, 0, false);
                EXPECT_EQ(3, diffs.size());
                if (diffs.size() > 2)
                {
index 6358d91..ff5cf65 100644 (file)
@@ -58,13 +58,12 @@ namespace
 
        TEST_F(StringDiffsTestByte, ByteLevel19b3)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(",;"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0   1       2       3       4567890123456789012345678901234567890123456789
                        _T("                            wsprintf(buf, _T(left=  %s,   %d,%d, right=  %s,   %d,%d ),"),
                        _T("                                    if (len2 < 50)"),
-                       true, 0, 1, true, &diffs);
+                       true, 0, 1, true);
                EXPECT_EQ(4, diffs.size());
        }
 
@@ -72,12 +71,11 @@ namespace
        // Second word is different
        TEST_F(StringDiffsTestByte, ByteLevel19b2)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(",;"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  0   1234567890123456789012345678901234567890123456789
                        _T("    while (1)"),
-                       _T("    for (;;)"), true, 0, 1, true, &diffs);
+                       _T("    for (;;)"), true, 0, 1, true);
                EXPECT_EQ(2, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() >= 1 )
@@ -109,13 +107,12 @@ namespace
        // Second word is different
        TEST_F(StringDiffsTestByte, ByteLevel19b1)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(","));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T("abcdef,abccef,abcdef,"),
                        _T("abcdef,abcdef,abcdef,"),
-                       true, 0, 1, true, &diffs);
+                       true, 0, 1, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() >= 1 )
@@ -131,13 +128,12 @@ namespace
        // Second word is different
        TEST_F(StringDiffsTestByte, ByteLevel20c)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T(""),
                        _T("            // remove empty records on both side"),
-                       true, 0, 1, true, &diffs);
+                       true, 0, 1, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() >= 1 )
@@ -153,13 +149,12 @@ namespace
        // Second word is different
        TEST_F(StringDiffsTestByte, ByteLevel20a)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(".,;:()[]{}!@#\"$%^&*~+-=<>\'/\\|"));
-               strdiff::ComputeWordDiffs(
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(
                        //  01234567890123456789012345678901234567890123456789
                        _T(",;+ der abcdef,der,Thomas,abcdef,abcdef,;"),
                        _T(",;+ der abcdef,Thomas,accdgf,abcdef,-+"),
-                       true, 0, 1, true, &diffs);
+                       true, 0, 1, true);
                EXPECT_EQ(3, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() >= 1 )
@@ -208,10 +203,9 @@ namespace
        // Second word is different
        TEST_F(StringDiffsTestByte, ByteLevel19a)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(","));
-               strdiff::ComputeWordDiffs(_T("abcdef,abcdef,abcdef,"), _T("abcdef,abccef,abcdef,"),
-                               true, 0, 1, false, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdef,abcdef,abcdef,"), _T("abcdef,abccef,abcdef,"),
+                               true, 0, 1, false);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() >= 1 )
@@ -228,10 +222,9 @@ namespace
 
        TEST_F(StringDiffsTestByte, ByteLevel19b)
        {
-               std::vector<strdiff::wdiff> diffs;
                strdiff::SetBreakChars(_T(","));
-               strdiff::ComputeWordDiffs(_T("abcdef,abccef,abcdef,"), _T("abcdef,abcdef,abcdef,"),
-                               true, 0, 1, true, &diffs);
+               std::vector<strdiff::wdiff> diffs = strdiff::ComputeWordDiffs(_T("abcdef,abccef,abcdef,"), _T("abcdef,abcdef,abcdef,"),
+                               true, 0, 1, true);
                EXPECT_EQ(1, diffs.size());
                strdiff::wdiff *pDiff;
                if (diffs.size() >= 1 )