MCPcopy Create free account
hub / github.com/KDE/kdiff3 / calcDiff3LineListUsingAC

Method calcDiff3LineListUsingAC

src/diff.cpp:205–262  ·  view source on GitHub ↗

Second step

Source from the content-addressed store, hash-verified

203
204// Second step
205void Diff3LineList::calcDiff3LineListUsingAC(const DiffList* pDiffListAC)
206{
207 ////////////////
208 // Now insert data from C using pDiffListAC
209
210 Diff3LineList::iterator i3 = begin();
211 LineRef lineA = 0;
212 LineRef lineC = 0;
213
214 for(Diff d: *pDiffListAC)
215 {
216 assert(d.diff1() <= limits<LineType>::max() && d.diff2() <= limits<LineType>::max());
217
218 while(d.numberOfEquals() > 0)
219 {
220 Diff3Line d3l;
221
222 // Find the corresponding lineA
223 while(i3->getLineA() != lineA && i3 != end())
224 ++i3;
225 assert(i3 != end());
226
227 i3->setLineC(lineC);
228 i3->bAEqC = true;
229 i3->bBEqC = i3->isEqualAB();
230
231 d.adjustNumberOfEquals(-1);
232 ++lineA;
233 ++lineC;
234 ++i3;
235 }
236 assert(i3 != end() || (d.diff1() == 0 && d.diff2() == 0));
237
238 while(d.diff1() > 0 && d.diff2() > 0)
239 {
240 Diff3Line d3l;
241
242 d3l.setLineC(lineC);
243 insert(i3, d3l);
244 d.adjustDiff1(-1);
245 d.adjustDiff2(-1);
246 ++lineA;
247 ++lineC;
248 }
249
250 lineA += (LineRef)d.diff1();
251
252 while(d.diff2() > 0)
253 {
254 Diff3Line d3l;
255
256 d3l.setLineC(lineC);
257 insert(i3, d3l);
258 d.adjustDiff2(-1);
259 ++lineC;
260 }
261 }
262}

Callers 2

determineFileAlignmentFunction · 0.80
mainInitMethod · 0.80

Calls 9

diff1Method · 0.80
diff2Method · 0.80
numberOfEqualsMethod · 0.80
getLineAMethod · 0.80
setLineCMethod · 0.80
adjustNumberOfEqualsMethod · 0.80
adjustDiff1Method · 0.80
adjustDiff2Method · 0.80
isEqualABMethod · 0.45

Tested by 1

determineFileAlignmentFunction · 0.64