Release Notes update (#2007673)
BugFix: Possible crash when enabling line filter (#2004160)
BugFix: Location Pane flickers when scrolling (#1938177, #2005031)
+ BugFix: Use system codepage for paths (#1979429, #2008581)
Translation updates:
- Chinese Traditional (#2007426)
--- /dev/null
+/**
+ * @file AnsiConvert.cpp
+ *
+ * @brief Implementation file for Unicode to ANSI conversion routines.
+ *
+ */
+// ID line follows -- this is updated by SVN
+// $Id$
+
+#include "stdafx.h"
+
+/**
+ * @brief Convert from Unicode to Ansi using system codepage.
+ * This function converts Unicode string to ansi string using system codepage.
+ * This conversion function should be used when converting strings containing
+ * paths. As paths are handled by the system and are not file content.
+ * @param [in] str String to convert.
+ * @return Ansi string.
+ */
+LPCSTR ansiconvert_SystemCP(LPCTSTR str)
+{
+ // These lines replace USES_CONVERSION macro
+ int _convert = 0;
+ UINT _acp = GetACP();
+ LPCWSTR _lpw = 0;
+ LPCSTR _lpa = 0;
+
+ return T2CA(str);
+}
+
+/**
+ * @brief Convert from Unicode to Ansi using thread codepage.
+ * This function converts Unicode string to ansi string using thread codepage.
+ * Thread codepage is practically the codepage WinMerge is using internally.
+ * @param [in] str String to convert.
+ * @return Ansi string.
+ */
+LPCSTR ansiconvert_ThreadCP(LPCTSTR str)
+{
+ USES_CONVERSION;
+ return T2CA(str);
+}
+
+
--- /dev/null
+/**
+ * @file AnsiConvert.h
+ *
+ * @brief Declaration file for routines to convert from Unicode to ANSI.
+ *
+ */
+// ID line follows -- this is updated by SVN
+// $Id$
+
+#ifndef _ANSI_CONVERST_H_
+#define _ANSI_CONVERT_H_
+
+LPCSTR ansiconvert_SystemCP(LPCTSTR str);
+LPCSTR ansiconvert_ThreadCP(LPCTSTR str);
+
+#endif // _ANSI_CONVERT_H_
#include "common/unicoder.h"
#include "codepage_detect.h"
#include <shlwapi.h>
+#include "AnsiConvert.h"
#include "DiffFileData.h"
for (int i=0; i<2; ++i)
{
// Fill in 8-bit versions of names for diffutils (WinMerge doesn't use these)
- USES_CONVERSION;
// Actual paths are m_FileLocation[i].filepath
// but these are often temporary files
// Displayable (original) paths are m_sDisplayFilepath[i]
- m_inf[i].name = strdup(T2CA(m_sDisplayFilepath[i]));
+ m_inf[i].name = strdup(ansiconvert_SystemCP(m_sDisplayFilepath[i]));
if (m_inf[i].name == NULL)
return false;
#include "FolderCmp.h"
#include "FilterCommentsManager.h"
#include "Environment.h"
+#include "AnsiConvert.h"
#ifdef _DEBUG
#define new DEBUG_NEW
replace_char(&*filepath2.begin(), '/', '\\');
BOOL bRet = TRUE;
- USES_CONVERSION;
String strFile1Temp = filepath1;
String strFile2Temp = filepath2;
m_options.SetToDiffUtils();
- //SwapToInternalSettings();
if (m_bUseDiffList)
m_nDiffs = m_pDiffList->GetSize();
*/
void CDiffWrapper::WritePatchFile(struct change * script, file_data * inf)
{
- USES_CONVERSION;
file_data inf_patch[2] = {0};
CopyMemory(&inf_patch, inf, sizeof(file_data) * 2);
path2 = m_s2File;
replace_char(&*path1.begin(), '\\', '/');
replace_char(&*path2.begin(), '\\', '/');
- inf_patch[0].name = strdup(T2CA(path1.c_str()));
- inf_patch[1].name = strdup(T2CA(path2.c_str()));
+ inf_patch[0].name = strdup(ansiconvert_SystemCP(path1.c_str()));
+ inf_patch[1].name = strdup(ansiconvert_SystemCP(path2.c_str()));
outfile = NULL;
if (!m_sPatchFile.IsEmpty())
#include "coretools.h"
#include "WaitStatusCursor.h"
#include "paths.h"
+#include "AnsiConvert.h"
#include <afxadv.h>
UINT CF_HTML = RegisterClipboardFormat(_T("HTML Format"));
*/
void DirCmpReport::WriteString(LPCTSTR pszText)
{
- USES_CONVERSION;
- LPCSTR pchOctets = T2A((LPTSTR)pszText);
+ LPCSTR pchOctets = ansiconvert_ThreadCP((LPTSTR)pszText);
size_t cchAhead = strlen(pchOctets);
while (LPCSTR pchAhead = (LPCSTR)memchr(pchOctets, '\n', cchAhead))
{
</FileConfiguration>
</File>
<File
+ RelativePath=".\AnsiConvert.cpp">
+ <FileConfiguration
+ Name="UnicodeRelease|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_WINDOWS;_AFXDLL;EDITPADC_CLASS=;COMPILE_MULTIMON_STUBS;UNICODE;_UNICODE;$(NoInherit)"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="UnicodeDebug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BrowseInformation="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BrowseInformation="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;_AFXDLL;EDITPADC_CLASS=;COMPILE_MULTIMON_STUBS;$(NoInherit)"/>
+ </FileConfiguration> </File>
+ <File
RelativePath="BCMenu.cpp">
<FileConfiguration
Name="UnicodeRelease|Win32">
RelativePath="AboutDlg.h">
</File>
<File
+ RelativePath=".\AnsiConvert.h">
+ </File>
+ <File
RelativePath="BCMenu.h">
</File>
<File