From 85b8f591800898ea4d89ad17fc807c6225d184c2 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Wed, 17 Dec 2008 13:11:47 +0800 Subject: [PATCH] Fail try to porting --- src/TortoiseMerge/DiffData.cpp | 18 +- src/TortoiseMerge/DiffData.h | 8 +- src/TortoiseMerge/TortoiseMerge.vcproj | 276 ++++++++++++++----------- src/TortoiseMerge/libsvn_diff/diff_file.c | 22 +- src/TortoiseMerge/libsvn_diff/token.c | 4 - src/TortoiseMerge/svninclude/apr.h | 2 +- src/TortoiseMerge/svninclude/apr_file_info.h | 6 + src/TortoiseMerge/svninclude/apr_file_io.h | 21 ++ src/TortoiseMerge/svninclude/apr_getopt.h | 61 ++++++ src/TortoiseMerge/svninclude/apr_hash.h | 6 + src/TortoiseMerge/svninclude/apr_pools.h | 31 +++ src/TortoiseMerge/svninclude/apr_tables.h | 6 + src/TortoiseMerge/svninclude/apr_time.h | 7 + src/TortoiseMerge/svninclude/svn_error_codes.h | 2 +- src/TortoiseMerge/svninclude/svn_pools.h | 8 + src/TortoiseMerge/svninclude/svn_types.h | 12 +- 16 files changed, 340 insertions(+), 150 deletions(-) diff --git a/src/TortoiseMerge/DiffData.cpp b/src/TortoiseMerge/DiffData.cpp index d3c26ab..0bbcd64 100644 --- a/src/TortoiseMerge/DiffData.cpp +++ b/src/TortoiseMerge/DiffData.cpp @@ -17,7 +17,7 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // #include "StdAfx.h" -//#include "diff.h" +#include "diff.h" #include "TempFiles.h" #include "registry.h" #include "Resource.h" @@ -87,7 +87,7 @@ LPCTSTR CDiffData::GetLineChars(int index) BOOL CDiffData::Load() { -#if 0 + CString sConvertedBaseFilename, sConvertedTheirFilename, sConvertedYourFilename; apr_pool_t * pool; @@ -220,19 +220,19 @@ BOOL CDiffData::Load() apr_pool_destroy (pool); // free the allocated memory -#endif + return TRUE; } bool -CDiffData::DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, bool bIgnoreEOL) +CDiffData::DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, bool bIgnoreEOL,apr_pool_t *pool) { // convert CString filenames (UTF-16 or ANSI) to UTF-8 CStringA sBaseFilenameUtf8 = CUnicodeUtils::GetUTF8(sBaseFilename); CStringA sYourFilenameUtf8 = CUnicodeUtils::GetUTF8(sYourFilename); -#if 0 + svn_diff_t * diffYourBase = NULL; svn_error_t * svnerr = NULL; svn_diff_file_options_t * options = svn_diff_file_options_create(pool); @@ -457,18 +457,18 @@ CDiffData::DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilena tempdiff = tempdiff->next; } TRACE(_T("done with 2-way diff\n")); -#endif + return true; } bool -CDiffData::DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, bool bIgnoreCase) +CDiffData::DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, bool bIgnoreCase,apr_pool_t *pool) { // 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); -#if 0 + svn_diff_t * diffTheirYourBase = NULL; svn_diff_file_options_t * options = svn_diff_file_options_create(pool); options->ignore_eol_style = bIgnoreEOL; @@ -871,7 +871,7 @@ CDiffData::DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFile } ASSERT(m_Diff3.GetCount() == m_YourBaseBoth.GetCount()); ASSERT(m_TheirBaseBoth.GetCount() == m_YourBaseBoth.GetCount()); -#endif + TRACE(_T("done with 3-way diff\n")); return true; } diff --git a/src/TortoiseMerge/DiffData.h b/src/TortoiseMerge/DiffData.h index b2edc50..ee698b6 100644 --- a/src/TortoiseMerge/DiffData.h +++ b/src/TortoiseMerge/DiffData.h @@ -18,8 +18,8 @@ // #pragma once -//#include "svn_diff.h" -//#include "apr_pools.h" +#include "svn_diff.h" +#include "apr_pools.h" #include "FileTextLines.h" #include "Registry.h" #include "WorkingFile.h" @@ -51,8 +51,8 @@ public: bool IsYourFileInUse() const { return m_yourFile.InUse(); } private: - bool DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, bool bIgnoreEOL); - bool DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, bool bIgnoreCase); + bool DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, apr_pool_t * pool); + bool DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, bool bIgnoreCase,apr_pool_t * pool); public: diff --git a/src/TortoiseMerge/TortoiseMerge.vcproj b/src/TortoiseMerge/TortoiseMerge.vcproj index 4981c77..8e87ef4 100644 --- a/src/TortoiseMerge/TortoiseMerge.vcproj +++ b/src/TortoiseMerge/TortoiseMerge.vcproj @@ -47,7 +47,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - diff --git a/src/TortoiseMerge/libsvn_diff/diff_file.c b/src/TortoiseMerge/libsvn_diff/diff_file.c index 88f6a1d..0d24ef6 100644 --- a/src/TortoiseMerge/libsvn_diff/diff_file.c +++ b/src/TortoiseMerge/libsvn_diff/diff_file.c @@ -27,18 +27,21 @@ #include #include "svn_error.h" -#include "svn_diff.h" #include "svn_types.h" + #include "svn_string.h" -#include "svn_io.h" -#include "svn_utf.h" +//#include "svn_io.h" +//#include "svn_utf.h" #include "svn_pools.h" #include "diff.h" -#include "svn_private_config.h" -#include "svn_path.h" -#include "svn_ctype.h" +//#include "svn_private_config.h" +//#include "svn_path.h" +//#include "svn_ctype.h" +#include "svn_diff.h" + -/* A token, i.e. a line read from a file. */ +/* A token, i.e. a line read from a +file. */ typedef struct svn_diff__file_token_t { /* Next token in free list. */ @@ -555,6 +558,7 @@ svn_diff_file_options_create(apr_pool_t *pool) return apr_pcalloc(pool, sizeof(svn_diff_file_options_t)); } +#if 0 svn_error_t * svn_diff_file_options_parse(svn_diff_file_options_t *options, const apr_array_header_t *args, @@ -611,7 +615,7 @@ svn_diff_file_options_parse(svn_diff_file_options_t *options, return SVN_NO_ERROR; } - +#endif svn_error_t * svn_diff_file_diff_2(svn_diff_t **diff, const char *original, @@ -1107,6 +1111,7 @@ output_unified_diff_modified(void *baton, return SVN_NO_ERROR; } +#if 0 /* Set *HEADER to a new string consisting of PATH, a tab, and PATH's mtime. */ static svn_error_t * output_unified_default_hdr(const char **header, const char *path, @@ -1127,6 +1132,7 @@ output_unified_default_hdr(const char **header, const char *path, return SVN_NO_ERROR; } +#endif static const svn_diff_output_fns_t svn_diff__file_output_unified_vtable = { diff --git a/src/TortoiseMerge/libsvn_diff/token.c b/src/TortoiseMerge/libsvn_diff/token.c index 5bc612c..47e7963 100644 --- a/src/TortoiseMerge/libsvn_diff/token.c +++ b/src/TortoiseMerge/libsvn_diff/token.c @@ -21,10 +21,6 @@ #include #include -#include "svn_error.h" -#include "svn_diff.h" -#include "svn_types.h" - #include "diff.h" diff --git a/src/TortoiseMerge/svninclude/apr.h b/src/TortoiseMerge/svninclude/apr.h index 1e8c2b8..d8cacf5 100644 --- a/src/TortoiseMerge/svninclude/apr.h +++ b/src/TortoiseMerge/svninclude/apr.h @@ -304,7 +304,7 @@ extern "C" { /* APR Feature Macros */ #define APR_HAS_SHARED_MEMORY 1 #define APR_HAS_THREADS 1 -#define APR_HAS_MMAP 1 +#define APR_HAS_MMAP 0 #define APR_HAS_FORK 0 #define APR_HAS_RANDOM 1 #define APR_HAS_OTHER_CHILD 1 diff --git a/src/TortoiseMerge/svninclude/apr_file_info.h b/src/TortoiseMerge/svninclude/apr_file_info.h index e69de29..d620439 100644 --- a/src/TortoiseMerge/svninclude/apr_file_info.h +++ b/src/TortoiseMerge/svninclude/apr_file_info.h @@ -0,0 +1,6 @@ +#ifndef ARP_FILE_INFO_XX +#define ARP_FILE_INFO_XX +#include "apr_time.h" + + +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/apr_file_io.h b/src/TortoiseMerge/svninclude/apr_file_io.h index e69de29..10e3b89 100644 --- a/src/TortoiseMerge/svninclude/apr_file_io.h +++ b/src/TortoiseMerge/svninclude/apr_file_io.h @@ -0,0 +1,21 @@ +#ifndef ARP_FILE_IO_XX +#define ARP_FILE_IO_XX +typedef FILE apr_file_t; +#define APR_SET SEEK_SET +#define APR_READ 0 +#define APR_OS_DEFAULT 0 +#define APR_FINFO_SIZE 0 + +struct apr_getopt_option_t { + /** long option name, or NULL if option has no long name */ + const char *name; + /** option letter, or a value greater than 255 if option has no letter */ + int optch; + /** nonzero if option takes an argument */ + int has_arg; + /** a description of the option */ + const char *description; +}; + +typedef struct apr_getopt_option_t apr_getopt_option_t; +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/apr_getopt.h b/src/TortoiseMerge/svninclude/apr_getopt.h index e69de29..a2624fd 100644 --- a/src/TortoiseMerge/svninclude/apr_getopt.h +++ b/src/TortoiseMerge/svninclude/apr_getopt.h @@ -0,0 +1,61 @@ +#ifndef APR_GETOPT_XX +#define APR_GETOPT_XX +/** @see apr_getopt_t */ +typedef struct apr_getopt_t apr_getopt_t; + +/** + * Structure to store command line argument information. + */ +struct apr_getopt_t { + /** context for processing */ + apr_pool_t *cont; + /** function to print error message (NULL == no messages) */ +// apr_getopt_err_fn_t *errfn; + /** user defined first arg to pass to error message */ + void *errarg; + /** index into parent argv vector */ + int ind; + /** character checked for validity */ + int opt; + /** reset getopt */ + int reset; + /** count of arguments */ + int argc; + /** array of pointers to arguments */ + const char **argv; + /** argument associated with option */ + char const* place; + /** set to nonzero to support interleaving options with regular args */ + int interleave; + /** start of non-option arguments skipped for interleaving */ + int skip_start; + /** end of non-option arguments skipped for interleaving */ + int skip_end; +}; + +struct apr_finfo_t { + /** Allocates memory and closes lingering handles in the specified pool */ + apr_pool_t *pool; + /** The bitmask describing valid fields of this apr_finfo_t structure + * including all available 'wanted' fields and potentially more */ + apr_int32_t valid; + /** The access permissions of the file. Mimics Unix access rights. */ + + apr_off_t size; + /** The storage size consumed by the file */ + apr_off_t csize; + /** The time the file was last accessed */ + apr_time_t atime; + /** The time the file was last modified */ + apr_time_t mtime; + /** The time the file was created, or the inode was last changed */ + apr_time_t ctime; + /** The pathname of the file (possibly unrooted) */ + const char *fname; + /** The file's name (no path) in filesystem case */ + const char *name; + +}; + +typedef struct apr_finfo_t apr_finfo_t; +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/apr_hash.h b/src/TortoiseMerge/svninclude/apr_hash.h index e69de29..7d8bf4d 100644 --- a/src/TortoiseMerge/svninclude/apr_hash.h +++ b/src/TortoiseMerge/svninclude/apr_hash.h @@ -0,0 +1,6 @@ +#ifndef APR_HASH_XX +#define APR_HASH_XX + +typedef int apr_hash_t; + +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/apr_pools.h b/src/TortoiseMerge/svninclude/apr_pools.h index e69de29..e388aa1 100644 --- a/src/TortoiseMerge/svninclude/apr_pools.h +++ b/src/TortoiseMerge/svninclude/apr_pools.h @@ -0,0 +1,31 @@ +#ifndef APR_POOLS_XX +#define APR_POOLS_XX + +typedef struct +{ + unsigned char *data; + int size; + int start; + +}apr_pool_t; + +typedef int (*apr_abortfunc_t)(int retcode); + +#ifdef __CPLUSPLUS_ +extern "C" +{ +#endif +void * apr_palloc(apr_pool_t *p, apr_size_t size); + +int apr_pool_create_ex(apr_pool_t **newpool, + apr_pool_t *parent, + apr_abortfunc_t abort_fn, + void *allocator); +void apr_pool_destroy(apr_pool_t *p); + +#ifdef __CPLUSPLUS_ +extern "C" +} +#endif + +#endif diff --git a/src/TortoiseMerge/svninclude/apr_tables.h b/src/TortoiseMerge/svninclude/apr_tables.h index e69de29..bd25a22 100644 --- a/src/TortoiseMerge/svninclude/apr_tables.h +++ b/src/TortoiseMerge/svninclude/apr_tables.h @@ -0,0 +1,6 @@ +#ifndef APR_TABEL_XX +#define ARP_TABEL_XX + +typedef int apr_array_header_t ; + +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/apr_time.h b/src/TortoiseMerge/svninclude/apr_time.h index e69de29..2036913 100644 --- a/src/TortoiseMerge/svninclude/apr_time.h +++ b/src/TortoiseMerge/svninclude/apr_time.h @@ -0,0 +1,7 @@ +#ifndef APR_TIME_XX +#define APR_TIME_XX + +typedef int apr_time_t; + + +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/svn_error_codes.h b/src/TortoiseMerge/svninclude/svn_error_codes.h index ccd7155..91d3ffb 100644 --- a/src/TortoiseMerge/svninclude/svn_error_codes.h +++ b/src/TortoiseMerge/svninclude/svn_error_codes.h @@ -45,7 +45,7 @@ #include #include /* APR's error system */ -#include "svn_props.h" /* For SVN_PROP_EXTERNALS. */ +//#include "svn_props.h" /* For SVN_PROP_EXTERNALS. */ #ifdef __cplusplus extern "C" { diff --git a/src/TortoiseMerge/svninclude/svn_pools.h b/src/TortoiseMerge/svninclude/svn_pools.h index e69de29..6d29bfb 100644 --- a/src/TortoiseMerge/svninclude/svn_pools.h +++ b/src/TortoiseMerge/svninclude/svn_pools.h @@ -0,0 +1,8 @@ +#ifndef SVN_POOLS_XX +#define SVN_POOLS_XX + +typedef TCHAR * svn_stream_t; +typedef BOOL svn_boolean_t; + + +#endif \ No newline at end of file diff --git a/src/TortoiseMerge/svninclude/svn_types.h b/src/TortoiseMerge/svninclude/svn_types.h index 0b2c547..2d80051 100644 --- a/src/TortoiseMerge/svninclude/svn_types.h +++ b/src/TortoiseMerge/svninclude/svn_types.h @@ -31,11 +31,14 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +//porting +typedef int svn_version_t; /** Macro used to mark deprecated functions. @@ -75,7 +78,7 @@ typedef struct svn_error_t struct svn_error_t *child; /** The pool holding this error and any child errors it wraps */ - apr_pool_t *pool; + //apr_pool_t *pool; /** Source file where the error originated. Only used iff @c SVN_DEBUG. */ const char *file; @@ -410,7 +413,7 @@ typedef struct svn_dirent_t svn_revnum_t created_rev; /** time of created_rev (mod-time) */ - apr_time_t time; + //apr_time_t time; /** author of created_rev */ const char *last_author; @@ -427,7 +430,6 @@ svn_dirent_t * svn_dirent_dup(const svn_dirent_t *dirent, apr_pool_t *pool); - /** Keyword substitution. * @@ -596,14 +598,14 @@ typedef struct svn_log_entry_t * they're not, it might be nice to change apr_hash_first() so * read-only uses of hashes can be protected via the type system. */ - apr_hash_t *changed_paths; + //apr_hash_t *changed_paths; /** The revision of the commit. */ svn_revnum_t revision; /** The hash of requested revision properties, which may be NULL if it * would contain no revprops. */ - apr_hash_t *revprops; +// apr_hash_t *revprops; /** * Whether or not this message has children. -- 2.11.0