| 227 | } |
| 228 | |
| 229 | void CDirDoc::InitDiffContext(CDiffContext *pCtxt) |
| 230 | { |
| 231 | LoadLineFilterList(pCtxt); |
| 232 | LoadSubstitutionFiltersList(pCtxt); |
| 233 | |
| 234 | auto* pOptions = GetOptionsMgr(); |
| 235 | DIFFOPTIONS options = {0}; |
| 236 | Options::DiffOptions::Load(pOptions, options); |
| 237 | |
| 238 | pCtxt->CreateCompareOptions(pOptions->GetInt(OPT_CMP_METHOD), options); |
| 239 | |
| 240 | pCtxt->m_iGuessEncodingType = pOptions->GetInt(OPT_CP_DETECT); |
| 241 | if ((pCtxt->m_iGuessEncodingType >> 16) == 0) |
| 242 | pCtxt->m_iGuessEncodingType |= 50001 << 16; |
| 243 | pCtxt->m_bIgnoreSmallTimeDiff = pOptions->GetBool(OPT_IGNORE_SMALL_FILETIME); |
| 244 | pCtxt->m_bStopAfterFirstDiff = pOptions->GetBool(OPT_CMP_STOP_AFTER_FIRST); |
| 245 | pCtxt->m_nQuickCompareLimit = pOptions->GetInt(OPT_CMP_QUICK_LIMIT); |
| 246 | pCtxt->m_nBinaryCompareLimit = pOptions->GetInt(OPT_CMP_BINARY_LIMIT); |
| 247 | pCtxt->m_bPluginsEnabled = pOptions->GetBool(OPT_PLUGINS_ENABLED); |
| 248 | pCtxt->m_bWalkUniques = pOptions->GetBool(OPT_CMP_WALK_UNIQUE_DIRS); |
| 249 | pCtxt->m_bIgnoreReparsePoints = pOptions->GetBool(OPT_CMP_IGNORE_REPARSE_POINTS); |
| 250 | pCtxt->m_bIgnoreCodepage = pOptions->GetBool(OPT_CMP_IGNORE_CODEPAGE); |
| 251 | pCtxt->m_bEnableImageCompare = pOptions->GetBool(OPT_CMP_ENABLE_IMGCMP_IN_DIRCMP); |
| 252 | pCtxt->m_dColorDistanceThreshold = pOptions->GetInt(OPT_CMP_IMG_THRESHOLD) / 1000.0; |
| 253 | |
| 254 | m_imgfileFilter.SetMaskOrExpression(pOptions->GetString(OPT_CMP_IMG_FILEPATTERNS)); |
| 255 | pCtxt->m_pImgfileFilter = &m_imgfileFilter; |
| 256 | |
| 257 | pCtxt->m_pCompareStats = m_pCompareStats.get(); |
| 258 | |
| 259 | // Make sure filters are up-to-date |
| 260 | auto* pGlobalFileFilter = theApp.GetGlobalFileFilter(); |
| 261 | pGlobalFileFilter->ReloadUpdatedFilters(); |
| 262 | m_fileHelper.CloneFrom(pGlobalFileFilter); |
| 263 | pCtxt->m_piFilterGlobal = &m_fileHelper; |
| 264 | pCtxt->m_piFilterGlobal->SetDiffContext(pCtxt); |
| 265 | |
| 266 | pCtxt->m_pAdditionalCompareExpression.reset(); |
| 267 | const String additionalCompareCondition = pOptions->GetString(OPT_CMP_ADDITIONAL_CONDITION); |
| 268 | if (!additionalCompareCondition.empty()) |
| 269 | { |
| 270 | pCtxt->m_pAdditionalCompareExpression = std::make_unique<FilterExpression>(ucr::toUTF8(additionalCompareCondition)); |
| 271 | pCtxt->m_pAdditionalCompareExpression->SetDiffContext(pCtxt); |
| 272 | } |
| 273 | |
| 274 | if (pOptions->GetInt(OPT_CMP_RENAME_MOVE_DETECTION) > 0) |
| 275 | { |
| 276 | const String renameMoveKeyExpression = pOptions->GetString(OPT_CMP_RENAME_MOVE_KEY); |
| 277 | if (!renameMoveKeyExpression.empty()) |
| 278 | { |
| 279 | pCtxt->m_pRenameMoveDetection = std::make_unique<RenameMoveDetection>(); |
| 280 | FilterExpression renameMoveKeyExpressionObj(ucr::toUTF8(renameMoveKeyExpression)); |
| 281 | renameMoveKeyExpressionObj.SetDiffContext(pCtxt); |
| 282 | pCtxt->m_pRenameMoveDetection->SetRenameMoveKeyExpression(&renameMoveKeyExpressionObj); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | std::set<String> nameSet; |
nothing calls this directly
no test coverage detected