Revision: 5920
http://winmerge.svn.sourceforge.net/winmerge/?rev=5920&view=rev
Author: marcelgosselin
Date: 2008-09-07 16:15:10 +0000 (Sun, 07 Sep 2008)
Log Message:
-----------
Use bool instead of BOOL for DIFFOPTIONS
Modified Paths:
--------------
trunk/Src/CompareOptions.cpp
trunk/Src/CompareOptions.h
trunk/Src/ConfigLog.cpp
trunk/Src/ConfigLog.h
trunk/Src/MainFrm.cpp
trunk/Src/PatchTool.cpp
Modified: trunk/Src/CompareOptions.cpp
===================================================================
--- trunk/Src/CompareOptions.cpp 2008-09-07 16:06:38 UTC (rev 5919)
+++ trunk/Src/CompareOptions.cpp 2008-09-07 16:15:10 UTC (rev 5920)
@@ -56,9 +56,9 @@
_RPTF0(_CRT_ERROR, "Unknown whitespace ignore value!");
break;
}
- m_bIgnoreBlankLines = !!options.bIgnoreBlankLines;
- m_bIgnoreCase = !!options.bIgnoreCase;
- m_bIgnoreEOLDifference = !!options.bIgnoreEol;
+ m_bIgnoreBlankLines = options.bIgnoreBlankLines;
+ m_bIgnoreCase = options.bIgnoreCase;
+ m_bIgnoreEOLDifference = options.bIgnoreEol;
}
/**
@@ -76,7 +76,7 @@
DiffutilsOptions::DiffutilsOptions()
: m_outputStyle(DIFF_OUTPUT_NORMAL)
, m_contextLines(0)
-, m_filterCommentsLines(0)
+, m_filterCommentsLines(false)
{
}
@@ -88,7 +88,7 @@
: CompareOptions(options)
, m_outputStyle(DIFF_OUTPUT_NORMAL)
, m_contextLines(0)
-, m_filterCommentsLines(0)
+, m_filterCommentsLines(false)
{
}
Modified: trunk/Src/CompareOptions.h
===================================================================
--- trunk/Src/CompareOptions.h 2008-09-07 16:06:38 UTC (rev 5919)
+++ trunk/Src/CompareOptions.h 2008-09-07 16:15:10 UTC (rev 5920)
@@ -69,10 +69,10 @@
struct DIFFOPTIONS
{
int nIgnoreWhitespace; /**< Ignore whitespace -option. */
- BOOL bIgnoreCase; /**< Ignore case -option. */
- BOOL bIgnoreBlankLines; /**< Ignore blank lines -option. */
- BOOL bIgnoreEol; /**< Ignore EOL differences -option. */
- BOOL bFilterCommentsLines; /**< Ignore Multiline comments differences -option. */
+ bool bIgnoreCase; /**< Ignore case -option. */
+ bool bIgnoreBlankLines; /**< Ignore blank lines -option. */
+ bool bIgnoreEol; /**< Ignore EOL differences -option. */
+ bool bFilterCommentsLines; /**< Ignore Multiline comments differences -option. */
};
/**
@@ -110,7 +110,7 @@
enum DiffOutputType m_outputStyle; /**< Output style (for patch files) */
int m_contextLines; /**< Number of context lines (for patch files) */
- int m_filterCommentsLines;/**< Ignore Multiline comments differences.*/
+ bool m_filterCommentsLines;/**< Ignore Multiline comments differences.*/
};
/**
Modified: trunk/Src/ConfigLog.cpp
===================================================================
--- trunk/Src/ConfigLog.cpp 2008-09-07 16:06:38 UTC (rev 5919)
+++ trunk/Src/ConfigLog.cpp 2008-09-07 16:15:10 UTC (rev 5920)
@@ -22,7 +22,7 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "stdafx.h"
+#include "StdAfx.h"
#ifndef UNICODE
#include <mbctype.h>
#endif
@@ -35,12 +35,13 @@
#include "paths.h"
#include "unicoder.h"
#include "codepage.h"
-#include "7zcommon.h"
+#include "7zCommon.h"
#include "CompareOptions.h"
#include "Environment.h"
// Static function declarations
static bool LoadYesNoFromConfig(CfgSettings * cfgSettings, LPCTSTR name, BOOL * pbflag);
+static bool LoadYesNoFromConfig(CfgSettings * cfgSettings, LPCTSTR name, bool * pbflag);
@@ -175,6 +176,23 @@
}
/**
+ * @brief Write boolean item using keywords (Yes|No)
+ */
+void CConfigLog::WriteItemYesNo(int indent, LPCTSTR key, bool *pvalue)
+{
+ if (m_writing)
+ {
+ CString text;
+ text.Format(_T("%*.0s%s: %s\n"), indent, key, key, *pvalue ? _T("Yes") : _T("No"));
+ m_file.WriteString(text);
+ }
+ else
+ {
+ LoadYesNoFromConfig(m_pCfgSettings, key, pvalue);
+ }
+}
+
+/**
* @brief Same as WriteItemYesNo, except store Yes/No in reverse
*/
void CConfigLog::WriteItemYesNoInverted(int indent, LPCTSTR key, BOOL *pvalue)
@@ -838,8 +856,29 @@
return false;
}
+/**
+ * @brief Lookup named setting in cfgSettings, and if found, set pbflag accordingly
+ */
+static bool
+LoadYesNoFromConfig(CfgSettings * cfgSettings, LPCTSTR name, bool * pbflag)
+{
+ CString value;
+ if (cfgSettings->Lookup(name, value))
+ {
+ if (value == _T("Yes"))
+ {
+ *pbflag = true;
+ return true;
+ }
+ else if (value == _T("No"))
+ {
+ *pbflag = false;
+ return true;
+ }
+ }
+ return false;
+}
-
BOOL
CConfigLog::WriteLogFile(CString &sError)
{
Modified: trunk/Src/ConfigLog.h
===================================================================
--- trunk/Src/ConfigLog.h 2008-09-07 16:06:38 UTC (rev 5919)
+++ trunk/Src/ConfigLog.h 2008-09-07 16:15:10 UTC (rev 5920)
@@ -119,6 +119,7 @@
void FileWriteString(LPCTSTR lpsz);
void CloseFile();
void WriteItemYesNo(int indent, LPCTSTR key, BOOL *pvalue);
+ void WriteItemYesNo(int indent, LPCTSTR key, bool *pvalue);
void WriteItemYesNoInverted(int indent, LPCTSTR key, BOOL *pvalue);
void WriteItemWhitespace(int indent, LPCTSTR key, int *pvalue);
bool ParseSettings(const CString & Filepath);
Modified: trunk/Src/MainFrm.cpp
===================================================================
--- trunk/Src/MainFrm.cpp 2008-09-07 16:06:38 UTC (rev 5919)
+++ trunk/Src/MainFrm.cpp 2008-09-07 16:15:10 UTC (rev 5920)
@@ -26,7 +26,7 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "stdafx.h"
+#include "StdAfx.h"
#include <vector>
#include <htmlhelp.h> // From HTMLHelp Workshop (incl. in Platform SDK)
#include <shlwapi.h>
@@ -51,7 +51,7 @@
#include "coretools.h"
#include "Splash.h"
#include "LineFiltersDlg.h"
-#include "logfile.h"
+#include "LogFile.h"
#include "paths.h"
#include "WaitStatusCursor.h"
#include "PatchTool.h"
@@ -2370,6 +2370,25 @@
}
/**
+ * @brief Copy one piece of data from options object to config log, or vice-versa
+ */
+static void
+LoadConfigBoolSetting(bool * cfgval, COptionsMgr * options, const CString & name, ConfigLogDirection cfgdir)
+{
+ if (options == NULL)
+ return;
+
+ if (cfgdir == ToConfigLog)
+ {
+ *cfgval = options->GetBool(name);
+ }
+ else
+ {
+ options->SetBool(name, !!(*cfgval));
+ }
+}
+
+/**
* @brief Pass options settings from options manager object to config log, or vice-versa
*/
static void LoadConfigLog(CConfigLog & configLog, COptionsMgr * options,
Modified: trunk/Src/PatchTool.cpp
===================================================================
--- trunk/Src/PatchTool.cpp 2008-09-07 16:06:38 UTC (rev 5919)
+++ trunk/Src/PatchTool.cpp 2008-09-07 16:15:10 UTC (rev 5920)
@@ -209,9 +209,9 @@
// Use this because non-sensitive setting can't write
// patch file EOLs correctly
- diffOptions.bIgnoreEol = FALSE;
+ diffOptions.bIgnoreEol = false;
- diffOptions.bIgnoreCase = !m_pDlgPatch->m_caseSensitive;
+ diffOptions.bIgnoreCase = m_pDlgPatch->m_caseSensitive == FALSE;
m_diffWrapper.SetOptions(&diffOptions);
}
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|