OSDN Git Service

PATCH: [ 1373020 ] Carry unicoding, codepage, & file path together
authorPerry Rapp <elsapo@users.sourceforge.net>
Sat, 10 Dec 2005 05:58:22 +0000 (05:58 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Sat, 10 Dec 2005 05:58:22 +0000 (05:58 +0000)
  Src: DiffWrapper.cpp DiffWrapper.h DirScan.cpp DirView.cpp
   MainFrm.cpp MainFrm.h Merge.dsp MergeDoc.cpp MergeDoc.h
  Src\Common: RegKey.cpp

Src/Changes.txt
Src/Common/RegKey.cpp
Src/DiffWrapper.cpp
Src/DiffWrapper.h
Src/DirScan.cpp
Src/DirView.cpp
Src/MainFrm.cpp
Src/MainFrm.h
Src/Merge.dsp
Src/MergeDoc.cpp
Src/MergeDoc.h

index de4516e..bc38695 100644 (file)
@@ -3,6 +3,10 @@
   Plugins\src_VCPP\DisplayXMLFiles: DisplayXMLFiles.dsp
   Src\ExpatMapLib added
   Many files moved from DisplayXMLFiles to new ExpatMapLib
+ PATCH: [ 1373020 ] Carry unicoding, codepage, & file path together
+  Src: DiffWrapper.cpp DiffWrapper.h DirScan.cpp DirView.cpp
+   MainFrm.cpp MainFrm.h Merge.dsp MergeDoc.cpp MergeDoc.h
+  Src\Common: RegKey.cpp
 
 2005-12-09 Perry
  PATCH: [ 1188787 ] New Chinese translation rc file (from PATCH 1183476)
index 8dd33ab..82f28cc 100644 (file)
@@ -193,9 +193,9 @@ CString CRegKeyEx::ReadString (LPCTSTR pszKey, LPCTSTR defval)
                &dwType, (LPBYTE) string, &dwSize);
 
        if (lReturn == ERROR_SUCCESS)
-               return CString(string);
+               return string;
        else
-               return CString(defval);
+               return defval;
 }
 
 void CRegKeyEx::ReadChars (LPCTSTR pszKey, LPTSTR pData, DWORD dwLen, LPCTSTR defval)
index 19d17a7..123c8bc 100644 (file)
@@ -833,9 +833,10 @@ DiffFileData::DiffFileData()
        m_ntrivialdiffs = DiffFileData::DIFFS_UNKNOWN;
        Reset();
        // Set default codepages
-       for (i=0; i<sizeof(m_sFilepath)/sizeof(m_sFilepath[0]); ++i)
+       for (i=0; i<sizeof(m_FileLocation)/sizeof(m_FileLocation[0]); ++i)
        {
-               m_sFilepath[i].codepage = f_defcp;
+               m_FileLocation[i].unicoding = ucr::NONE;
+               m_FileLocation[i].codepage = f_defcp;
        }
 }
 
@@ -849,8 +850,8 @@ DiffFileData::~DiffFileData()
 /** @brief Open file descriptors in the inf structure (return false if failure) */
 bool DiffFileData::OpenFiles(LPCTSTR szFilepath1, LPCTSTR szFilepath2)
 {
-       m_sFilepath[0].AssignPath(szFilepath1);
-       m_sFilepath[1].AssignPath(szFilepath2);
+       m_FileLocation[0].setPath(szFilepath1);
+       m_FileLocation[1].setPath(szFilepath2);
        bool b = DoOpenFiles();
        if (!b)
                Reset();
@@ -866,7 +867,7 @@ bool DiffFileData::DoOpenFiles()
        {
                // Fill in 8-bit versions of names for diffutils (WinMerge doesn't use these)
                USES_CONVERSION;
-               m_inf[i].name = strdup(T2CA(m_sFilepath[i]));
+               m_inf[i].name = strdup(T2CA(m_FileLocation[i].filepath));
                if (m_inf[i].name == NULL)
                        return false;
 
@@ -875,7 +876,7 @@ bool DiffFileData::DoOpenFiles()
                // Also, WinMerge-modified diffutils handles all three major eol styles
                if (m_inf[i].desc == 0)
                {
-               m_inf[i].desc = _topen(m_sFilepath[i], O_RDONLY|O_BINARY, _S_IREAD);
+                       m_inf[i].desc = _topen(m_FileLocation[i].filepath, O_RDONLY|O_BINARY, _S_IREAD);
                }
                if (m_inf[i].desc < 0)
                        return false;
@@ -885,7 +886,7 @@ bool DiffFileData::DoOpenFiles()
                {
                        return false;
                }
-               if (m_sFilepath[1] == m_sFilepath[0])
+               if (0 == m_FileLocation[1].filepath.CompareNoCase(m_FileLocation[0].filepath))
                {
                        m_inf[1].desc = m_inf[0].desc;
                }
@@ -928,13 +929,12 @@ void DiffFileData::Reset()
 /**
  * @brief Try to deduce encoding for this file
  */
-void DiffFileData::FilepathWithEncoding::GuessEncoding(const char **data, int count)
+void DiffFileData::Filepath_GuessEncoding(FileLocation & fpenc, const char **data, int count)
 {
-       if (unicoding == 0)
+       if (fpenc.unicoding == 0)
        {
-               const CString & filepath = *this;
-               CString sExt = PathFindExtension(filepath);
-               GuessEncoding_from_bytes(sExt, data, count, &codepage);
+               CString sExt = PathFindExtension(fpenc.filepath);
+               GuessEncoding_from_bytes(sExt, data, count, &fpenc.codepage);
        }
 }
 
@@ -944,7 +944,7 @@ void DiffFileData::GuessEncoding(int side, CDiffContext * pCtxt)
        if (!pCtxt->m_bGuessEncoding)
                return;
 
-       m_sFilepath[side].GuessEncoding(m_inf[side].linbuf + m_inf[side].linbuf_base, 
+       Filepath_GuessEncoding(m_FileLocation[side], m_inf[side].linbuf + m_inf[side].linbuf_base, 
                                        m_inf[side].valid_lines - m_inf[side].linbuf_base);
 }
 
@@ -1438,15 +1438,15 @@ void GetComparePaths(CDiffContext * pCtxt, const DIFFITEM &di, CString & left, C
  * return false if anything fails
  * caller has to DeleteFile filepathTransformed, if it differs from filepath
  */
-bool DiffFileData::FilepathWithEncoding::Transform(const CString & filepath, CString & filepathTransformed,
+bool DiffFileData::Filepath_Transform(FileLocation & fpenc, const CString & filepath, CString & filepathTransformed,
        const CString & filteredFilenames, PrediffingInfo * infoPrediffer, int fd)
 {
        BOOL bMayOverwrite = FALSE; // temp variable set each time it is used
 
        UniFileBom bom = fd; // guess encoding
-       unicoding = bom.unicoding;
+       fpenc.unicoding = bom.unicoding;
 
-       if (unicoding && unicoding != ucr::UCS2LE)
+       if (fpenc.unicoding && fpenc.unicoding != ucr::UCS2LE)
        {
                // second step : normalize Unicode to OLECHAR (most of time, do nothing) (OLECHAR = UCS-2LE in Windows)
                bMayOverwrite = (filepathTransformed != filepath); // may overwrite if we've already copied to temp file
@@ -1477,7 +1477,7 @@ bool DiffFileData::FilepathWithEncoding::Transform(const CString & filepath, CSt
                        return false;
        }
 
-       if (unicoding)
+       if (fpenc.unicoding)
        {
                // fourth step : prepare for diffing
                // may overwrite if we've already copied to temp file
@@ -1548,7 +1548,7 @@ int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di)
        }
 
        // Invoke prediff'ing plugins
-       if (!m_sFilepath[0].Transform(filepathUnpacked1, filepathTransformed1, filteredFilenames, infoPrediffer, m_inf[0].desc))
+       if (!Filepath_Transform(m_FileLocation[0], filepathUnpacked1, filepathTransformed1, filteredFilenames, infoPrediffer, m_inf[0].desc))
        {
                di.errorDesc = _T("Transform Error Side 1");
                goto exitPrepAndCompare;
@@ -1557,7 +1557,7 @@ int DiffFileData::prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di)
        // 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))
+       if (!Filepath_Transform(m_FileLocation[1], filepathUnpacked2, filepathTransformed2, filteredFilenames, infoPrediffer, m_inf[1].desc))
        {
                di.errorDesc = _T("Transform Error Side 2");
                goto exitPrepAndCompare;
@@ -1700,7 +1700,7 @@ int DiffFileData::byte_compare_files(BOOL bStopAfterFirstDiff, const IAbortable
        // Open both files
        for (i=0; i<2; ++i)
        {
-               fp[i] = _tfopen(m_sFilepath[i], _T("rb"));
+               fp[i] = _tfopen(m_FileLocation[i].filepath, _T("rb"));
                if (!fp[i])
                        return DIFFCODE::CMPERR;
                fhd[i].Assign(fp[i]);
index e703b0b..2d1383e 100644 (file)
@@ -27,6 +27,9 @@
 #ifndef _DIFFWRAPPER_H
 #define _DIFFWRAPPER_H
 
+#include "FileLocation.h"
+
+
 class CDiffContext;
 class PrediffingInfo;
 struct DIFFRANGE;
@@ -245,6 +248,7 @@ struct DiffFileData
 
        file_data * m_inf;
        bool m_used; // whether m_inf has real data
+/*
        struct FilepathWithEncoding : CString
        {
                int unicoding;
@@ -256,7 +260,13 @@ struct DiffFileData
                        const CString & filteredFilenames, PrediffingInfo * infoPrediffer, int fd);
                void GuessEncoding(const char **data, int count);
                void AssignPath(const CString & sFilePath) { CString::operator=(sFilePath); }
-       } m_sFilepath[2];
+       }
+*/
+       FileLocation m_FileLocation[2];
+       bool Filepath_Transform(FileLocation & fpenc, const CString & filepath, CString & filepathTransformed,
+               const CString & filteredFilenames, PrediffingInfo * infoPrediffer, int fd);
+       void Filepath_GuessEncoding(FileLocation & fpenc, const char **data, int count);
+
        int m_ndiffs;
        int m_ntrivialdiffs;
        struct UniFileBom // detect unicode file and quess encoding
index 9190aeb..273fddb 100644 (file)
@@ -537,14 +537,14 @@ static void StoreDiffResult(DIFFITEM &di, CDiffContext * pCtxt,
 
                if (!di.isSideLeft())
                {
-                       di.right.unicoding = pDiffFileData->m_sFilepath[1].unicoding;
-                       di.right.codepage = pDiffFileData->m_sFilepath[1].codepage;
+                       di.right.unicoding = pDiffFileData->m_FileLocation[1].unicoding;
+                       di.right.codepage = pDiffFileData->m_FileLocation[1].codepage;
                }
                
                if (!di.isSideRight())
                {
-                       di.left.unicoding = pDiffFileData->m_sFilepath[0].unicoding;
-                       di.left.codepage = pDiffFileData->m_sFilepath[0].codepage;
+                       di.left.unicoding = pDiffFileData->m_FileLocation[0].unicoding;
+                       di.left.codepage = pDiffFileData->m_FileLocation[0].codepage;
                }
        }
 
index 74b37f1..f714d86 100644 (file)
@@ -1050,10 +1050,16 @@ void CDirView::OpenSelection(PackingInfo * infoUnpacker /*= NULL*/)
                BOOL bLeftRO = pDoc->GetReadOnly(TRUE);
                BOOL bRightRO = pDoc->GetReadOnly(FALSE);
 
-               int rtn = mf->ShowMergeDoc(pDoc, pathLeft, pathRight,
-                       bLeftRO, bRightRO,
-                       di1->left.codepage, di2->right.codepage,
-                       infoUnpacker);
+               FileLocation filelocLeft(pathLeft);
+               filelocLeft.unicoding = di1->left.unicoding;
+               filelocLeft.codepage = di1->left.codepage;
+
+               FileLocation filelocRight(pathRight);
+               filelocRight.unicoding = di2->right.unicoding;
+               filelocRight.codepage = di2->right.codepage;
+
+               int rtn = mf->ShowMergeDoc(pDoc, filelocLeft, filelocRight,
+                       bLeftRO, bRightRO, infoUnpacker);
                if (rtn == OPENRESULTS_FAILED_BINARY)
                {
                        if (di1 == di2)
index 5cc20c7..6f10b47 100644 (file)
@@ -556,20 +556,34 @@ void CMainFrame::OnFileOpen()
 }
 
 /**
+ * @brief Check for BOM, and also, if bGuessEncoding, try to deduce codepage
+ *
+ * Unpacks info from FileLocation & delegates all work to codepage_detect module
+ */
+static void
+FileLocationGuessEncodings(FileLocation & fileloc, BOOL bGuessEncoding)
+{
+       GuessCodepageEncoding(fileloc.filepath, &fileloc.unicoding, &fileloc.codepage, bGuessEncoding);
+}
+
+/**
  * @brief Creates new MergeDoc instance and shows documents
  *
  * @param cpleft, cpright : left and right codepages
  * = -1 when the file must be parsed
  */
 int /* really an OPENRESULTS_TYPE, but MainFrm.h doesn't know that type */
-CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight,
-       BOOL bROLeft, BOOL bRORight,  int cpleft /*=-1*/, int cpright /*=-1*/,
+CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,  const FileLocation & ifilelocLeft, const FileLocation & ifilelocRight,
+       BOOL bROLeft, BOOL bRORight,
        PackingInfo * infoUnpacker /*= NULL*/)
 {
        BOOL docNull;
        BOOL bOpenSuccess = FALSE;
        CMergeDoc * pMergeDoc = GetMergeDocToShow(pDirDoc, &docNull);
 
+       // Make local copies, so we can change encoding if we guess it below
+       FileLocation filelocLeft = ifilelocLeft, filelocRight = ifilelocRight;
+
        ASSERT(pMergeDoc);              // must ASSERT to get an answer to the question below ;-)
        if (!pMergeDoc)
                return OPENRESULTS_FAILED_MISC; // when does this happen ?
@@ -582,33 +596,33 @@ CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight,
 
        // detect codepage
        BOOL bGuessEncoding = mf->m_options.GetBool(OPT_CP_DETECT);
-       if (cpleft == -1)
+       if (filelocLeft.unicoding == ucr::NONE && filelocLeft.codepage == -1)
        {
-               CString filepath = szLeft;
-               int unicoding;
-               GuessCodepageEncoding(filepath, &unicoding, &cpleft, bGuessEncoding);
+               FileLocationGuessEncodings(filelocLeft, bGuessEncoding);
        }
-       if (cpright == -1)
+
+       if (filelocRight.unicoding == ucr::NONE && filelocRight.codepage == -1)
        {
-               CString filepath = szRight;
-               int unicoding;
-               GuessCodepageEncoding(filepath, &unicoding, &cpright, bGuessEncoding);
+               FileLocationGuessEncodings(filelocRight, bGuessEncoding);
        }
 
-       if (cpleft != cpright)
+       // TODO (Perry, 2005-12-04)
+       // Should we do any unification if unicodings are different?
+
+       if (filelocLeft.codepage != filelocRight.codepage)
        {
                CString msg;
-               msg.Format(IDS_SUGGEST_IGNORECODEPAGE, cpleft, cpright);
+               msg.Format(IDS_SUGGEST_IGNORECODEPAGE, filelocLeft.codepage, filelocRight.codepage);
                int msgflags = MB_YESNO | MB_ICONQUESTION | MB_DONT_ASK_AGAIN;
                // Two files with different codepages
                // Warn and propose to use the default codepage for both
                int userChoice = AfxMessageBox(msg, msgflags);
                if (userChoice == IDYES)
-                       cpleft = cpright = getDefaultCodepage();
+                       filelocLeft.codepage = filelocRight.codepage = getDefaultCodepage();
        }
 
-       OPENRESULTS_TYPE openResults = pMergeDoc->OpenDocs(szLeft, szRight,
-                       bROLeft, bRORight, cpleft, cpright);
+       OPENRESULTS_TYPE openResults = pMergeDoc->OpenDocs(filelocLeft, filelocRight,
+                       bROLeft, bRORight);
 
        if (openResults == OPENRESULTS_SUCCESS)
        {
@@ -1236,9 +1250,6 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
        CString strLeft(pszLeft);
        CString strRight(pszRight);
        PackingInfo infoUnpacker;
-       // TODO: Need to allow user to specify these some day
-       int cpleft= -1; // to be initialized/guessed in ShowMergeDoc
-       int cpright= -1; // to be initialized/guessed in ShowMergeDoc
 
        BOOL bROLeft = dwLeftFlags & FFILEOPEN_READONLY;
        BOOL bRORight = dwRightFlags & FFILEOPEN_READONLY;
@@ -1273,8 +1284,6 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
                infoUnpacker = dlg.m_infoHandler;
                pathsType = static_cast<PATH_EXISTENCE>(dlg.m_pathsType);
                // TODO: add codepage options to open dialog ?
-               cpleft= -1; // to be initialized/guessed in ShowMergeDoc
-               cpright= -1; // to be initialized/guessed in ShowMergeDoc
        }
        else
        {
@@ -1427,8 +1436,11 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
                gLog.Write(LOGLEVEL::LNOTICE, _T("Open files: Left: %s\n\tRight: %s."),
                        strLeft, strRight);
                
-               ShowMergeDoc(pDirDoc, strLeft, strRight, bROLeft, bRORight,
-                       cpleft, cpright, &infoUnpacker);
+               FileLocation filelocLeft(strLeft);
+               FileLocation filelocRight(strRight);
+
+               ShowMergeDoc(pDirDoc, filelocLeft, filelocRight, bROLeft, bRORight,
+                       &infoUnpacker);
        }
        return TRUE;
 }
@@ -2598,8 +2610,10 @@ void CMainFrame::OnFileNew()
        // Use default codepage
        VERIFY(m_strLeftDesc.LoadString(IDS_EMPTY_LEFT_FILE));
        VERIFY(m_strRightDesc.LoadString(IDS_EMPTY_RIGHT_FILE));
-       ShowMergeDoc(pDirDoc, _T(""), _T(""), FALSE, FALSE, 
-               getDefaultCodepage(), getDefaultCodepage());
+       FileLocation filelocLeft; // empty, unspecified (so default) encoding
+       FileLocation filelocRight;
+       ShowMergeDoc(pDirDoc, filelocLeft, filelocRight, FALSE, FALSE);
+
 
        // Empty descriptors now that docs are open
        m_strLeftDesc.Empty();
index bad8db1..cad17ac 100644 (file)
@@ -32,6 +32,7 @@
 #include "ToolBarXPThemes.h"
 #include "OptionsMgr.h"
 #include "VSSHelper.h"
+struct FileLocation;
 
 #define BACKUP_FILE_EXT   _T(".bak")
 
@@ -108,7 +109,7 @@ public:
                CString *psError);
        BOOL DoFileOpen(LPCTSTR pszLeft = NULL, LPCTSTR pszRight = NULL,
                DWORD dwLeftFlags = 0, DWORD dwRightFlags = 0, BOOL bRecurse = FALSE, CDirDoc *pDirDoc = NULL);
-       int ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight, BOOL bROLeft, BOOL bRORight, int cpleft =-1, int cpright =-1, PackingInfo * infoUnpacker = NULL);
+       int ShowMergeDoc(CDirDoc * pDirDoc, const FileLocation & filelocLeft, const FileLocation & filelocRight, BOOL bROLeft, BOOL bRORight, PackingInfo * infoUnpacker = NULL);
        void UpdateResources();
        BOOL CreateBackup(LPCTSTR pszPath);
        int HandleReadonlySave(CString& strSavePath, BOOL bMultiFile, BOOL &bApplyToAll);
index 6033645..16274a3 100644 (file)
@@ -1053,6 +1053,10 @@ SOURCE=.\FileInfo.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\FileLocation.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\FilepathEdit.h
 # End Source File
 # Begin Source File
index 563bba6..acb6415 100644 (file)
@@ -2516,29 +2516,33 @@ bool CMergeDoc::IsValidCodepageForMergeEditor(unsigned cp) const
 
 /**
  * @brief Loads files and does initial rescan
- * @param sLeftFile [in] File to open to left side
- * @param sRightFile [in] File to open to right side
+ * @param filelocLeft [in] File to open to left side (path & encoding info)
+ * @param fileLocRight [in] File to open to right side (path & encoding info)
  * @param bROLeft [in] Is left file read-only
  * @param bRORight [in] Is right file read-only
- * @param cpleft [in] Is left file's 8-bit codepage (eg, 1252) if applicable (0 is unknown or N/A)
- * @param cpright [in] Is right file's 8-bit codepage (eg, 1252) if applicable (0 is unknown or N/A)
  * @return Success/Failure/Binary (failure) per typedef enum OpenDocsResult_TYPE
  * @todo Options are still read from CMainFrame, this will change
  * @sa CMainFrame::ShowMergeDoc()
  */
 OPENRESULTS_TYPE
-CMergeDoc::OpenDocs(CString sLeftFile, CString sRightFile,
-               BOOL bROLeft, BOOL bRORight, int cpleft, int cpright)
+CMergeDoc::OpenDocs(FileLocation filelocLeft, FileLocation filelocRight,
+               BOOL bROLeft, BOOL bRORight)
 {
        BOOL bBinary = FALSE;
        BOOL bIdentical = FALSE;
        int nRescanResult = RESCAN_OK;
 
        // Filter out invalid codepages, or editor will display all blank
-       if (!IsValidCodepageForMergeEditor(cpleft))
-               cpleft = 0;
-       if (!IsValidCodepageForMergeEditor(cpright))
-               cpright = 0;
+       if (filelocLeft.unicoding == ucr::NONE
+               && !IsValidCodepageForMergeEditor(filelocLeft.codepage))
+       {
+               filelocLeft.codepage = 0;
+       }
+       if (filelocRight.unicoding == ucr::NONE
+               && !IsValidCodepageForMergeEditor(filelocRight.codepage))
+       {
+               filelocRight.codepage = 0;
+       }
 
        // clear undo stack
        undoTgt.clear();
@@ -2552,8 +2556,11 @@ CMergeDoc::OpenDocs(CString sLeftFile, CString sRightFile,
        m_pDetailView[1]->DetachFromBuffer();
 
        // free the buffers
-       m_ptBuf[0]->FreeAll ();
-       m_ptBuf[1]->FreeAll ();
+       m_ptBuf[0]->FreeAll();
+       m_ptBuf[1]->FreeAll();
+
+       CString sLeftFile = filelocLeft.filepath;
+       CString sRightFile = filelocRight.filepath;
 
        // build the text being filtered, "|" separates files as it is forbidden in filenames
        m_strBothFilenames = sLeftFile + _T("|") + sRightFile;
@@ -2575,7 +2582,7 @@ CMergeDoc::OpenDocs(CString sLeftFile, CString sRightFile,
                m_pRescanFileInfo[0]->Update(sLeftFile);
 
                // Load left side file
-               nLeftSuccess = LoadFile(sLeftFile, 0, bROLeft, cpleft);
+               nLeftSuccess = LoadFile(sLeftFile, 0, bROLeft, filelocLeft.codepage);
        }
        else
        {
@@ -2602,7 +2609,7 @@ CMergeDoc::OpenDocs(CString sLeftFile, CString sRightFile,
                m_pSaveFileInfo[1]->Update(sRightFile);
                m_pRescanFileInfo[1]->Update(sRightFile);
                if (nLeftSuccess == FRESULT_OK || nLeftSuccess == FRESULT_BINARY)
-                       nRightSuccess = LoadFile(sRightFile, 1, bRORight, cpright);
+                       nRightSuccess = LoadFile(sRightFile, 1, bRORight, filelocRight.codepage);
        }
        else
        {
index 56466f9..f590aa8 100644 (file)
@@ -213,8 +213,8 @@ public:
        void UpdateHeaderActivity(int pane, BOOL bActivate);
        void RefreshOptions();
        void UpdateResources();
-       OPENRESULTS_TYPE OpenDocs(CString sLeftFile, CString sRightFile,
-               BOOL bROLeft, BOOL bRORight, int cpleft, int cpright);
+       OPENRESULTS_TYPE OpenDocs(FileLocation filelocLeft, FileLocation filelocRight,
+               BOOL bROLeft, BOOL bRORight);
        void CompareBinaries(CString sLeftFile, CString sRightFile, int nLeftSuccess, int nRightSuccess);
        int LoadFile(CString sFileName, int nBuffer, BOOL & readOnly, int codepage);
        void RescanIfNeeded(float timeOutInSecond);