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

Method SetToDiffUtils

Src/CompareOptions.cpp:132–179  ·  view source on GitHub ↗

* @brief Set options to diffutils. * Diffutils uses options from global variables we must set. Those variables * aren't most logically named, and most are just int's, with some magic * values and meanings, with fancy combinations? So not easy to setup. This * function maps our easier to handle compare options to diffutils globals. */

Source from the content-addressed store, hash-verified

130 * function maps our easier to handle compare options to diffutils globals.
131 */
132void DiffutilsOptions::SetToDiffUtils()
133{
134 switch (m_outputStyle)
135 {
136 case DIFF_OUTPUT_NORMAL:
137 output_style = OUTPUT_NORMAL;
138 break;
139 case DIFF_OUTPUT_CONTEXT:
140 output_style = OUTPUT_CONTEXT;
141 break;
142 case DIFF_OUTPUT_UNIFIED:
143 output_style = OUTPUT_UNIFIED;
144 break;
145 case DIFF_OUTPUT_HTML:
146 output_style = OUTPUT_HTML;
147 break;
148 default:
149 throw "Unknown output style!";
150 break;
151 }
152
153 context = m_contextLines;
154
155 ignore_space_change_flag = (m_ignoreWhitespace == WHITESPACE_IGNORE_CHANGE);
156 ignore_all_space_flag = (m_ignoreWhitespace == WHITESPACE_IGNORE_ALL);
157 ignore_blank_lines_flag = m_bIgnoreBlankLines;
158 ignore_case_flag = m_bIgnoreCase;
159 ignore_numbers_flag = m_bIgnoreNumbers;
160 ignore_eol_diff = m_bIgnoreEOLDifference;
161 ignore_some_changes = (m_ignoreWhitespace != WHITESPACE_COMPARE_ALL || m_bIgnoreCase || m_bIgnoreBlankLines || m_bIgnoreEOLDifference);
162 length_varies = (m_ignoreWhitespace != WHITESPACE_COMPARE_ALL);
163
164 // We have no interest changing these values, hard-code them.
165 always_text_flag = 0; // diffutils needs to detect binary files
166 horizon_lines = 0;
167 heuristic = 1;
168 recursive = 0;
169
170 no_diff_means_no_output = 0;
171 no_details_flag = 0;
172 line_end_char = '\n';
173 tab_align_flag = 0;
174 tab_expand_flag = 0;
175 paginate_flag = 0;
176 switch_string = NULL;
177 file_label[0] = NULL;
178 file_label[1] = NULL;
179}
180
181/**
182 * @brief Gets options to DIFFOPTIONS structure.

Callers 2

SetOptionsMethod · 0.80
RunFileDiffMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected