| 61 | } |
| 62 | |
| 63 | DiffSelections polishedSelections(const DiffSelections &selections) |
| 64 | { |
| 65 | DiffSelections polishedSelections; |
| 66 | for (auto it = selections.cbegin(), end = selections.cend(); it != end; ++it) { |
| 67 | const QList<DiffSelection> diffSelections = it.value(); |
| 68 | QList<DiffSelection> workingList; |
| 69 | for (const DiffSelection &diffSelection : diffSelections) { |
| 70 | if (diffSelection.start == -1 && diffSelection.end == 0) |
| 71 | continue; |
| 72 | |
| 73 | if (diffSelection.start == diffSelection.end && diffSelection.start >= 0) |
| 74 | continue; |
| 75 | |
| 76 | int j = 0; |
| 77 | while (j < workingList.count()) { |
| 78 | const DiffSelection existingSelection = workingList.takeAt(j); |
| 79 | const QList<DiffSelection> newSelection = subtractSelection(existingSelection, diffSelection); |
| 80 | for (int k = 0; k < newSelection.count(); k++) |
| 81 | workingList.insert(j + k, newSelection.at(k)); |
| 82 | j += newSelection.count(); |
| 83 | } |
| 84 | workingList.append(diffSelection); |
| 85 | } |
| 86 | polishedSelections.insert(it.key(), workingList); |
| 87 | } |
| 88 | return polishedSelections; |
| 89 | } |
| 90 | |
| 91 | int DiffChunkInfo::chunkIndexForBlockNumber(int blockNumber) const |
| 92 | { |
no test coverage detected