[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [TSVN] [Patch] Updated: TMerge Unicode build

From: Norbert Unterberg <nepo_at_gmx.net>
Date: 2005-04-16 19:26:08 CEST

SteveKing schrieb:

>> Attached an updated patch that fixes two minor glitches in addition
>> to the unicode support:
>
Sorry, but the first patch was not fully correct. I stepped into the
svn_diff_... function and noticed that subversion expect the file names
in UTF-8, but the TSVN diff function passes them in ANSI format.

The attached patch corrects that error. It converts the filenames to a
CStringA in UTF-8 format before passing them to the subversion library.

Norbert

Index: src/TortoiseMerge/DiffData.cpp
===================================================================
--- src/TortoiseMerge/DiffData.cpp (revision 3052)
+++ src/TortoiseMerge/DiffData.cpp (working copy)
@@ -22,6 +22,7 @@
 #include "registry.h"
 #include "Resource.h"
 #include "Diffdata.h"
+#include "UnicodeUtils.h"
 
 #pragma warning(push)
 #pragma warning(disable: 4702) // unreachable code
@@ -266,13 +267,14 @@
 bool
 CDiffData::DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, apr_pool_t * pool)
 {
- CStringA strBaseFilename(sBaseFilename);
- CStringA strYourFilename(sYourFilename);
+ // convert CString filenames (UTF-16 or ANSI) to UTF-8
+ CStringA sBaseFilenameUtf8 = CUnicodeUtils::GetUTF8(sBaseFilename);
+ CStringA sYourFilenameUtf8 = CUnicodeUtils::GetUTF8(sYourFilename);
 
         svn_diff_t * diffYourBase = NULL;
         svn_error_t * svnerr = NULL;
 
- svnerr = svn_diff_file_diff(&diffYourBase, strBaseFilename, strYourFilename, pool);
+ svnerr = svn_diff_file_diff(&diffYourBase, sBaseFilenameUtf8, sYourFilenameUtf8, pool);
         if (svnerr)
         {
                 TRACE(_T("diff-error in CDiffData::Load()\n"));
@@ -465,11 +467,13 @@
 bool
 CDiffData::DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, apr_pool_t * pool)
 {
- CStringA strBaseFilename(sBaseFilename);
- CStringA strYourFilename(sYourFilename);
- CStringA strTheirFilename(sTheirFilename);
+ // convert CString filenames (UTF-16 or ANSI) to UTF-8
+ CStringA sBaseFilenameUtf8 = CUnicodeUtils::GetUTF8(sBaseFilename);
+ CStringA sYourFilenameUtf8 = CUnicodeUtils::GetUTF8(sYourFilename);
+ CStringA sTheirFilenameUtf8 = CUnicodeUtils::GetUTF8(sTheirFilename);
+
         svn_diff_t * diffTheirYourBase = NULL;
- svn_error_t * svnerr = svn_diff_file_diff3(&diffTheirYourBase, strBaseFilename, strTheirFilename, strYourFilename, pool);
+ svn_error_t * svnerr = svn_diff_file_diff3(&diffTheirYourBase, sBaseFilenameUtf8, sTheirFilenameUtf8, sYourFilenameUtf8, pool);
         if (svnerr)
         {
                 TRACE(_T("diff-error in CDiffData::Load()\n"));

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Sat Apr 16 19:26:41 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.