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 e392d02940)
r14.0.x
Michele Calgaro 9 years ago
parent f9238d1479
commit b7feb0f6af

@ -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 ));

Loading…
Cancel
Save