* @brief Prints (error) message by rescan status.
*
* @param nRescanResult [in] Resultcocode from rescan().
- * @param bBinary [in] Were files binaries?.
* @param bIdentical [in] Were files identical?.
* @sa CMergeDoc::Rescan()
*/
-void CMergeDoc::ShowRescanError(int nRescanResult,
- BOOL bBinary, BOOL bIdentical)
+void CMergeDoc::ShowRescanError(int nRescanResult, BOOL bIdentical)
{
// Rescan was suppressed, there is no sensible status
if (nRescanResult == RESCAN_SUPPRESSED)
return;
}
- // Binary files tried to load, this can happen when giving filenames
- // from commandline
- if (bBinary)
- {
- s = theApp.LoadString(IDS_FILEBINARY);
- AfxMessageBox(s.c_str(), MB_ICONINFORMATION);
- return;
- }
-
// Files are not binaries, but they are identical
if (bIdentical)
{
// Show possible error after updating screen
if (nRescanResult != RESCAN_SUPPRESSED)
- ShowRescanError(nRescanResult, bBinary, bIdentical);
+ ShowRescanError(nRescanResult, bIdentical);
}
/**
OPENRESULTS_TYPE CMergeDoc::OpenDocs(FileLocation filelocLeft, FileLocation filelocRight,
BOOL bROLeft, BOOL bRORight)
{
- BOOL bBinary = FALSE;
BOOL bIdentical = FALSE;
int nRescanResult = RESCAN_OK;
if (!FileLoadResult::IsOk(nLeftSuccess) || !FileLoadResult::IsOk(nRightSuccess))
{
OPENRESULTS_TYPE retVal = OPENRESULTS_FAILED_MISC;
- if (FileLoadResult::IsBinary(nLeftSuccess) || FileLoadResult::IsBinary(nRightSuccess))
- {
- CompareBinaries(sLeftFile, sRightFile, nLeftSuccess, nRightSuccess);
- retVal = OPENRESULTS_FAILED_BINARY;
- }
CChildFrame *pFrame = GetParentFrame();
if (pFrame)
{
m_pDirDoc->FetchPluginInfos(m_strBothFilenames.c_str(), &infoUnpacker, &infoPrediffer);
m_diffWrapper.SetPrediffer(infoPrediffer);
m_diffWrapper.SetTextForAutomaticPrediff(m_strBothFilenames);
-
+
+ BOOL bBinary = FALSE;
nRescanResult = Rescan(bBinary, bIdentical);
// Open filed if rescan succeed and files are not binaries
- if (nRescanResult == RESCAN_OK && bBinary == FALSE)
+ if (nRescanResult == RESCAN_OK)
{
// prepare the four views
CMergeEditView * pLeft = GetLeftView();
(m_nBufferType[1] == BUFFER_NORMAL) ||
(m_nBufferType[1] == BUFFER_NORMAL_NAMED)))
{
- ShowRescanError(nRescanResult, bBinary, bIdentical);
+ ShowRescanError(nRescanResult, bIdentical);
}
// scroll to first diff
// or the really arcane case that the temp files couldn't be created,
// which is too obscure to bother reporting if you can't write to
// your temp directory, doing nothing is graceful enough for that).
- ShowRescanError(nRescanResult, bBinary, bIdentical);
+ ShowRescanError(nRescanResult, bIdentical);
GetParentFrame()->DestroyWindow();
- return (bBinary ? OPENRESULTS_FAILED_BINARY: OPENRESULTS_FAILED_MISC);
+ return OPENRESULTS_FAILED_MISC;
}
// Force repaint of location pane to update it in case we had some warning
}
/**
- * @brief Compare binary files and print results to user.
- *
- * @param sLeftFile [in] Full path to left file
- * @param sRightFile [in] Full path to right file
- * @param nLeftSuccess [in] Returnvalue from file load for leftside
- * @param nRightSuccess [in] Returnvalue from file load for rightside
- * @sa CMergeDoc::OpenDocs()
- * @sa CMergeDoc::Rescan()
- */
-void CMergeDoc::CompareBinaries(CString sLeftFile, CString sRightFile, int nLeftSuccess, int nRightSuccess)
-{
- int nRescanResult = RESCAN_OK;
- BOOL bBinary = FALSE;
- BOOL bIdentical = FALSE;
-
- // Compare binary files
- if (FileLoadResult::IsBinary(nLeftSuccess) && FileLoadResult::IsBinary(nRightSuccess))
- {
- bBinary = TRUE; // Compare binary files
- nRescanResult = Rescan(bBinary, bIdentical);
- }
-
- if (nRescanResult == RESCAN_OK)
- {
- // Format message shown to user: both files are binaries
- if (FileLoadResult::IsBinary(nLeftSuccess) && FileLoadResult::IsBinary(nRightSuccess))
- {
- CString msg;
- if (bIdentical)
- LangFormatString2(msg, IDS_BINFILES_IDENTICAL, sLeftFile, sRightFile);
- else
- LangFormatString2(msg, IDS_BINFILES_DIFFERENT, sLeftFile, sRightFile);
- msg += _T("\n\n");
- msg += theApp.LoadString(IDS_FILEBINARY).c_str();
- AfxMessageBox(msg, MB_ICONINFORMATION);
- }
- else if (FileLoadResult::IsBinary(nLeftSuccess) || FileLoadResult::IsBinary(nRightSuccess))
- {
- // Other file binary, other text
- CString msg;
- CString msg2;
- if (FileLoadResult::IsBinary(nLeftSuccess))
- LangFormatString1(msg, IDS_OTHER_IS_BINARY, sLeftFile);
- else
- LangFormatString1(msg, IDS_OTHER_IS_BINARY, sRightFile);
-
- AfxMessageBox(msg, MB_ICONSTOP);
- }
- }
- else
- ShowRescanError(nRescanResult, bBinary, bIdentical);
-}
-
-/**
* @brief Refresh cached options.
*
* For compare speed, we have to cache some frequently needed options,