From 99e9e34dbac2602a19e4af2ea6f251e4e4214451 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Sat, 27 Feb 2016 20:39:45 +0900 Subject: [PATCH] "Filter comments" feature did not work properly in the case of issue #41 --- Src/DiffWrapper.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Src/DiffWrapper.cpp b/Src/DiffWrapper.cpp index 1b65c4548..046c9cab9 100644 --- a/Src/DiffWrapper.cpp +++ b/Src/DiffWrapper.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -533,7 +534,8 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb PostFilter(LineNumberRight, -1, -1, QtyLinesRight, RightOp, 1, filtercommentsset); } - for(int i = 0; (i < QtyLinesLeft) || (i < QtyLinesRight); i++) + std::list LeftLines, RightLines; + for (int i = 0; (i < QtyLinesLeft) || (i < QtyLinesRight); i++) { //Lets test all lines if only a comment is different. const char * LineStrLeft = ""; @@ -627,12 +629,14 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb std::transform(LineDataRight.begin(), LineDataRight.end(), LineDataRight.begin(), ::toupper); } - if (LineDataLeft != LineDataRight) - { - return; - } + if (!LineDataLeft.empty()) + LeftLines.push_back(LineDataLeft); + if (!LineDataRight.empty()) + RightLines.push_back(LineDataRight); } } + if (LeftLines != RightLines) + return; //only difference is trival Op = OP_TRIVIAL; } -- 2.11.0