OSDN Git Service

PATCH: [ 802120 ] Fix for VC.NET
authorPerry Rapp <elsapo@users.sourceforge.net>
Sun, 14 Sep 2003 01:05:47 +0000 (01:05 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Sun, 14 Sep 2003 01:05:47 +0000 (01:05 +0000)
13 files changed:
Src/DiffContext.cpp
Src/DiffContext.h
Src/DirScan.cpp
Src/DirView.cpp
Src/DirView.h
Src/DirViewColItems.cpp
Src/EditorFilepathBar.cpp
Src/MainFrm.cpp
Src/MainFrm.h
Src/MergeEditView.cpp
Src/editlib/ccrystaleditview.cpp
Src/editlib/ccrystaleditview.h
Src/readme.txt

index bc1c26d..3d7e87f 100644 (file)
@@ -101,8 +101,8 @@ static CString GetFixedFileVersion(const CString & path)
  */
 void CDiffContext::AddDiff(LPCTSTR pszFilename, LPCTSTR szSubdir
        , LPCTSTR pszLeftDir, LPCTSTR pszRightDir
-       , long lmtime, long rmtime
-       , long lctime, long rctime
+       , __int64 lmtime, __int64 rmtime
+       , __int64 lctime, __int64 rctime
        , __int64 lsize, __int64 rsize
        , BYTE code
        )
@@ -136,6 +136,7 @@ void CDiffContext::AddDiff(DIFFITEM di)
        }
 
        m_pList->AddTail(di);
+       // ignore return value
        SendMessage(m_hMainFrame, m_msgUpdateStatus, di.code, NULL);
 }
 
@@ -213,7 +214,7 @@ void CDiffContext::UpdateInfoFromDisk(DIFFITEM & di)
 /**
  * @brief Convert a FILETIME to a long (standard time)
  */
-static long FileTimeToLong(FILETIME & ft)
+static __int64 FileTimeToInt64(FILETIME & ft)
 {
        return CTime(ft).GetTime();
 }
@@ -234,7 +235,7 @@ void CDiffContext::UpdateInfoFromDiskHalf(DIFFITEM & di, DiffFileInfo & dfi)
        HANDLE h = FindFirstFile(filepath, &wfd);
        if (h != INVALID_HANDLE_VALUE)
        {
-               dfi.mtime = FileTimeToLong(wfd.ftLastWriteTime);
+               dfi.mtime = FileTimeToInt64(wfd.ftLastWriteTime);
                dfi.flags.reset();
                if (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
                        dfi.flags.flags += FileFlags::RO;
index 0c4fb71..2e21d82 100644 (file)
@@ -48,8 +48,10 @@ struct DIFFITEM;
  */
 struct DiffFileInfo
 {
-       long mtime; /**< time of last modification */
-       long ctime; /**< time of creation */
+       // storing __time_t if MSVC6 (__MSC_VER<1300)
+       // storing __time64_t if MSVC7 (VC.NET)
+       __int64 mtime; /**< time of last modification */
+       __int64 ctime; /**< time of creation */
        __int64 size; /**< file size in bytes */
        CString version; /**< string of fixed file version, eg, 1.2.3.4 */
        CString spath; /**< fully qualified directory of file */
@@ -101,7 +103,7 @@ public:
 
        // add & remove differences
        void AddDiff(LPCTSTR pszFilename, LPCTSTR szSubdir, LPCTSTR pszLeftDir, LPCTSTR pszRightDir
-               , long lmtime, long rmtime, long lctime, long rctime
+               , __int64 lmtime, __int64 rmtime, __int64 lctime, __int64 rctime
                , __int64 lsize, __int64 rsize, BYTE code);
        void AddDiff(DIFFITEM di);
        void RemoveDiff(POSITION diffpos);
index b9cc301..a3ef3e4 100644 (file)
@@ -27,8 +27,10 @@ static char THIS_FILE[] = __FILE__;
 struct fentry
 {
        CString name;
-       long mtime;
-       long ctime;
+       // storing __time_t if MSVC6 (__MSC_VER<1300)
+       // storing __time64_t if MSVC7 (VC.NET)
+       __int64 mtime;
+       __int64 ctime;
        _int64 size;
 };
 typedef CArray<fentry, fentry&> fentryArray;;
@@ -224,7 +226,13 @@ void LoadFiles(const CString & sDir, fentryArray * dirs, fentryArray * files)
                finder.GetCreationTime(ctim);
                ent.mtime = mtim.GetTime();
                ent.ctime = ctim.GetTime();
-               ent.size = finder.GetLength64();
+#if _MSC_VER < 1300
+               // MSVC6
+               ent.size = finder.GetLength64(); // __int64
+#else
+               // MSVC7 (VC.NET)
+               ent.size = finder.GetLength(); // ULONGLONG
+#endif
                ent.name = finder.GetFileName();
                if (finder.IsDirectory())
                        dirs->Add(ent);
@@ -271,7 +279,7 @@ static int collstr(const CString & s1, const CString & s2, bool casesensitive)
 static void FilterAdd(const CString & sDir, const fentry * lent, const fentry * rent, int code, CDiffContext * pCtxt)
 {
        CString name, leftdir, rightdir;
-       long rmtime=0, lmtime=0, rctime=0, lctime=0;
+       _int64 rmtime=0, lmtime=0, rctime=0, lctime=0;
        _int64 lsize=0, rsize=0;
        if (lent)
        {
index eadcaed..00efdf1 100644 (file)
@@ -1199,7 +1199,7 @@ void CDirView::OnUpdateRefresh(CCmdUI* pCmdUI)
  * @brief Called when compare thread asks UI update
  * @note Currently thread asks update after compare is ready
  */
-void CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
+LRESULT CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
 {
        CDirDoc * pDoc = GetDocument();
        ASSERT(pDoc);
@@ -1210,6 +1210,7 @@ void CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
        
        if (mf->m_bScrollToFirst)
                OnFirstdiff();
+       return 0; // return value unused
 }
 
 BOOL CDirView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
index 3770a3f..1b50686 100644 (file)
@@ -246,7 +246,7 @@ protected:
        afx_msg void OnCurdiff();
        afx_msg void OnUpdateCurdiff(CCmdUI* pCmdUI);
        afx_msg void OnUpdateSave(CCmdUI* pCmdUI);
-       afx_msg void OnUpdateUIMessage(WPARAM wParam, LPARAM lParam);
+       afx_msg LRESULT OnUpdateUIMessage(WPARAM wParam, LPARAM lParam);
        afx_msg void OnRefresh();
        afx_msg void OnUpdateRefresh(CCmdUI* pCmdUI);
        afx_msg void OnTimer(UINT nIDEvent);
index 280f290..b2b8ce7 100644 (file)
@@ -28,14 +28,28 @@ static char THIS_FILE[] = __FILE__;
  * @brief Return time displayed appropriately, as string
  */
 static CString
-TimeString(const time_t * tim)
+TimeString(const __int64 * tim)
 {
        if (!tim) return _T("---");
        // _tcsftime does not respect user date customizations from
        // Regional Options/Configuration Regional; COleDateTime::Format does so.
+#if _MSC_VER < 1300
+               // MSVC6
+       COleDateTime odt = (time_t)*tim;
+#else
+               // MSVC7 (VC.NET)
        COleDateTime odt = *tim;
+#endif
        return odt.Format();
 }
+/**
+ * @brief Function to compare two __int64s for a sort
+ */
+static int cmp64(__int64 i1, __int64 i2)
+{
+       if (i1==i2) return 0;
+       return i1>i2 ? 1 : -1;
+}
 
 /**
  * @{ Functions to display each type of column info
@@ -215,19 +229,19 @@ static int ColStatusSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 }
 static int ColLmtimeSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
-       return rdi.left.mtime-ldi.left.mtime;
+       return cmp64(rdi.left.mtime, ldi.left.mtime);
 }
 static int ColRmtimeSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
-       return rdi.right.mtime-ldi.right.mtime;
+       return cmp64(rdi.right.mtime, ldi.right.mtime);
 }
 static int ColLctimeSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
-       return rdi.left.ctime-ldi.left.ctime;
+       return cmp64(rdi.left.ctime, ldi.left.ctime);
 }
 static int ColRctimeSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
-       return rdi.right.ctime-ldi.right.ctime;
+       return cmp64(rdi.right.ctime, ldi.right.ctime);
 }
 static int ColExtSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
@@ -235,11 +249,11 @@ static int ColExtSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 }
 static int ColLsizeSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
-       return rdi.left.size - ldi.left.size;
+       return cmp64(rdi.left.size, ldi.left.size);
 }
 static int ColRsizeSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
-       return rdi.right.size - ldi.right.size;
+       return cmp64(rdi.right.size, ldi.right.size);
 }
 static int ColNewerSort(const DIFFITEM & ldi, const DIFFITEM &rdi)
 {
index a8036e5..b16bfe0 100644 (file)
@@ -123,11 +123,11 @@ BOOL CEditorFilePathBar::OnToolTipNotify(UINT id, NMHDR * pTTTStruct, LRESULT *
                        // compute max width : 97% of application width or 80% or full screen width
                        CRect rect;
                        GetWindowRect(rect);
-                       int maxWidth = rect.Width() * .97;
+                       int maxWidth = (int)(rect.Width() * .97);
                        CRect rectScreen; 
                        SystemParametersInfo(SPI_GETWORKAREA, 0, rectScreen, 0);
                        if (rectScreen.Width() * .8 > maxWidth)
-                               maxWidth = rectScreen.Width() * .8;
+                               maxWidth = (int)(rectScreen.Width() * .8);
 
                        // use the tooltip font
                        HANDLE hFont = (HANDLE) ::SendMessage(pTTTStruct->hwndFrom, WM_GETFONT, 0, 0);
index 29a5434..c3723d9 100644 (file)
@@ -1643,10 +1643,11 @@ void CMainFrame::OnDropFiles(HDROP dropInfo)
        DoFileOpen(files[0], files[1], FFILEOPEN_NONE, FFILEOPEN_NONE, ctrlKey);
 }
 
-void CMainFrame::OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam)
+LRESULT CMainFrame::OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam)
 {
        if (wParam == 0xFF)
                clearStatus();
        else
                rptStatus(wParam);
+       return 0; // return value not meaningful
 }
index c8150b1..cbd2c44 100644 (file)
@@ -183,7 +183,7 @@ protected:
        afx_msg void OnViewWhitespace();
        afx_msg void OnUpdateViewWhitespace(CCmdUI* pCmdUI);
        afx_msg void OnDropFiles(HDROP dropInfo);
-       afx_msg void OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam);
+       afx_msg LRESULT OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam);
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 
index c307e49..b806b38 100644 (file)
@@ -514,7 +514,7 @@ void CMergeEditView::OnEditUndo()
                        return;
 
                GetParentFrame()->SetActiveView(this, TRUE);
-               if(CCrystalEditViewEx::OnEditUndo()) 
+               if(CCrystalEditViewEx::DoEditUndo()) 
                {
                        --pDoc->curUndo;
                        pDoc->FlushAndRescan();
@@ -869,7 +869,7 @@ void CMergeEditView::OnEditRedo()
                        return;
 
                GetParentFrame()->SetActiveView(this, TRUE);
-               if(CCrystalEditViewEx::OnEditRedo()) 
+               if(CCrystalEditViewEx::DoEditRedo()) 
                {
                        ++pDoc->curUndo;
                        pDoc->FlushAndRescan();
index facf4b3..a2b23c5 100644 (file)
@@ -1441,9 +1441,15 @@ OnUpdateEditUndo (CCmdUI * pCmdUI)
     }
 }
 
-BOOL CCrystalEditView::
+void CCrystalEditView::
 OnEditUndo ()
 {
+       DoEditUndo();
+}
+
+BOOL CCrystalEditView::
+DoEditUndo ()
+{
   if (m_pTextBuffer != NULL && m_pTextBuffer->CanUndo ())
     {
       CPoint ptCursorPos;
@@ -1467,9 +1473,15 @@ SetDisableBSAtSOL (BOOL bDisableBSAtSOL)
   m_bDisableBSAtSOL = bDisableBSAtSOL;
 }
 
-BOOL CCrystalEditView::
+void CCrystalEditView::
 OnEditRedo ()
 {
+       DoEditRedo();
+}
+
+BOOL CCrystalEditView::
+DoEditRedo ()
+{
   if (m_pTextBuffer != NULL && m_pTextBuffer->CanRedo ())
     {
       CPoint ptCursorPos;
index 08dec81..5d031b3 100644 (file)
@@ -153,9 +153,9 @@ protected :
     afx_msg void OnDestroy ();
     afx_msg void OnEditReplace ();
     afx_msg void OnUpdateEditUndo (CCmdUI * pCmdUI);
-    afx_msg BOOL OnEditUndo ();
+    afx_msg void OnEditUndo ();
     afx_msg void OnUpdateEditRedo (CCmdUI * pCmdUI);
-    afx_msg BOOL OnEditRedo ();
+    afx_msg void OnEditRedo ();
     afx_msg void OnUpdateEditAutoComplete (CCmdUI * pCmdUI);
     afx_msg void OnEditAutoComplete ();
     afx_msg void OnUpdateEditAutoExpand (CCmdUI * pCmdUI);
@@ -212,6 +212,8 @@ protected :
     afx_msg void OnExtTextEnd();
     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+    BOOL DoEditUndo();
+    BOOL DoEditRedo();
     DECLARE_MESSAGE_MAP ()
   };
 
index f9875cc..abac65f 100644 (file)
@@ -2,6 +2,11 @@
  Widen label IDC_PRIVATEBUILD on about box.
   WinMerge: Merge.rc
   Languages: *.rc
+ PATCH: [ 802120 ] Fix for VC.NET
+  WinMerge: DiffContext.cpp DiffContext.h DirScan.cpp DirView.cpp
+   DirView.h DirViewColItems.cpp EditorFilepathBar.cpp MainFrm.cpp 
+   MainFrm.h MergeEditView.cpp
+  editlib: ccrystaleditview.cpp ccrystaleditview.h
 
 2003-09-13 WinMerge experimental release 2.1.1.5 (patch demos)
 2003-09-13 WinMerge experimental release 2.1.1.4 (cvs)