MCPcopy Create free account
hub / github.com/WinMerge/winmerge / wordLevelToByteLevel

Method wordLevelToByteLevel

Src/stringdiffs.cpp:1083–1113  ·  view source on GitHub ↗

* @brief adjust the range of the specified word diffs down to byte(char) level. * @param str1, str2 [in] line to be compared * @param casitive [in] true for case-sensitive, false for case-insensitive * @param xwhite [in] This governs whether we handle whitespace specially * (see WHITESPACE_COMPARE_ALL, WHITESPACE_IGNORE_CHANGE, WHITESPACE_IGNORE_ALL) */

Source from the content-addressed store, hash-verified

1081 * (see WHITESPACE_COMPARE_ALL, WHITESPACE_IGNORE_CHANGE, WHITESPACE_IGNORE_ALL)
1082 */
1083void stringdiffs::wordLevelToByteLevel()
1084{
1085 for (size_t i = 0; i < m_wdiffs.size(); i++)
1086 {
1087 int begin[3], end[3];
1088 wdiff& diff = m_wdiffs[i];
1089 String str1_2 = m_str1.substr(diff.begin[0], diff.end[0] - diff.begin[0] + 1);
1090 String str2_2 = m_str2.substr(diff.begin[1], diff.end[1] - diff.begin[1] + 1);
1091 ComputeByteDiff(str1_2, str2_2, m_case_sensitive, m_whitespace, begin, end, false);
1092 if (begin[0] == -1)
1093 {
1094 // no visible diff on side1
1095 diff.end[0] = diff.begin[0] - 1;
1096 }
1097 else
1098 {
1099 diff.end[0] = diff.begin[0] + end[0];
1100 diff.begin[0] += begin[0];
1101 }
1102 if (begin[1] == -1)
1103 {
1104 // no visible diff on side2
1105 diff.end[1] = diff.begin[1] - 1;
1106 }
1107 else
1108 {
1109 diff.end[1] = diff.begin[1] + end[1];
1110 diff.begin[1] += begin[1];
1111 }
1112 }
1113}
1114
1115}

Callers 1

ComputeWordDiffsFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected