OSDN Git Service

2005-07-21 Perry
authorPerry Rapp <elsapo@users.sourceforge.net>
Thu, 21 Jul 2005 12:57:19 +0000 (12:57 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Thu, 21 Jul 2005 12:57:19 +0000 (12:57 +0000)
 PATCH: [ 1226311 ] Record notes about why compare failed
  Src: DiffItem.h DiffWrapper.cpp DiffWrapper.h

Src/DiffItem.h
Src/DiffWrapper.cpp
Src/DiffWrapper.h
Src/readme.txt

index 2bbe7d7..385dacf 100644 (file)
@@ -84,6 +84,7 @@ struct DIFFITEM : DIFFCODE
        CString sRightSubdir; /**< Right subdirectory from root of comparison */
        int     nsdiffs; /**< Amount of non-ignored differences */
        int ndiffs; /**< Total amount of differences */
+       CString errorDesc; /**< technical note about error */
 
        DIFFITEM() : ndiffs(-1), nsdiffs(-1) { }
 
index 497df44..7300242 100644 (file)
@@ -1492,7 +1492,7 @@ bool DiffFileData::FilepathWithEncoding::Transform(const CString & filepath, CSt
 /**
  * @brief Prepare files (run plugins) & compare them, and return diffcode
  */
-int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, const DIFFITEM &di)
+int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di)
 {
        int nCompMethod = pCtxt->m_nCompMethod;
        CString filepath1;
@@ -1524,30 +1524,45 @@ int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, const DIFFITEM &d
        //DiffFileData diffdata; //(filepathTransformed1, filepathTransformed2);
        // Invoke unpacking plugins
        if (!Unpack(filepathUnpacked1, filteredFilenames, infoUnpacker))
+       {
+               di.errorDesc = _T("Unpack Error Side 1");
                goto exitPrepAndCompare;
+       }
 
        // we use the same plugins for both files, so they must be defined before second file
        ASSERT(infoUnpacker->bToBeScanned == FALSE);
 
        if (!Unpack(filepathUnpacked2, filteredFilenames, infoUnpacker))
+       {
+               di.errorDesc = _T("Unpack Error Side 2");
                goto exitPrepAndCompare;
+       }
 
        // As we keep handles open on unpacked files, Transform() may not delete them.
        // Unpacked files will be deleted at end of this function.
        /*diffdata.m_sFilepath[0] = */filepathTransformed1 = filepathUnpacked1;
        /*diffdata.m_sFilepath[1] = */filepathTransformed2 = filepathUnpacked2;
        if (!OpenFiles(filepathTransformed1, filepathTransformed2))
+       {
+               di.errorDesc = _T("OpenFiles Error (before tranform)");
                goto exitPrepAndCompare;
+       }
 
        // Invoke prediff'ing plugins
        if (!m_sFilepath[0].Transform(filepathUnpacked1, filepathTransformed1, filteredFilenames, infoPrediffer, m_inf[0].desc))
+       {
+               di.errorDesc = _T("Transform Error Side 1");
                goto exitPrepAndCompare;
+       }
 
        // we use the same plugins for both files, so they must be defined before second file
        ASSERT(infoPrediffer->bToBeScanned == FALSE);
 
        if (!m_sFilepath[1].Transform(filepathUnpacked2, filepathTransformed2, filteredFilenames, infoPrediffer, m_inf[1].desc))
+       {
+               di.errorDesc = _T("Transform Error Side 2");
                goto exitPrepAndCompare;
+       }
 
        // If options are binary equivalent, we could check for filesize
        // difference here, and bail out if files are clearly different
@@ -1561,7 +1576,10 @@ int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, const DIFFITEM &d
                //diffdata.m_sFilepath[0] = filepathTransformed1;
                //diffdata.m_sFilepath[1] = filepathTransformed2;
                if (!OpenFiles(filepathTransformed1, filepathTransformed2))
+               {
+                       di.errorDesc = _T("OpenFiles Error (after tranform)");
                        goto exitPrepAndCompare;
+               }
        }
 
        // If either file is larger than 2 Megs compare files by quick contents
@@ -1576,6 +1594,8 @@ int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, const DIFFITEM &d
        {
                // use diffutils
                code = diffutils_compare_files(0);
+               if (code & DIFFCODE::CMPERR)
+                       di.errorDesc = _T("DiffUtils Error");
        }
        else if (nCompMethod == CMP_QUICK_CONTENT)
        {
@@ -1586,6 +1606,7 @@ int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, const DIFFITEM &d
        {
                // Print error since we should have handled by date compare earlier
                _RPTF0(_CRT_ERROR, "Invalid compare type, DiffFileData can't handle it");
+               di.errorDesc = _T("Bad compare type");
                goto exitPrepAndCompare;
        }
 
index cc8fff0..11eff25 100644 (file)
@@ -233,7 +233,7 @@ struct DiffFileData
        int diffutils_compare_files(int depth);
        int byte_compare_files();
        void GuessEncoding(int side, CDiffContext * pCtxt);
-       int prepAndCompareTwoFiles(CDiffContext * pCtxt, const DIFFITEM &di);
+       int prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di);
        BOOL Diff2Files(struct change ** diffs, int depth,
                int * bin_status, BOOL bMovedBlocks);
 
index f18a4da..3aa4d89 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-21 Perry
+ PATCH: [ 1226311 ] Record notes about why compare failed
+  Src: DiffItem.h DiffWrapper.cpp DiffWrapper.h
+
 2005-07-20 Perry 
  PATCH: [ 1241753 ] Fix DirViewColItems int64 cast warnings
   Src: DirViewColItems.cpp