Revision: 5917
http://winmerge.svn.sourceforge.net/winmerge/?rev=5917&view=rev
Author: marcelgosselin
Date: 2008-09-07 12:59:22 +0000 (Sun, 07 Sep 2008)
Log Message:
-----------
Use bool instead of BOOL for all UniFile code
Modified Paths:
--------------
trunk/Src/Common/UniFile.cpp
trunk/Src/Common/UniFile.h
trunk/Src/Common/multiformatText.cpp
trunk/Src/ConflictFileParser.cpp
trunk/Src/DiffTextBuffer.cpp
trunk/Src/FileFilterMgr.cpp
trunk/Src/UniMarkdownFile.cpp
trunk/Src/UniMarkdownFile.h
Modified: trunk/Src/Common/UniFile.cpp
===================================================================
--- trunk/Src/Common/UniFile.cpp 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/Common/UniFile.cpp 2008-09-07 12:59:22 UTC (rev 5917)
@@ -405,11 +405,10 @@
* @param [out] lossy TRUE if there were lossy encoding.
* @return TRUE if there is more lines to read, TRUE when last line is read.
*/
-BOOL UniMemFile::ReadString(String & line, bool * lossy)
+bool UniMemFile::ReadString(String & line, bool * lossy)
{
String eol;
- BOOL ok = ReadString(line, eol, lossy);
- return ok;
+ return ReadString(line, eol, lossy);
}
/**
@@ -459,7 +458,7 @@
* @param [out] lossy TRUE if there were lossy encoding.
* @return TRUE if there is more lines to read, TRUE when last line is read.
*/
-BOOL UniMemFile::ReadString(String & line, String & eol, bool * lossy)
+bool UniMemFile::ReadString(String & line, String & eol, bool * lossy)
{
line.erase();
eol.erase();
@@ -473,7 +472,7 @@
int cchLine = 0;
// If there aren't any wchars left in the file, return FALSE to indicate EOF
if (m_current - m_base + 1 >= m_filesize)
- return FALSE;
+ return false;
// Loop through wchars, watching for eol chars or zero
while (m_current - m_base + 1 < m_filesize)
{
@@ -502,7 +501,7 @@
}
++m_lineno;
line.assign(pchLine, cchLine);
- return TRUE;
+ return true;
}
if (!wch)
{
@@ -511,7 +510,7 @@
++cchLine;
}
line.assign(pchLine, cchLine);
- return TRUE;
+ return true;
}
#else
if (m_unicoding == ucr::NONE && EqualCodepages(m_codepage, getDefaultCodepage()))
@@ -519,7 +518,7 @@
int cchLine = 0;
// If there aren't any bytes left in the file, return FALSE to indicate EOF
if (m_current - m_base >= m_filesize)
- return FALSE;
+ return false;
// Loop through chars, watching for eol chars or zero
while (m_current - m_base < m_filesize)
{
@@ -548,7 +547,7 @@
}
++m_lineno;
line.assign(pchLine, cchLine);
- return TRUE;
+ return true;
}
if (!ch)
{
@@ -557,12 +556,12 @@
++cchLine;
}
line.assign(pchLine, cchLine);
- return TRUE;
+ return true;
}
#endif
if (m_current - m_base + (m_charsize-1) >= m_filesize)
- return FALSE;
+ return false;
// Handle 8-bit strings in line chunks because of multibyte codings (eg, 936)
if (m_unicoding == ucr::NONE)
@@ -705,20 +704,20 @@
{
if (!eol.empty())
++m_lineno;
- return TRUE;
+ return true;
}
Append(line, sch.c_str(), sch.length());
}
- return TRUE;
+ return true;
}
/**
* @brief Write one line (doing any needed conversions)
*/
-BOOL UniMemFile::WriteString(const String & line)
+bool UniMemFile::WriteString(const String & line)
{
ASSERT(0); // unimplemented -- currently cannot write to a UniMemFile!
- return FALSE;
+ return false;
}
/////////////
@@ -913,16 +912,16 @@
}
-BOOL UniStdioFile::ReadString(String & line, bool * lossy)
+bool UniStdioFile::ReadString(String & line, bool * lossy)
{
ASSERT(0); // unimplemented -- currently cannot read from a UniStdioFile!
- return FALSE;
+ return false;
}
-BOOL UniStdioFile::ReadString(String & line, String & eol, bool * lossy)
+bool UniStdioFile::ReadString(String & line, String & eol, bool * lossy)
{
ASSERT(0); // unimplemented -- currently cannot read from a UniStdioFile!
- return FALSE;
+ return false;
}
/** @brief Write BOM (byte order mark) if Unicode file */
@@ -959,7 +958,7 @@
/**
* @brief Write one line (doing any needed conversions)
*/
-BOOL UniStdioFile::WriteString(const String & line)
+bool UniStdioFile::WriteString(const String & line)
{
// shortcut the easy cases
#ifdef _UNICODE
@@ -971,8 +970,8 @@
unsigned int bytes = line.length() * sizeof(TCHAR);
unsigned int wbytes = fwrite(line.c_str(), 1, bytes, m_fp);
if (wbytes != bytes)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
ucr::buffer * buff = (ucr::buffer *)m_pucrbuff;
@@ -985,8 +984,8 @@
// TODO: What to do about lossy conversion ?
unsigned int wbytes = fwrite(buff->ptr, 1, buff->size, m_fp);
if (wbytes != buff->size)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
__int64 UniStdioFile::GetPosition() const
Modified: trunk/Src/Common/UniFile.h
===================================================================
--- trunk/Src/Common/UniFile.h 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/Common/UniFile.h 2008-09-07 12:59:22 UTC (rev 5917)
@@ -55,11 +55,11 @@
virtual void SetCodepage(int codepage) = 0;
public:
- virtual BOOL ReadString(String & line, bool * lossy) = 0;
- virtual BOOL ReadString(String & line, String & eol, bool * lossy) = 0;
+ virtual bool ReadString(String & line, bool * lossy) = 0;
+ virtual bool ReadString(String & line, String & eol, bool * lossy) = 0;
virtual int GetLineNumber() const = 0;
virtual __int64 GetPosition() const = 0;
- virtual BOOL WriteString(const String & line) = 0;
+ virtual bool WriteString(const String & line) = 0;
struct txtstats
{
@@ -144,10 +144,10 @@
virtual void SetBom(bool bom);
public:
- virtual BOOL ReadString(String & line, bool * lossy);
- virtual BOOL ReadString(String & line, String & eol, bool * lossy);
+ virtual bool ReadString(String & line, bool * lossy);
+ virtual bool ReadString(String & line, String & eol, bool * lossy);
virtual __int64 GetPosition() const { return m_current - m_base; }
- virtual BOOL WriteString(const String & line);
+ virtual bool WriteString(const String & line);
// Implementation methods
protected:
@@ -188,14 +188,14 @@
virtual void SetBom(bool bom);
protected:
- virtual BOOL ReadString(String & line, bool * lossy);
- virtual BOOL ReadString(String & line, String & eol, bool * lossy);
+ virtual bool ReadString(String & line, bool * lossy);
+ virtual bool ReadString(String & line, String & eol, bool * lossy);
public:
virtual __int64 GetPosition() const;
virtual int WriteBom();
- virtual BOOL WriteString(const String & line);
+ virtual bool WriteString(const String & line);
// Implementation methods
protected:
Modified: trunk/Src/Common/multiformatText.cpp
===================================================================
--- trunk/Src/Common/multiformatText.cpp 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/Common/multiformatText.cpp 2008-09-07 12:59:22 UTC (rev 5917)
@@ -79,7 +79,7 @@
}
void storageForPlugins::SetDataFileUnknown(LPCTSTR filename, BOOL bOverwrite /*= FALSE*/)
{
- BOOL bIsUnicode = FALSE;
+ bool bIsUnicode = false;
UniMemFile ufile;
if (ufile.OpenReadOnly(filename))
{
Modified: trunk/Src/ConflictFileParser.cpp
===================================================================
--- trunk/Src/ConflictFileParser.cpp 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/ConflictFileParser.cpp 2008-09-07 12:59:22 UTC (rev 5917)
@@ -51,14 +51,14 @@
bool IsConflictFile(LPCTSTR conflictFileName)
{
UniMemFile conflictFile;
- BOOL startFound = FALSE;
+ bool startFound = false;
// open input file
- BOOL success = conflictFile.OpenReadOnly(conflictFileName);
+ bool success = conflictFile.OpenReadOnly(conflictFileName);
// Search for a conflict marker
- BOOL linesToRead = TRUE;
- while (linesToRead && startFound == FALSE)
+ bool linesToRead = true;
+ while (linesToRead && !startFound)
{
String line;
bool lossy;
@@ -68,13 +68,11 @@
std::string::size_type pos;
pos = line.find(MineBegin);
if (pos == 0)
- startFound = TRUE;
+ startFound = true;
}
conflictFile.Close();
- if (startFound)
- return TRUE;
- return FALSE;
+ return startFound;
}
/**
@@ -106,14 +104,14 @@
bNestedConflicts = false;
// open input file
- BOOL success = conflictFile.OpenReadOnly(conflictFileName);
+ bool success = conflictFile.OpenReadOnly(conflictFileName);
// Create output files
- BOOL success2 = workingCopy.Open(workingCopyFileName, _T("wb"));
- BOOL success3 = newRevision.Open(newRevisionFileName, _T("wb"));
+ bool success2 = workingCopy.Open(workingCopyFileName, _T("wb"));
+ bool success3 = newRevision.Open(newRevisionFileName, _T("wb"));
state = 0;
- BOOL linesToRead = TRUE;
+ bool linesToRead = true;
do
{
bool lossy;
Modified: trunk/Src/DiffTextBuffer.cpp
===================================================================
--- trunk/Src/DiffTextBuffer.cpp 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/DiffTextBuffer.cpp 2008-09-07 12:59:22 UTC (rev 5917)
@@ -7,7 +7,7 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "stdafx.h"
+#include "StdAfx.h"
#include "UniFile.h"
#include "files.h"
#include "cs2cs.h"
Modified: trunk/Src/FileFilterMgr.cpp
===================================================================
--- trunk/Src/FileFilterMgr.cpp 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/FileFilterMgr.cpp 2008-09-07 12:59:22 UTC (rev 5917)
@@ -261,7 +261,7 @@
CString sLine;
bool lossy = false;
- BOOL bLinesLeft = TRUE;
+ bool bLinesLeft = true;
do
{
// Returns false when last line is read
@@ -309,7 +309,7 @@
CString str = sLine.Mid(2);
AddFilterPattern(&pfilter->dirfilters, str);
}
- } while (bLinesLeft == TRUE);
+ } while (bLinesLeft);
return pfilter;
}
Modified: trunk/Src/UniMarkdownFile.cpp
===================================================================
--- trunk/Src/UniMarkdownFile.cpp 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/UniMarkdownFile.cpp 2008-09-07 12:59:22 UTC (rev 5917)
@@ -6,7 +6,7 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "stdafx.h"
+#include "StdAfx.h"
#include "UnicodeString.h"
#include "UniMarkdownFile.h"
#include "markdown.h"
@@ -133,7 +133,7 @@
}
}
-BOOL UniMarkdownFile::ReadString(String &line, String &eol, bool *lossy)
+bool UniMarkdownFile::ReadString(String &line, String &eol, bool *lossy)
{
line.erase();
eol.erase();
Modified: trunk/Src/UniMarkdownFile.h
===================================================================
--- trunk/Src/UniMarkdownFile.h 2008-09-07 12:28:40 UTC (rev 5916)
+++ trunk/Src/UniMarkdownFile.h 2008-09-07 12:59:22 UTC (rev 5917)
@@ -6,7 +6,7 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "Common/UniFile.h"
+#include "UniFile.h"
class CMarkdown;
@@ -17,7 +17,7 @@
{
public:
UniMarkdownFile();
- virtual BOOL ReadString(String & line, String & eol, bool * lossy);
+ virtual bool ReadString(String & line, String & eol, bool * lossy);
virtual void Close();
virtual bool ReadBom();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|