File trinity-kdevelop-subversion_1_9.patch of Package kdevelop3

From e392d02940544b7c4798513bdd2e57079838e169 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Sun, 18 Oct 2015 13:47:12 +0700
Subject: Fixed FTBFS caused by changes introduced by subversion 1.9. This
 relates to bug 2528.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>

diff --git a/vcs/subversion/svn_kio.cpp b/vcs/subversion/svn_kio.cpp
index 23f1d2f..80343d8 100644
--- a/vcs/subversion/svn_kio.cpp
+++ b/vcs/subversion/svn_kio.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 <qfile.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
 
 kio_svnProtocol::kio_svnProtocol(const QCString &pool_socket, const QCString &app_socket)
 	: SlaveBase("kio_svn", pool_socket, app_socket) {
@@ -461,16 +512,16 @@ void kio_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
 	kio_svnProtocol *p = ( kio_svnProtocol* )nb->master;
 	if (!p) kdDebug(9036) << " Null Pointer at Line " << __LINE__ << endl;
 
-	p->setMetaData(QString::number( p->counter() ).rightJustify( 10,'0' )+ "path" , QString::fromUtf8( path )); 
+	p->setMetaData(QString::number( p->counter() ).rightJustify( 10,'0' )+ "path" , QString::fromUtf8( path ));
 	p->setMetaData(QString::number( p->counter() ).rightJustify( 10,'0' )+ "action", QString::number( action ));
 	p->setMetaData(QString::number( p->counter() ).rightJustify( 10,'0' )+ "kind", QString::number( kind ));
 	p->setMetaData(QString::number( p->counter() ).rightJustify( 10,'0' )+ "mime_t", QString::fromUtf8( mime_type ));
-- 
cgit v0.10.2

openSUSE Build Service is sponsored by