OSDN Git Service

Remove some #ifdef _DEBUG blocks
authorsdottaka <sdottaka@users.sourceforge.net>
Sun, 3 May 2015 14:15:35 +0000 (23:15 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sun, 3 May 2015 14:15:35 +0000 (23:15 +0900)
--HG--
branch : stable

14 files changed:
Src/Diff3.h
Src/DiffTextBuffer.cpp
Src/DiffWrapper.cpp
Src/DirScan.cpp
Src/DirView.cpp
Src/DirView.h
Src/DirViewColHandler.cpp
Src/MergeDocDiffSync.cpp
Src/OpenDoc.cpp
Src/OpenDoc.h
Src/OpenFrm.cpp
Src/OpenFrm.h
Src/OpenView.cpp
Src/OpenView.h

index e80114f..1cf13c6 100644 (file)
@@ -217,12 +217,6 @@ size_t Make3wayDiff(std::vector<Element>& diff3, const std::vector<Element>& dif
 
                diff3.push_back(dr3);
 
-#ifdef _DEBUG
-               Poco::Debugger::message(Poco::format("left=%d,%d middle=%d,%d right=%d,%d",
-                       dr3.begin[0], dr3.end[0], dr3.begin[1], dr3.end[1], dr3.begin[2], dr3.end[2]));
-               Poco::Debugger::message(Poco::format("op=%d\n", (int)dr3.op));
-#endif
-
                diff3i++;
                diff10i = diff10itmp;
                diff12i = diff12itmp;
index 27ac610..5b9da51 100644 (file)
@@ -34,8 +34,6 @@ static char THIS_FILE[] = __FILE__;
 #endif
 
 static bool IsTextFileStylePure(const UniMemFile::txtstats & stats);
-static CString GetLineByteTimeReport(UINT lines, int64_t bytes,
-       const COleDateTime & start);
 static void EscapeControlChars(String &s);
 static CRLFSTYLE GetTextFileStyle(const UniMemFile::txtstats & stats);
 
@@ -57,28 +55,6 @@ static bool IsTextFileStylePure(const UniMemFile::txtstats & stats)
 }
 
 /**
- * @brief Return a string giving #lines and #bytes and how much time elapsed.
- * @param [in] lines Count of lines.
- * @param [in] bytes Count of bytes.
- * @param [in] start Time used.
- * @return Formatted string.
- */
-static CString GetLineByteTimeReport(UINT lines, int64_t bytes,
-       const COleDateTime & start)
-{
-       String sLines = locality::NumToLocaleStr((int)lines);
-       String sBytes = locality::NumToLocaleStr(bytes);
-       COleDateTimeSpan duration = COleDateTime::GetCurrentTime() - start;
-       String sMinutes = locality::NumToLocaleStr((int)duration.GetTotalMinutes());
-       CString str;
-       str.Format(_T("%s lines (%s byte) saved in %sm%02ds")
-               , sLines.c_str(), sBytes.c_str(), sMinutes.c_str()
-               , duration.GetSeconds()
-               );
-       return str;
-}
-
-/**
  * @brief Escape control characters.
  * @param [in,out] s Line of text excluding eol chars.
  *
@@ -387,10 +363,6 @@ int CDiffTextBuffer::LoadFromFile(LPCTSTR pszFileNameInit,
                String eol, preveol;
                String sline;
                bool done = false;
-#ifdef _DEBUG
-               UINT next_line_report = 100; // for trace messages
-               UINT next_line_multiple = 5; // for trace messages
-#endif
                COleDateTime start = COleDateTime::GetCurrentTime(); // for trace messages
 
                // Manually grow line array exponentially
@@ -430,37 +402,8 @@ int CDiffTextBuffer::LoadFromFile(LPCTSTR pszFileNameInit,
                        AppendLine(lineno, sline.c_str(), sline.length());
                        ++lineno;
                        preveol = eol;
-
-#ifdef _DEBUG
-                       // send occasional line counts to trace
-                       // (at 100, 500, 1000, 5000, etc)
-                       if (lineno == next_line_report)
-                       {
-                               int64_t dwBytesRead = pufile->GetPosition();
-                               COleDateTimeSpan duration = COleDateTime::GetCurrentTime() - start;
-                               if (duration.GetTotalMinutes() > 0)
-                               {
-                                       CString strace = GetLineByteTimeReport(lineno, dwBytesRead, start);
-                                       TRACE(_T("%s\n"), (LPCTSTR)strace);
-                               }
-                               next_line_report = next_line_multiple * next_line_report;
-                               next_line_multiple = (next_line_multiple == 5) ? 2 : 5;
-                       }
-#endif // _DEBUG
                } while (!done);
 
-#ifdef _DEBUG
-               // Send report of duration to trace (if it took a while)
-               COleDateTime end = COleDateTime::GetCurrentTime();
-               COleDateTimeSpan duration = end - start;
-               if (duration.GetTotalMinutes() > 0)
-               {
-                       int64_t dwBytesRead = pufile->GetPosition();
-                       CString strace = GetLineByteTimeReport(lineno, dwBytesRead, start);
-                       TRACE(_T("%s\n"), (LPCTSTR)strace);
-               }
-#endif // _DEBUG
-
                // fix array size (due to our manual exponential growth
                m_aLines.resize(lineno);
        
index 067feef..f05c184 100644 (file)
@@ -1285,10 +1285,6 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const
                                }
 
                                AddDiffRange(m_pDiffList, trans_a0-1, trans_b0-1, trans_a1-1, trans_b1-1, op);
-#ifdef _DEBUG
-                               Debugger::message(format("left=%d,%d   right=%d,%d   op=%d\n",
-                                       trans_a0-1, trans_b0-1, trans_a1-1, trans_b1-1, (int)op));
-#endif
                        }
                }
                
@@ -1434,10 +1430,6 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript3(
                                        }
 
                                        AddDiffRange(pdiff, trans_a0-1, trans_b0-1, trans_a1-1, trans_b1-1, op);
-#ifdef _DEBUG
-                                       Debugger::message(format("left=%d,%d   right=%d,%d   op=%d\n",
-                                               trans_a0-1, trans_b0-1, trans_a1-1, trans_b1-1, op));
-#endif
                                }
                        }
                        
index 788b9d4..6f575cd 100644 (file)
@@ -183,15 +183,6 @@ int DirScan_GetItems(const PathContext &paths, const String subdir[],
                        break;
 
                // Comparing directories leftDirs[i].name to rightDirs[j].name
-#ifdef _DEBUG
-TCHAR buf[1024];
-if (nDirs == 2)
-       wsprintf(buf, _T("%s %s\n"), (i < dirs[0].size()) ? dirs[0][i].filename.get().c_str() : _T(""), (j < dirs[1].size()) ? dirs[1][j].filename.get().c_str() : _T(""));
-else
-       wsprintf(buf, _T("%s %s %s\n"), (i < dirs[0].size()) ? dirs[0][i].filename.get().c_str() : _T(""), (j < dirs[1].size()) ?  dirs[1][j].filename.get().c_str() : _T(""), (k < dirs[2].size()) ? dirs[2][k].filename.get().c_str() : _T(""));
-OutputDebugString(buf);
-#endif
-
                if (i<dirs[0].size() && (j==dirs[1].size() || collstr(dirs[0][i].filename, dirs[1][j].filename, casesensitive)<0)
                        && (nDirs < 3 ||      (k==dirs[2].size() || collstr(dirs[0][i].filename, dirs[2][k].filename, casesensitive)<0) ))
                {
@@ -354,18 +345,6 @@ OutputDebugString(buf);
                                                        depth - 1, me, bUniques);
                                        if (result == -1)
                                                return -1;
-/*
-                                       if (result == 0)
-                                       {
-                                               if (!(nDiffCode & DIFFCODE::FIRST) || !(nDiffCode & DIFFCODE::SECOND))
-                                               {
-                                                       AddToList(subdir[0], subdir[1], 
-                                                               nDiffCode & DIFFCODE::FIRST  ? &dirs[0][i] : NULL, 
-                                                               nDiffCode & DIFFCODE::SECOND ? &dirs[1][j] : NULL,
-                                                               nDiffCode, myStruct, parent);
-                                               }
-                                       }
-*/
                                }
                        }
                        else
@@ -400,19 +379,6 @@ OutputDebugString(buf);
                                                        depth - 1, me, bUniques);
                                        if (result == -1)
                                                return -1;
-/*
-                                       if (result == 0)
-                                       {
-                                               if (!(nDiffCode & DIFFCODE::FIRST) || !(nDiffCode & DIFFCODE::SECOND) || !(nDiffCode & DIFFCODE::THIRD))
-                                               {
-                                                       AddToList(subdir[0], subdir[1], subdir[2], 
-                                                               nDiffCode & DIFFCODE::FIRST  ? &dirs[0][i] : NULL,
-                                                               nDiffCode & DIFFCODE::SECOND ? &dirs[1][j] : NULL,
-                                                               nDiffCode & DIFFCODE::THIRD  ? &dirs[2][k] : NULL,
-                                                               nDiffCode, myStruct, parent);
-                                               }
-                                       }
-*/
                                }
                        }
                }
@@ -434,15 +400,6 @@ OutputDebugString(buf);
 
 
                // Comparing file files[0][i].name to files[1][j].name
-#ifdef _DEBUG
-TCHAR buf[1024];
-if (nDirs == 2)
-       wsprintf(buf, _T("%s %s\n"), (i < files[0].size()) ? files[0][i].filename.get().c_str() : _T(""), (j < files[1].size()) ? files[1][j].filename.get().c_str() : _T(""));
-else
-       wsprintf(buf, _T("%s %s %s\n"), (i < files[0].size()) ? files[0][i].filename.get().c_str() : _T(""), (j < files[1].size()) ?  files[1][j].filename.get().c_str() : _T(""), 
-(k < files[2].size()) ? files[2][k].filename.get().c_str() : _T(""));
-OutputDebugString(buf);
-#endif
                if (i<files[0].size() && (j==files[1].size() ||
                                collstr(files[0][i].filename, files[1][j].filename, casesensitive) < 0)
                        && (nDirs < 3 || 
index b172128..0b1882c 100644 (file)
@@ -1061,7 +1061,6 @@ void CDirView::OnDestroy()
 {
        DeleteAllDisplayItems();
 
-       ValidateColumnOrdering();
        SaveColumnOrders();
        SaveColumnWidths();
 
index a8c72cb..e34fe8c 100644 (file)
@@ -212,7 +212,6 @@ private:
        String GetColDescription(int col) const;
        int GetColLogCount() const;
        void LoadColumnOrders();
-       void ValidateColumnOrdering();
        void ClearColumnOrders();
        void ResetColumnOrdering();
        void MoveColumn(int psrc, int pdest);
index 07bf312..8986613 100644 (file)
@@ -363,37 +363,6 @@ void CDirView::LoadColumnOrders()
        {
                ResetColumnOrdering();
        }
-
-       ValidateColumnOrdering();
-}
-
-/**
- * @brief Sanity check column ordering
- */
-void CDirView::ValidateColumnOrdering()
-{
-
-#if _DEBUG
-       ASSERT(m_invcolorder[0]>=0);
-       ASSERT(m_numcols == GetColLogCount());
-       // Check that any logical->physical mapping is reversible
-       for (int i=0; i<m_numcols; ++i)
-       {
-               int phy = m_colorder[i];
-               if (phy >= 0)
-               {
-                       int log = m_invcolorder[phy];
-                       ASSERT(i == log);
-               }
-       }
-       // Bail out if header doesn't exist yet
-       int hdrcnt = GetListCtrl().GetHeaderCtrl()->GetItemCount();
-       if (hdrcnt)
-       {
-               ASSERT(hdrcnt == m_dispcols);
-       }
-       return;
-#endif
 }
 
 /**
@@ -413,7 +382,6 @@ void CDirView::ResetColumnOrdering()
                        ++m_dispcols;
                }
        }
-       ValidateColumnOrdering();
 }
 
 /**
@@ -479,9 +447,7 @@ void CDirView::MoveColumn(int psrc, int pdest)
                if (m_colorder[i] >= 0)
                        m_invcolorder[m_colorder[i]] = i;
        }
-       ValidateColumnOrdering();
        InitiateSort();
-       ValidateColumnOrdering();
 }
 
 /**
@@ -555,5 +521,4 @@ void CDirView::OnEditColumns()
                ReloadColumns();
                Redisplay();
        }
-       ValidateColumnOrdering();
 }
index ddd10f9..f86810b 100644 (file)
@@ -48,20 +48,6 @@ void CMergeDoc::AdjustDiffBlocks()
                        diffmap.InitDiffMap(nlines0);
                        AdjustDiffBlock(diffmap, diffrange, lo0, hi0, lo1, hi1);
 
-#ifdef _DEBUG
-                       std::vector<int>::const_iterator iter = diffmap.m_map.begin();
-                       int i = 0;
-                       while (iter != diffmap.m_map.end())
-                       {
-                               TCHAR buf[256];
-                               wsprintf(buf, _T("begin[0]=%d begin[1]=%d diffmap[%d]=%d\n"), 
-                                               diffrange.begin[0], diffrange.begin[1], i, diffmap.m_map[i]);
-                               OutputDebugString(buf);
-                               iter++;
-                               i++;
-                       }
-#endif
-
                        // divide diff blocks
                        DIFFRANGE dr;
                        int line0, line1, lineend0;
@@ -137,16 +123,7 @@ void CMergeDoc::AdjustDiffBlocks()
        m_diffList.Clear();
        nDiffCount = newDiffList.GetSize();
        for (nDiff = 0; nDiff < nDiffCount; nDiff++)
-       {
-#ifdef _DEBUG
-               TCHAR buf[256];
-               DIFFRANGE di = *newDiffList.DiffRangeAt(nDiff);
-               wsprintf(buf, _T("%d: begin[0]=%d end[0]=%d begin[1]=%d end[1]=%d\n"), nDiff,
-                               di.begin[0], di.end[0], di.begin[1], di.end[1]);
-               OutputDebugString(buf);
-#endif
                m_diffList.AddDiff(*newDiffList.DiffRangeAt(nDiff));
-       }
 }
 
 /**
index c46628a..6712621 100644 (file)
@@ -28,19 +28,3 @@ COpenDoc::~COpenDoc()
 
 BEGIN_MESSAGE_MAP(COpenDoc, CDocument)
 END_MESSAGE_MAP()
-
-
-// COpenDoc diagnostics
-
-#ifdef _DEBUG
-void COpenDoc::AssertValid() const
-{
-       CDocument::AssertValid();
-}
-
-void COpenDoc::Dump(CDumpContext& dc) const
-{
-       CDocument::Dump(dc);
-}
-#endif //_DEBUG
-
index 3c42a5b..8862366 100644 (file)
@@ -14,10 +14,6 @@ class COpenDoc : public CDocument
 public:
        COpenDoc();
        virtual ~COpenDoc();
-#ifdef _DEBUG
-       virtual void AssertValid() const;
-       virtual void Dump(CDumpContext& dc) const;
-#endif
 
        DWORD   m_dwFlags[3];
        PathContext m_files;
index 0c8c6f1..c12467e 100644 (file)
@@ -178,20 +178,4 @@ BOOL COpenFrame::DestroyWindow()
        return CMDIChildWnd::DestroyWindow();
 }
 
-// COpenFrame diagnostics
-
-#ifdef _DEBUG
-void COpenFrame::AssertValid() const
-{
-       CMDIChildWnd::AssertValid();
-}
-
-void COpenFrame::Dump(CDumpContext& dc) const
-{
-       CMDIChildWnd::Dump(dc);
-}
-
-#endif //_DEBUG
-
-
 // COpenFrame message handlers
index 062249d..21b7189 100644 (file)
@@ -36,10 +36,6 @@ public:
 // Implementation
 public:
        virtual ~COpenFrame();
-#ifdef _DEBUG
-       virtual void AssertValid() const;
-       virtual void Dump(CDumpContext& dc) const;
-#endif
 
 // Generated message map functions
 protected:
index 58f1727..1a57dd1 100644 (file)
@@ -291,16 +291,6 @@ void COpenView::OnInitialUpdate()
 // COpenView diagnostics
 
 #ifdef _DEBUG
-void COpenView::AssertValid() const
-{
-       CFormView::AssertValid();
-}
-
-void COpenView::Dump(CDumpContext& dc) const
-{
-       CFormView::Dump(dc);
-}
-
 COpenDoc* COpenView::GetDocument() const // non-debug version is inline
 {
        ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COpenDoc)));
index 1cd4adc..b2492fb 100644 (file)
@@ -105,10 +105,6 @@ protected:
 // Implementation
 public:
        virtual ~COpenView();
-#ifdef _DEBUG
-       virtual void AssertValid() const;
-       virtual void Dump(CDumpContext& dc) const;
-#endif
 
 protected:
        void SetStatus(UINT msgID);