diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2015-10-18 13:47:12 +0700 | 
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2015-10-19 21:39:44 +0700 | 
| commit | b7feb0f6affbe1797e90530f55f5d45017bf9034 (patch) | |
| tree | 656e53a14df2c6b145f4afa3b22d62b8ebf30906 | |
| parent | f9238d1479768f1f17ea97d05a5cfc7da4fa2b48 (diff) | |
| download | tdevelop-b7feb0f6affbe1797e90530f55f5d45017bf9034.tar.gz tdevelop-b7feb0f6affbe1797e90530f55f5d45017bf9034.zip  | |
Fixed FTBFS caused by changes introduced by subversion 1.9. This relates to bug 2528.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit e392d02940544b7c4798513bdd2e57079838e169)
| -rw-r--r-- | vcs/subversion/svn_tdeio.cpp | 65 | 
1 files changed, 58 insertions, 7 deletions
diff --git a/vcs/subversion/svn_tdeio.cpp b/vcs/subversion/svn_tdeio.cpp index 23f1d2ff..80343d8c 100644 --- a/vcs/subversion/svn_tdeio.cpp +++ b/vcs/subversion/svn_tdeio.cpp @@ -47,6 +47,7 @@  #include <subversion-1/svn_ra.h>  #include <subversion-1/svn_time.h>  #include <subversion-1/svn_cmdline.h> +#include <subversion-1/svn_version.h>  #include <kmimetype.h>  #include <tqfile.h> @@ -110,10 +111,60 @@ static svn_error_t *write_to_string(void *baton, const char *data, apr_size_t *l  	return SVN_NO_ERROR;  } -static int -compare_items_as_paths (const svn_sort__item_t*a, const svn_sort__item_t*b) { -  return svn_path_compare_paths ((const char *)a->key, (const char *)b->key); +#if (SVN_VER_MAJOR == 1 && SVN_VER_MINOR <= 8) +typedef svn_sort__item_t svn_sort_item_type; +#else +// Taken from subversion 1.8.10 source code and modified where needed + +// Same as svn_sort__item_t +typedef struct svn_sort_item_type { +  const void *key;  // pointer to the key +  apr_ssize_t klen; // size of the key +  void *value;      // pointer to the value +} svn_sort_item_type; + +apr_array_header_t* svn_sort__hash(apr_hash_t *ht, +        int (*comparison_func)(const svn_sort__item_t*, const svn_sort__item_t*), apr_pool_t *pool) +{ +  apr_hash_index_t *hi; +  apr_array_header_t *ary; +  svn_boolean_t sorted; +  svn_sort_item_type *prev_item; + +  /* allocate an array with enough elements to hold all the keys. */ +  ary = apr_array_make(pool, apr_hash_count(ht), sizeof(svn_sort_item_type)); + +  /* loop over hash table and push all keys into the array */ +  sorted = TRUE; +  prev_item = NULL; +  for (hi = apr_hash_first(pool, ht); hi; hi = apr_hash_next(hi)) +	{ +		svn_sort_item_type *item = (svn_sort_item_type*)apr_array_push(ary); +		apr_hash_this(hi, &item->key, &item->klen, &item->value); + +		if (prev_item == NULL) +		{ +			prev_item = item; +			continue; +		} + +		if (sorted) +		{ +			sorted = (comparison_func((svn_sort__item_t*)prev_item, (svn_sort__item_t*)item) < 0); +			prev_item = item; +		} +	} + +  /* quicksort the array if it isn't already sorted.  */ +  if (!sorted) +  { +    qsort(ary->elts, ary->nelts, ary->elt_size, +          (int (*)(const void*, const void*))comparison_func); +  } + +  return ary;  } +#endif  tdeio_svnProtocol::tdeio_svnProtocol(const TQCString &pool_socket, const TQCString &app_socket)  	: SlaveBase("tdeio_svn", pool_socket, app_socket) { @@ -461,16 +512,16 @@ void tdeio_svnProtocol::listDir(const KURL& url){    apr_array_header_t *array;    int i; -  array = svn_sort__hash (dirents, compare_items_as_paths, subpool); +  array = svn_sort__hash (dirents, svn_sort_compare_items_as_paths, subpool);    UDSEntry entry;    for (i = 0; i < array->nelts; ++i) {  	  entry.clear();        const char *utf8_entryname, *native_entryname;        svn_dirent_t *dirent; -      svn_sort__item_t *item; +      svn_sort_item_type *item; -      item = &APR_ARRAY_IDX (array, i, svn_sort__item_t); +      item = &APR_ARRAY_IDX (array, i, svn_sort_item_type);        utf8_entryname = (const char*)item->key; @@ -2071,7 +2122,7 @@ void tdeio_svnProtocol::notify(void *baton, const char *path, svn_wc_notify_acti  	tdeio_svnProtocol *p = ( tdeio_svnProtocol* )nb->master;  	if (!p) kdDebug(9036) << " Null Pointer at Line " << __LINE__ << endl; -	p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "path" , TQString::fromUtf8( path ));  +	p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "path" , TQString::fromUtf8( path ));  	p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "action", TQString::number( action ));  	p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "kind", TQString::number( kind ));  	p->setMetaData(TQString::number( p->counter() ).rightJustify( 10,'0' )+ "mime_t", TQString::fromUtf8( mime_type ));  | 
