You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/05/16 22:32:54 UTC

svn commit: r1339349 [21/37] - in /subversion/branches/fix-rdump-editor: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ build/win32/ contrib/client-side/emacs/ contrib/client-side/vim/ contrib/server-side/ notes/ notes/api-errat...

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c Wed May 16 20:32:43 2012
@@ -311,7 +311,7 @@ typedef struct entry_t
   /* Size of the serialized item data. May be 0.
    * Only valid for used entries.
    */
-  apr_uint32_t size;
+  apr_size_t size;
 
   /* Number of (read) hits for this entry. Will be reset upon write.
    * Only valid for used entries.
@@ -584,43 +584,25 @@ insert_entry(svn_membuffer_t *cache, ent
     }
 }
 
-/* Map a KEY of length LEN to the CACHE and group that shall contain the
- * respective item. Return the hash value in TO_FIND. Returns -1 upon error.
+/* Map a KEY of 16 bytes to the CACHE and group that shall contain the
+ * respective item.
  */
 static apr_uint32_t
 get_group_index(svn_membuffer_t **cache,
-                const void *key,
-                apr_size_t len,
-                unsigned char *to_find,
-                apr_pool_t *pool)
+                const apr_uint32_t *key)
 {
-  apr_uint32_t hash = 0;
-  int i;
-
-  /* calculate a hash value for the key */
-  svn_checksum_t *checksum;
-  svn_error_t *err;
-
-  if (key == NULL)
-    return NO_INDEX;
-
-  err = svn_checksum(&checksum, svn_checksum_md5, key, len, pool);
-  if (err != NULL)
-  {
-    svn_error_clear(err);
-    return NO_INDEX;
-  }
-
-  memcpy(to_find, checksum->digest, APR_MD5_DIGESTSIZE);
-
-  /* select the cache segment to use */
-  *cache = &(*cache)[to_find[0] & ((*cache)->segment_count -1)];
+  apr_uint32_t hash;
 
   /* Get the group that *must* contain the entry. Fold the hash value
    * just to be sure (it should not be necessary for perfect hashes).
    */
-  for (i = 0; i < sizeof(to_find) / sizeof(apr_uint32_t); ++i)
-    hash += ((apr_uint32_t*)to_find)[i] ^ ((hash >> 19) || (hash << 13));
+  hash = key[0];
+  hash = key[1] ^ ((hash >> 19) || (hash << 13));
+  hash = key[2] ^ ((hash >> 19) || (hash << 13));
+  hash = key[3] ^ ((hash >> 19) || (hash << 13));
+
+  /* select the cache segment to use */
+  *cache = &(*cache)[key[0] & ((*cache)->segment_count -1)];
 
   return hash % (*cache)->group_count;
 }
@@ -1012,10 +994,10 @@ svn_cache__membuffer_cache_create(svn_me
   max_entry_size = data_size / 4 > MAX_ITEM_SIZE
                  ? MAX_ITEM_SIZE
                  : data_size / 4;
-  
+
   /* to keep the entries small, we use 32 bit indices only
    * -> we need to ensure that no more then 4G entries exist.
-   * 
+   *
    * Note, that this limit could only be exceeded in a very
    * theoretical setup with about 1EB of cache.
    */
@@ -1154,22 +1136,18 @@ membuffer_cache_set_internal(svn_membuff
 static svn_error_t *
 membuffer_cache_set(svn_membuffer_t *cache,
                     const void *key,
-                    apr_size_t key_len,
                     void *item,
                     svn_cache__serialize_func_t serializer,
                     DEBUG_CACHE_MEMBUFFER_TAG_ARG
                     apr_pool_t *scratch_pool)
 {
   apr_uint32_t group_index;
-  unsigned char to_find[KEY_SIZE];
-  char *buffer = NULL;
-  apr_size_t size;
+  void *buffer = NULL;
+  apr_size_t size = 0;
 
   /* find the entry group that will hold the key.
    */
-  group_index = get_group_index(&cache, key, key_len, to_find, scratch_pool);
-  if (group_index == NO_INDEX)
-    return SVN_NO_ERROR;
+  group_index = get_group_index(&cache, key);
 
   /* Serialize data data.
    */
@@ -1180,7 +1158,7 @@ membuffer_cache_set(svn_membuffer_t *cac
    */
   SVN_MUTEX__WITH_LOCK(cache->mutex,
                        membuffer_cache_set_internal(cache,
-                                                    to_find,
+                                                    key,
                                                     group_index,
                                                     buffer,
                                                     size,
@@ -1262,32 +1240,22 @@ membuffer_cache_get_internal(svn_membuff
 static svn_error_t *
 membuffer_cache_get(svn_membuffer_t *cache,
                     const void *key,
-                    apr_size_t key_len,
                     void **item,
                     svn_cache__deserialize_func_t deserializer,
                     DEBUG_CACHE_MEMBUFFER_TAG_ARG
                     apr_pool_t *result_pool)
 {
   apr_uint32_t group_index;
-  unsigned char to_find[KEY_SIZE];
   char *buffer;
   apr_size_t size;
 
   /* find the entry group that will hold the key.
    */
-  group_index = get_group_index(&cache, key, key_len, to_find, result_pool);
-  if (group_index == NO_INDEX)
-    {
-      /* Some error occured, return "item not found".
-       */
-      *item = NULL;
-      return SVN_NO_ERROR;
-    }
-
+  group_index = get_group_index(&cache, key);
   SVN_MUTEX__WITH_LOCK(cache->mutex,
                        membuffer_cache_get_internal(cache,
                                                     group_index,
-                                                    to_find,
+                                                    key,
                                                     &buffer,
                                                     &size,
                                                     DEBUG_CACHE_MEMBUFFER_TAG
@@ -1369,7 +1337,7 @@ membuffer_cache_get_partial_internal(svn
     }
 }
 
-/* Look for the cache entry identified by KEY and KEY_LEN. FOUND indicates
+/* Look for the cache entry identified by KEY. FOUND indicates
  * whether that entry exists. If not found, *ITEM will be NULL. Otherwise,
  * the DESERIALIZER is called with that entry and the BATON provided
  * and will extract the desired information. The result is set in *ITEM.
@@ -1378,7 +1346,6 @@ membuffer_cache_get_partial_internal(svn
 static svn_error_t *
 membuffer_cache_get_partial(svn_membuffer_t *cache,
                             const void *key,
-                            apr_size_t key_len,
                             void **item,
                             svn_boolean_t *found,
                             svn_cache__partial_getter_func_t deserializer,
@@ -1386,17 +1353,13 @@ membuffer_cache_get_partial(svn_membuffe
                             DEBUG_CACHE_MEMBUFFER_TAG_ARG
                             apr_pool_t *result_pool)
 {
-  apr_uint32_t group_index;
-  unsigned char to_find[KEY_SIZE];
+  apr_uint32_t group_index = get_group_index(&cache, key);
 
-  group_index = get_group_index(&cache, key, key_len, to_find, result_pool);
-
-  if (group_index != NO_INDEX)
-    SVN_MUTEX__WITH_LOCK(cache->mutex,
-                         membuffer_cache_get_partial_internal
-                             (cache, group_index, to_find, item, found,
-                              deserializer, baton, DEBUG_CACHE_MEMBUFFER_TAG
-                              result_pool));
+  SVN_MUTEX__WITH_LOCK(cache->mutex,
+                       membuffer_cache_get_partial_internal
+                           (cache, group_index, key, item, found,
+                            deserializer, baton, DEBUG_CACHE_MEMBUFFER_TAG
+                            result_pool));
 
   return SVN_NO_ERROR;
 }
@@ -1457,7 +1420,7 @@ membuffer_cache_set_partial_internal(svn
 
       /* modify it, preferrably in-situ.
        */
-      err = func(&data, &size, baton, scratch_pool);
+      err = func((void **)&data, &size, baton, scratch_pool);
 
       if (err)
         {
@@ -1507,7 +1470,7 @@ membuffer_cache_set_partial_internal(svn
   return SVN_NO_ERROR;
 }
 
-/* Look for the cache entry identified by KEY and KEY_LEN. If no entry
+/* Look for the cache entry identified by KEY. If no entry
  * has been found, the function returns without modifying the cache.
  * Otherwise, FUNC is called with that entry and the BATON provided
  * and may modify the cache entry. Allocations will be done in POOL.
@@ -1515,25 +1478,19 @@ membuffer_cache_set_partial_internal(svn
 static svn_error_t *
 membuffer_cache_set_partial(svn_membuffer_t *cache,
                             const void *key,
-                            apr_size_t key_len,
                             svn_cache__partial_setter_func_t func,
                             void *baton,
                             DEBUG_CACHE_MEMBUFFER_TAG_ARG
                             apr_pool_t *scratch_pool)
 {
-  apr_uint32_t group_index;
-  unsigned char to_find[KEY_SIZE];
-
   /* cache item lookup
    */
-  group_index = get_group_index(&cache, key, key_len, to_find, scratch_pool);
-
-  if (group_index != NO_INDEX)
-    SVN_MUTEX__WITH_LOCK(cache->mutex,
-                         membuffer_cache_set_partial_internal
-                             (cache, group_index, to_find, func, baton,
-                              DEBUG_CACHE_MEMBUFFER_TAG_ARG
-                              scratch_pool));
+  apr_uint32_t group_index = get_group_index(&cache, key);
+  SVN_MUTEX__WITH_LOCK(cache->mutex,
+                       membuffer_cache_set_partial_internal
+                           (cache, group_index, key, func, baton,
+                            DEBUG_CACHE_MEMBUFFER_TAG_ARG
+                            scratch_pool));
 
   /* done here -> unlock the cache
    */
@@ -1576,7 +1533,7 @@ typedef struct svn_membuffer_cache_t
    * This makes (very likely) our keys different from all keys used
    * by other svn_membuffer_cache_t instances.
    */
-  unsigned char prefix [APR_MD5_DIGESTSIZE];
+  apr_uint64_t prefix [APR_MD5_DIGESTSIZE / sizeof(apr_uint64_t)];
 
   /* A copy of the unmodified prefix. It is being used as a user-visible
    * ID for this cache instance.
@@ -1588,6 +1545,10 @@ typedef struct svn_membuffer_cache_t
    */
   apr_ssize_t key_len;
 
+  /* Temporary buffer containing the hash key for the current access
+   */
+  apr_uint64_t combined_key [APR_MD5_DIGESTSIZE / sizeof(apr_uint64_t)];
+
   /* a pool for temporary allocations during get() and set()
    */
   apr_pool_t *pool;
@@ -1615,34 +1576,21 @@ typedef struct svn_membuffer_cache_t
 #define ALLOCATIONS_PER_POOL_CLEAR 10
 
 
-/* Basically concatenate PREFIX and KEY and return the result in FULL_KEY.
- * Allocations will be made in POOL.
+/* Basically calculate a hash value for KEY of length KEY_LEN, combine it
+ * with the CACHE->PREFIX and write the result in CACHE->COMBINED_KEY.
  */
 static void
-combine_key(const void *prefix,
-            apr_size_t prefix_len,
+combine_key(svn_membuffer_cache_t *cache,
             const void *key,
-            apr_ssize_t key_len,
-            void **full_key,
-            apr_size_t *full_key_len,
-            apr_pool_t *pool)
+            apr_ssize_t key_len)
 {
-  if (key == NULL)
-    {
-      *full_key = NULL;
-      *full_key_len = 0;
-    }
-  else
-    {
-      if (key_len == APR_HASH_KEY_STRING)
-        key_len = strlen((const char *) key);
+  if (key_len == APR_HASH_KEY_STRING)
+    key_len = strlen((const char *) key);
 
-      *full_key_len = prefix_len + key_len;
-      *full_key = apr_palloc(pool, *full_key_len);
+  apr_md5((unsigned char*)cache->combined_key, key, key_len);
 
-      memcpy(*full_key, prefix, prefix_len);
-      memcpy((char *)*full_key + prefix_len, key, key_len);
-    }
+  cache->combined_key[0] ^= cache->prefix[0];
+  cache->combined_key[1] ^= cache->prefix[1];
 }
 
 /* Implement svn_cache__vtable_t.get (not thread-safe)
@@ -1656,26 +1604,25 @@ svn_membuffer_cache_get(void **value_p,
 {
   svn_membuffer_cache_t *cache = cache_void;
 
+  DEBUG_CACHE_MEMBUFFER_INIT_TAG
+
+  /* special case */
+  if (key == NULL)
+    {
+      *value_p = NULL;
+      *found = FALSE;
+
+      return SVN_NO_ERROR;
+    }
+
   /* construct the full, i.e. globally unique, key by adding
    * this cache instances' prefix
    */
-  void *full_key;
-  apr_size_t full_key_len;
-
-  DEBUG_CACHE_MEMBUFFER_INIT_TAG
-
-  combine_key(cache->prefix,
-              sizeof(cache->prefix),
-              key,
-              cache->key_len,
-              &full_key,
-              &full_key_len,
-              cache->pool);
+  combine_key(cache, key, cache->key_len);
 
   /* Look the item up. */
   SVN_ERR(membuffer_cache_get(cache->membuffer,
-                              full_key,
-                              full_key_len,
+                              cache->combined_key,
                               value_p,
                               cache->deserializer,
                               DEBUG_CACHE_MEMBUFFER_TAG
@@ -1706,11 +1653,12 @@ svn_membuffer_cache_set(void *cache_void
 {
   svn_membuffer_cache_t *cache = cache_void;
 
-  void *full_key;
-  apr_size_t full_key_len;
-
   DEBUG_CACHE_MEMBUFFER_INIT_TAG
 
+  /* special case */
+  if (key == NULL)
+    return SVN_NO_ERROR;
+
   /* we do some allocations below, so increase the allocation counter
    * by a slightly larger amount. Free allocated memory every now and then.
    */
@@ -1724,20 +1672,13 @@ svn_membuffer_cache_set(void *cache_void
   /* construct the full, i.e. globally unique, key by adding
    * this cache instances' prefix
    */
-  combine_key(cache->prefix,
-              sizeof(cache->prefix),
-              key,
-              cache->key_len,
-              &full_key,
-              &full_key_len,
-              cache->pool);
+  combine_key(cache, key, cache->key_len);
 
   /* (probably) add the item to the cache. But there is no real guarantee
    * that the item will actually be cached afterwards.
    */
   return membuffer_cache_set(cache->membuffer,
-                             full_key,
-                             full_key_len,
+                             cache->combined_key,
                              value,
                              cache->serializer,
                              DEBUG_CACHE_MEMBUFFER_TAG
@@ -1770,28 +1711,25 @@ svn_membuffer_cache_get_partial(void **v
 {
   svn_membuffer_cache_t *cache = cache_void;
 
-  void *full_key;
-  apr_size_t full_key_len;
-
   DEBUG_CACHE_MEMBUFFER_INIT_TAG
 
+  if (key == NULL)
+    {
+      *value_p = NULL;
+      *found = FALSE;
+
+      return SVN_NO_ERROR;
+    }
+
   if (++cache->alloc_counter > ALLOCATIONS_PER_POOL_CLEAR)
     {
       apr_pool_clear(cache->pool);
       cache->alloc_counter = 0;
     }
 
-  combine_key(cache->prefix,
-              sizeof(cache->prefix),
-              key,
-              cache->key_len,
-              &full_key,
-              &full_key_len,
-              cache->pool);
-
+  combine_key(cache, key, cache->key_len);
   SVN_ERR(membuffer_cache_get_partial(cache->membuffer,
-                                      full_key,
-                                      full_key_len,
+                                      cache->combined_key,
                                       value_p,
                                       found,
                                       func,
@@ -1813,27 +1751,18 @@ svn_membuffer_cache_set_partial(void *ca
 {
   svn_membuffer_cache_t *cache = cache_void;
 
-  void *full_key;
-  apr_size_t full_key_len;
-
   DEBUG_CACHE_MEMBUFFER_INIT_TAG
 
-  combine_key(cache->prefix,
-              sizeof(cache->prefix),
-              key,
-              cache->key_len,
-              &full_key,
-              &full_key_len,
-              scratch_pool);
-
-  SVN_ERR(membuffer_cache_set_partial(cache->membuffer,
-                                      full_key,
-                                      full_key_len,
-                                      func,
-                                      baton,
-                                      DEBUG_CACHE_MEMBUFFER_TAG
-                                      scratch_pool));
-
+  if (key != NULL)
+    {
+      combine_key(cache, key, cache->key_len);
+      SVN_ERR(membuffer_cache_set_partial(cache->membuffer,
+                                          cache->combined_key,
+                                          func,
+                                          baton,
+                                          DEBUG_CACHE_MEMBUFFER_TAG
+                                          scratch_pool));
+    }
   return SVN_NO_ERROR;
 }
 
@@ -2014,7 +1943,7 @@ static svn_cache__vtable_t membuffer_cac
  * Implements svn_cache__serialize_func_t.
  */
 static svn_error_t *
-serialize_svn_stringbuf(char **buffer,
+serialize_svn_stringbuf(void **buffer,
                         apr_size_t *buffer_size,
                         void *item,
                         apr_pool_t *result_pool)
@@ -2032,7 +1961,7 @@ serialize_svn_stringbuf(char **buffer,
  */
 static svn_error_t *
 deserialize_svn_stringbuf(void **item,
-                          char *buffer,
+                          void *buffer,
                           apr_size_t buffer_size,
                           apr_pool_t *result_pool)
 {

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c Wed May 16 20:32:43 2012
@@ -247,7 +247,7 @@ memcache_set(void *cache_void,
 {
   memcache_t *cache = cache_void;
   apr_pool_t *subpool = svn_pool_create(scratch_pool);
-  char *data;
+  void *data;
   apr_size_t data_len;
   svn_error_t *err;
 
@@ -307,12 +307,12 @@ memcache_set_partial(void *cache_void,
 {
   svn_error_t *err = SVN_NO_ERROR;
 
-  char *data;
+  void *data;
   apr_size_t size;
   svn_boolean_t found = FALSE;
 
   apr_pool_t *subpool = svn_pool_create(scratch_pool);
-  SVN_ERR(memcache_internal_get(&data,
+  SVN_ERR(memcache_internal_get((char **)&data,
                                 &size,
                                 &found,
                                 cache_void,

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/checksum.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/checksum.c Wed May 16 20:32:43 2012
@@ -34,6 +34,8 @@
 #include "sha1.h"
 #include "md5.h"
 
+#include "private/svn_subr_private.h"
+
 #include "svn_private_config.h"
 
 
@@ -54,36 +56,71 @@ validate_kind(svn_checksum_kind_t kind)
     return svn_error_create(SVN_ERR_BAD_CHECKSUM_KIND, NULL, NULL);
 }
 
+/* Create a svn_checksum_t with everything but the contents of the
+   digest populated. */
+static svn_checksum_t *
+checksum_create_without_digest(svn_checksum_kind_t kind,
+                               apr_size_t digest_size,
+                               apr_pool_t *pool)
+{
+  /* Use apr_palloc() instead of apr_pcalloc() so that the digest
+   * contents are only set once by the caller. */
+  svn_checksum_t *checksum = apr_palloc(pool, sizeof(*checksum) + digest_size);
+  checksum->digest = (unsigned char *)checksum + sizeof(*checksum);
+  checksum->kind = kind;
+  return checksum;
+}
+
+static svn_checksum_t *
+checksum_create(svn_checksum_kind_t kind,
+                apr_size_t digest_size,
+                const unsigned char *digest,
+                apr_pool_t *pool)
+{
+  svn_checksum_t *checksum = checksum_create_without_digest(kind, digest_size,
+                                                            pool);
+  memcpy((unsigned char *)checksum->digest, digest, digest_size);
+  return checksum;
+}
 
 svn_checksum_t *
 svn_checksum_create(svn_checksum_kind_t kind,
                     apr_pool_t *pool)
 {
   svn_checksum_t *checksum;
+  apr_size_t digest_size;
 
   switch (kind)
     {
       case svn_checksum_md5:
+        digest_size = APR_MD5_DIGESTSIZE;
+        break;
       case svn_checksum_sha1:
-        checksum = apr_pcalloc(pool, sizeof(*checksum) + DIGESTSIZE(kind));
-        checksum->digest = (unsigned char *)checksum + sizeof(*checksum);
-        checksum->kind = kind;
-        return checksum;
-
+        digest_size = APR_SHA1_DIGESTSIZE;
+        break;
       default:
         return NULL;
     }
+
+  checksum = checksum_create_without_digest(kind, digest_size, pool);
+  memset((unsigned char *) checksum->digest, 0, digest_size);
+  return checksum;
 }
 
 svn_checksum_t *
-svn_checksum__from_digest(const unsigned char *digest,
-                          svn_checksum_kind_t kind,
-                          apr_pool_t *result_pool)
+svn_checksum__from_digest_md5(const unsigned char *digest,
+                              apr_pool_t *result_pool)
 {
-  svn_checksum_t *checksum = svn_checksum_create(kind, result_pool);
+  return checksum_create(svn_checksum_md5, APR_MD5_DIGESTSIZE, digest,
+                         result_pool);
+}
 
-  memcpy((unsigned char *)checksum->digest, digest, DIGESTSIZE(kind));
-  return checksum;
+svn_checksum_t *
+svn_checksum__from_digest_sha1(const unsigned char *digest,
+                               apr_pool_t *result_pool)
+{
+  return checksum_create(svn_checksum_sha1, APR_SHA1_DIGESTSIZE, digest,
+                         result_pool);
 }
 
 svn_error_t *
@@ -160,6 +197,8 @@ svn_checksum_serialize(const svn_checksu
 {
   const char *ckind_str;
 
+  SVN_ERR_ASSERT_NO_RETURN(checksum->kind == svn_checksum_md5
+                           || checksum->kind == svn_checksum_sha1);
   ckind_str = (checksum->kind == svn_checksum_md5 ? "$md5 $" : "$sha1$");
   return apr_pstrcat(result_pool,
                      ckind_str,
@@ -255,7 +294,23 @@ svn_checksum_dup(const svn_checksum_t *c
   if (checksum == NULL)
     return NULL;
 
-  return svn_checksum__from_digest(checksum->digest, checksum->kind, pool);
+  /* Without this check on valid checksum kind a NULL svn_checksum_t
+   * pointer is returned which could cause a core dump at an
+   * indeterminate time in the future because callers are not
+   * expecting a NULL pointer.  This commit forces an early abort() so
+   * it's easier to track down where the issue arose. */
+  switch (checksum->kind)
+    {
+      case svn_checksum_md5:
+        return svn_checksum__from_digest_md5(checksum->digest, pool);
+        break;
+      case svn_checksum_sha1:
+        return svn_checksum__from_digest_sha1(checksum->digest, pool);
+        break;
+      default:
+        SVN_ERR_MALFUNCTION_NO_RETURN();
+        break;
+    }
 }
 
 svn_error_t *
@@ -278,7 +333,7 @@ svn_checksum(svn_checksum_t **checksum,
 
       case svn_checksum_sha1:
         apr_sha1_init(&sha1_ctx);
-        apr_sha1_update(&sha1_ctx, data, len);
+        apr_sha1_update(&sha1_ctx, data, (unsigned int)len);
         apr_sha1_final((unsigned char *)(*checksum)->digest, &sha1_ctx);
         break;
 
@@ -295,24 +350,20 @@ svn_checksum_t *
 svn_checksum_empty_checksum(svn_checksum_kind_t kind,
                             apr_pool_t *pool)
 {
-  const unsigned char *digest;
-
   switch (kind)
     {
       case svn_checksum_md5:
-        digest = svn_md5__empty_string_digest();
-        break;
+        return svn_checksum__from_digest_md5(svn_md5__empty_string_digest(),
+                                             pool);
 
       case svn_checksum_sha1:
-        digest = svn_sha1__empty_string_digest();
-        break;
+        return svn_checksum__from_digest_sha1(svn_sha1__empty_string_digest(),
+                                              pool);
 
       default:
         /* We really shouldn't get here, but if we do... */
-        return NULL;
+        SVN_ERR_MALFUNCTION_NO_RETURN();
     }
-
-  return svn_checksum__from_digest(digest, kind, pool);
 }
 
 struct svn_checksum_ctx_t
@@ -341,7 +392,7 @@ svn_checksum_ctx_create(svn_checksum_kin
         break;
 
       default:
-        return NULL;
+        SVN_ERR_MALFUNCTION_NO_RETURN();
     }
 
   return ctx;
@@ -359,7 +410,7 @@ svn_checksum_update(svn_checksum_ctx_t *
         break;
 
       case svn_checksum_sha1:
-        apr_sha1_update(ctx->apr_ctx, data, len);
+        apr_sha1_update(ctx->apr_ctx, data, (unsigned int)len);
         break;
 
       default:
@@ -444,6 +495,6 @@ svn_checksum_is_empty_checksum(svn_check
 
       default:
         /* We really shouldn't get here, but if we do... */
-        return FALSE;
+        SVN_ERR_MALFUNCTION_NO_RETURN();
     }
 }

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config.c Wed May 16 20:32:43 2012
@@ -34,6 +34,7 @@
 #include "config_impl.h"
 
 #include "svn_private_config.h"
+#include "private/svn_dep_compat.h"
 
 
 
@@ -561,6 +562,7 @@ svn_config_get(svn_config_t *cfg, const 
                const char *section, const char *option,
                const char *default_value)
 {
+  *valuep = default_value;
   if (cfg)
     {
       cfg_section_t *sec;
@@ -570,23 +572,21 @@ svn_config_get(svn_config_t *cfg, const 
           make_string_from_option(valuep, cfg, sec, opt, NULL);
         }
       else
-        {
-          apr_pool_t *tmp_pool = svn_pool_create(cfg->x_pool);
-          const char *x_default;
-          expand_option_value(cfg, sec, default_value, &x_default, tmp_pool);
-          if (x_default)
-            {
-              svn_stringbuf_set(cfg->tmp_value, x_default);
-              *valuep = cfg->tmp_value->data;
-            }
-          else
-            *valuep = default_value;
-          svn_pool_destroy(tmp_pool);
-        }
-    }
-  else
-    {
-      *valuep = default_value;
+        /* before attempting to expand an option, check for the placeholder.
+         * If none is there, there is no point in calling expand_option_value.
+         */
+        if (default_value && strchr(default_value, '%'))
+          {
+            apr_pool_t *tmp_pool = svn_pool_create(cfg->x_pool);
+            const char *x_default;
+            expand_option_value(cfg, sec, default_value, &x_default, tmp_pool);
+            if (x_default)
+              {
+                svn_stringbuf_set(cfg->tmp_value, x_default);
+                *valuep = cfg->tmp_value->data;
+              }
+            svn_pool_destroy(tmp_pool);
+          }
     }
 }
 
@@ -697,6 +697,33 @@ svn_config_set_bool(svn_config_t *cfg,
 }
 
 svn_error_t *
+svn_config_get_int64(svn_config_t *cfg,
+                     apr_int64_t *valuep,
+                     const char *section,
+                     const char *option,
+                     apr_int64_t default_value)
+{
+  const char *tmp_value;
+  svn_config_get(cfg, &tmp_value, section, option, NULL);
+  if (tmp_value)
+    return svn_cstring_strtoi64(valuep, tmp_value,
+                                APR_INT64_MIN, APR_INT64_MAX, 10);
+
+  *valuep = default_value;
+  return SVN_NO_ERROR;
+}
+
+void
+svn_config_set_int64(svn_config_t *cfg,
+                     const char *section,
+                     const char *option,
+                     apr_int64_t value)
+{
+  svn_config_set(cfg, section, option,
+                 apr_psprintf(cfg->pool, "%" APR_INT64_T_FMT, value));
+}
+
+svn_error_t *
 svn_config_get_yes_no_ask(svn_config_t *cfg, const char **valuep,
                           const char *section, const char *option,
                           const char* default_value)

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config_file.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/config_file.c Wed May 16 20:32:43 2012
@@ -123,7 +123,7 @@ parser_ungetc(parse_context_t *ctx, int 
 static APR_INLINE svn_error_t *
 skip_whitespace(parse_context_t *ctx, int *c, int *pcount)
 {
-  int ch;
+  int ch = 0;
   int count = 0;
 
   SVN_ERR(parser_getc(ctx, &ch));

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/error.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/error.c Wed May 16 20:32:43 2012
@@ -218,6 +218,28 @@ svn_error_quick_wrap(svn_error_t *child,
 
 
 svn_error_t *
+svn_error__trace(const char *file, long line, svn_error_t *err)
+{
+#ifndef SVN_DEBUG
+
+  /* We shouldn't even be here, but whatever. Just return the error as-is.  */
+  return err;
+
+#else
+
+  /* Only do the work when an error occurs.  */
+  if (err)
+    {
+      svn_error__locate(file, line);
+      return svn_error_quick_wrap(err, SVN_ERR__TRACED);
+    }
+  return SVN_NO_ERROR;
+
+#endif
+}
+
+
+svn_error_t *
 svn_error_compose_create(svn_error_t *err1,
                          svn_error_t *err2)
 {

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c Wed May 16 20:32:43 2012
@@ -332,7 +332,6 @@ password_get_gpg_agent(svn_boolean_t *do
 
   /* Create the CACHE_ID which will be generated based on REALMSTRING similar
      to other password caching mechanisms. */
-  digest = svn_checksum_create(svn_checksum_md5, pool);
   svn_checksum(&digest, svn_checksum_md5, realmstring, strlen(realmstring),
                pool);
   cache_id = svn_checksum_to_cstring(digest, pool);
@@ -413,12 +412,11 @@ simple_gpg_agent_first_creds(void **cred
                              const char *realmstring,
                              apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton, provider_baton,
-                                             parameters, realmstring,
-                                             password_get_gpg_agent,
-                                             SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials, iter_baton,
+                                          provider_baton, parameters,
+                                          realmstring, password_get_gpg_agent,
+                                          SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
+                                          pool);
 }
 
 
@@ -431,12 +429,11 @@ simple_gpg_agent_save_creds(svn_boolean_
                             const char *realmstring,
                             apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton, parameters,
-                                            realmstring,
-                                            password_set_gpg_agent,
-                                            SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials,
+                                          provider_baton, parameters,
+                                          realmstring, password_set_gpg_agent,
+                                          SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
+                                          pool);
 }
 
 

Propchange: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/hash.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/hash.c Wed May 16 20:32:43 2012
@@ -40,6 +40,7 @@
 #include "svn_pools.h"
 
 #include "private/svn_dep_compat.h"
+#include "private/svn_subr_private.h"
 
 #include "svn_private_config.h"
 
@@ -237,7 +238,7 @@ hash_write(apr_hash_t *hash, apr_hash_t 
                                 valstr->len));
       len = valstr->len;
       SVN_ERR(svn_stream_write(stream, valstr->data, &len));
-      SVN_ERR(svn_stream_printf(stream, subpool, "\n"));
+      SVN_ERR(svn_stream_puts(stream, "\n"));
     }
 
   if (oldhash)
@@ -495,7 +496,7 @@ svn_hash_from_cstring_keys(apr_hash_t **
                            apr_pool_t *pool)
 {
   int i;
-  apr_hash_t *hash = apr_hash_make(pool);
+  apr_hash_t *hash = svn_hash__make(pool);
   for (i = 0; i < keys->nelts; i++)
     {
       const char *key =
@@ -560,3 +561,130 @@ svn_hash__get_bool(apr_hash_t *hash, con
   return default_value;
 }
 
+
+
+/*** Optimized hash functions ***/
+
+/* Optimized version of apr_hashfunc_default. It assumes that the CPU has
+ * 32-bit multiplications with high throughput of at least 1 operation
+ * every 3 cycles. Latency is not an issue. Another optimization is a
+ * mildly unrolled main loop.
+ */
+static unsigned int
+hashfunc_compatible(const char *char_key, apr_ssize_t *klen)
+{
+    unsigned int hash = 0;
+    const unsigned char *key = (const unsigned char *)char_key;
+    const unsigned char *p;
+    apr_ssize_t i;
+
+    if (*klen == APR_HASH_KEY_STRING)
+      {
+        for (p = key; ; p+=4)
+          {
+            unsigned int new_hash = hash * 33 * 33 * 33 * 33;
+            if (!p[0]) break;
+            new_hash += p[0] * 33 * 33 * 33;
+            if (!p[1]) break;
+            new_hash += p[1] * 33 * 33;
+            if (!p[2]) break;
+            new_hash += p[2] * 33;
+            if (!p[3]) break;
+            hash = new_hash + p[3];
+          }
+        for (; *p; p++)
+            hash = hash * 33 + *p;
+
+        *klen = p - key;
+      }
+    else
+      {
+        for (p = key, i = *klen; i >= 4; i-=4, p+=4)
+          {
+            hash = hash * 33 * 33 * 33 * 33
+                 + p[0] * 33 * 33 * 33
+                 + p[1] * 33 * 33
+                 + p[2] * 33
+                 + p[3];
+          }
+        for (; i; i--, p++)
+            hash = hash * 33 + *p;
+      }
+
+    return hash;
+}
+
+/* Used to detect NUL chars 
+ */
+#define LOWER_7BITS_SET 0x7f7f7f7f
+#define BIT_7_SET       0x80808080
+
+/* Read 4 bytes at P. LE / BE interpretation is platform-dependent
+ */
+#if SVN_UNALIGNED_ACCESS_IS_OK
+#  define READ_CHUNK(p) *(const apr_uint32_t *)(p)
+#else
+#  define READ_CHUNK(p) \
+     (   (apr_uint32_t)p[0]        \
+      + ((apr_uint32_t)p[1] << 8)  \
+      + ((apr_uint32_t)p[2] << 16) \
+      + ((apr_uint32_t)p[3] << 24))
+#endif
+
+/* Similar to the previous but operates on 4 bytes at once instead of the
+ * classic unroll. This is particularly fast when unaligned access is
+ * supported.
+ */
+static unsigned int
+hashfunc_fast(const char *char_key, apr_ssize_t *klen)
+{
+    unsigned int hash = 0;
+    const unsigned char *key = (const unsigned char *)char_key;
+    const unsigned char *p;
+    apr_ssize_t i;
+    apr_uint32_t chunk, test;
+
+    if (*klen == APR_HASH_KEY_STRING)
+      {
+        for (p = key; ; p += sizeof(chunk))
+          {
+            /* This is a variant of the well-known strlen test: */
+            chunk = READ_CHUNK(p);
+            test = chunk | ((chunk & LOWER_7BITS_SET) + LOWER_7BITS_SET);
+            if ((test & BIT_7_SET) != BIT_7_SET)
+              break;
+
+            hash = (hash + chunk) * 0xd1f3da69;
+          }
+        for (; *p; p++)
+            hash = hash * 33 + *p;
+
+        *klen = p - key;
+      }
+    else
+      {
+        for ( p = key, i = *klen
+            ; i >= sizeof(chunk)
+            ; i -= sizeof(chunk), p += sizeof(chunk))
+          {
+            chunk = READ_CHUNK(p);
+            hash = (hash + chunk) * 0xd1f3da69;
+          }
+        for (; i; i--, p++)
+            hash = hash * 33 + *p;
+      }
+
+    return hash;
+}
+
+apr_hash_t *
+svn_hash__make(apr_pool_t *pool)
+{
+  return apr_hash_make_custom(pool, hashfunc_compatible);
+}
+
+apr_hash_t *
+svn_hash__make_fast(apr_pool_t *pool)
+{
+  return apr_hash_make_custom(pool, hashfunc_fast);
+}

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/io.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/io.c Wed May 16 20:32:43 2012
@@ -65,6 +65,7 @@
 
 #include "private/svn_atomic.h"
 #include "private/svn_io_private.h"
+#include "private/svn_subr_private.h"
 
 #define SVN_SLEEP_ENV_VAR "SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS"
 
@@ -168,6 +169,41 @@ cstring_from_utf8(const char **path_apr,
 #endif
 }
 
+/* Helper function that allows to convert an APR-level PATH to something
+ * that we can pass the svn_error_wrap_apr. Since we use it in context
+ * of error reporting, having *some* path info may be more useful than
+ * having none.  Therefore, we use a best effort approach here.
+ *
+ * This is different from svn_io_file_name_get in that it uses a different
+ * signature style and will never fail.
+ */
+static const char *
+try_utf8_from_internal_style(const char *path, apr_pool_t *pool)
+{
+  svn_error_t *error;
+  const char *path_utf8;
+
+  /* Special case. */
+  if (path == NULL)
+    return "(NULL)";
+  
+  /* (try to) convert PATH to UTF-8. If that fails, continue with the plain
+   * PATH because it is the best we have. It may actually be UTF-8 already.
+   */
+  error = cstring_to_utf8(&path_utf8, path, pool);
+  if (error)
+    {
+      /* fallback to best representation we have */
+
+      svn_error_clear(error);
+      path_utf8 = path;
+    }
+
+  /* Toggle (back-)slashes etc. as necessary.
+   */
+  return svn_dirent_local_style(path_utf8, pool);
+}
+
 
 /* Set *NAME_P to the UTF-8 representation of directory entry NAME.
  * NAME is in the internal encoding used by APR; PARENT is in
@@ -851,10 +887,10 @@ file_perms_set(const char *fname, apr_fi
 
 /* Set permissions PERMS on the FILE. This is a cheaper variant of the
  * file_perms_set wrapper() function because no locale-dependent string
- * conversion is required.
+ * conversion is required. POOL will be used for allocations.
  */
 static svn_error_t *
-file_perms_set2(apr_file_t* file, apr_fileperms_t perms)
+file_perms_set2(apr_file_t* file, apr_fileperms_t perms, apr_pool_t *pool)
 {
   const char *fname_apr;
   apr_status_t status;
@@ -866,7 +902,7 @@ file_perms_set2(apr_file_t* file, apr_fi
   status = apr_file_perms_set(fname_apr, perms);
   if (status)
     return svn_error_wrap_apr(status, _("Can't set permissions on '%s'"),
-                              fname_apr);
+                              try_utf8_from_internal_style(fname_apr, pool));
   else
     return SVN_NO_ERROR;
 }
@@ -1866,29 +1902,25 @@ file_clear_locks(void *arg)
 #endif
 
 svn_error_t *
-svn_io_file_lock2(const char *lock_file,
-                  svn_boolean_t exclusive,
-                  svn_boolean_t nonblocking,
-                  apr_pool_t *pool)
+svn_io_lock_open_file(apr_file_t *lockfile_handle,
+                      svn_boolean_t exclusive,
+                      svn_boolean_t nonblocking,
+                      apr_pool_t *pool)
 {
   int locktype = APR_FLOCK_SHARED;
-  apr_file_t *lockfile_handle;
-  apr_int32_t flags;
   apr_status_t apr_err;
+  const char *fname;
 
   if (exclusive)
     locktype = APR_FLOCK_EXCLUSIVE;
-
-  flags = APR_READ;
-  if (locktype == APR_FLOCK_EXCLUSIVE)
-    flags |= APR_WRITE;
-
   if (nonblocking)
     locktype |= APR_FLOCK_NONBLOCK;
 
-  SVN_ERR(svn_io_file_open(&lockfile_handle, lock_file, flags,
-                           APR_OS_DEFAULT,
-                           pool));
+  /* We need this only in case of an error but this is cheap to get -
+   * so we do it here for clarity. */
+  apr_err = apr_file_name_get(&fname, lockfile_handle);
+  if (apr_err)
+    return svn_error_wrap_apr(apr_err, _("Can't get file name"));
 
   /* Get lock on the filehandle. */
   apr_err = apr_file_lock(lockfile_handle, locktype);
@@ -1915,11 +1947,11 @@ svn_io_file_lock2(const char *lock_file,
         case APR_FLOCK_SHARED:
           return svn_error_wrap_apr(apr_err,
                                     _("Can't get shared lock on file '%s'"),
-                                    svn_dirent_local_style(lock_file, pool));
+                                    try_utf8_from_internal_style(fname, pool));
         case APR_FLOCK_EXCLUSIVE:
           return svn_error_wrap_apr(apr_err,
                                     _("Can't get exclusive lock on file '%s'"),
-                                    svn_dirent_local_style(lock_file, pool));
+                                    try_utf8_from_internal_style(fname, pool));
         default:
           SVN_ERR_MALFUNCTION();
         }
@@ -1936,6 +1968,62 @@ svn_io_file_lock2(const char *lock_file,
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_io_unlock_open_file(apr_file_t *lockfile_handle,
+                        apr_pool_t *pool)
+{
+  const char *fname;
+  apr_status_t apr_err;
+
+  /* We need this only in case of an error but this is cheap to get -
+   * so we do it here for clarity. */
+  apr_err = apr_file_name_get(&fname, lockfile_handle);
+  if (apr_err)
+    return svn_error_wrap_apr(apr_err, _("Can't get file name"));
+
+  /* The actual unlock attempt. */
+  apr_err = apr_file_unlock(lockfile_handle);
+  if (apr_err)
+    return svn_error_wrap_apr(apr_err, _("Can't unlock file '%s'"),
+                              try_utf8_from_internal_style(fname, pool));
+  
+/* On Windows and OS/2 file locks are automatically released when
+   the file handle closes */
+#if !defined(WIN32) && !defined(__OS2__)
+  apr_pool_cleanup_kill(pool, lockfile_handle, file_clear_locks);
+#endif
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_io_file_lock2(const char *lock_file,
+                  svn_boolean_t exclusive,
+                  svn_boolean_t nonblocking,
+                  apr_pool_t *pool)
+{
+  int locktype = APR_FLOCK_SHARED;
+  apr_file_t *lockfile_handle;
+  apr_int32_t flags;
+
+  if (exclusive)
+    locktype = APR_FLOCK_EXCLUSIVE;
+
+  flags = APR_READ;
+  if (locktype == APR_FLOCK_EXCLUSIVE)
+    flags |= APR_WRITE;
+
+  if (nonblocking)
+    locktype |= APR_FLOCK_NONBLOCK;
+
+  SVN_ERR(svn_io_file_open(&lockfile_handle, lock_file, flags,
+                           APR_OS_DEFAULT,
+                           pool));
+
+  /* Get lock on the filehandle. */
+  return svn_io_lock_open_file(lockfile_handle, exclusive, nonblocking, pool);
+}
+
 
 
 /* Data consistency/coherency operations. */
@@ -2302,7 +2390,7 @@ svn_io_get_dirents3(apr_hash_t **dirents
   if (!only_check_type)
     flags |= APR_FINFO_SIZE | APR_FINFO_MTIME;
 
-  *dirents = apr_hash_make(result_pool);
+  *dirents = svn_hash__make(result_pool);
 
   SVN_ERR(svn_io_dir_open(&this_dir, path, scratch_pool));
 
@@ -3080,7 +3168,7 @@ do_io_file_wrapper_cleanup(apr_file_t *f
 
   if (name)
     return svn_error_wrap_apr(status, _(msg),
-                              svn_dirent_local_style(name, pool));
+                              try_utf8_from_internal_style(name, pool));
   else
     return svn_error_wrap_apr(status, "%s", _(msg_no_name));
 }
@@ -4245,7 +4333,7 @@ svn_io_open_unique_file3(apr_file_t **fi
   if (!using_system_temp_dir)
     {
       SVN_ERR(merge_default_file_perms(tempfile, &perms, scratch_pool));
-      SVN_ERR(file_perms_set2(tempfile, perms));
+      SVN_ERR(file_perms_set2(tempfile, perms, scratch_pool));
     }
 #endif
 

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/lock.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/lock.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/lock.c Wed May 16 20:32:43 2012
@@ -54,8 +54,7 @@ svn_lock_dup(const svn_lock_t *lock, apr
   new_l->path = apr_pstrdup(pool, new_l->path);
   new_l->token = apr_pstrdup(pool, new_l->token);
   new_l->owner = apr_pstrdup(pool, new_l->owner);
-  if (new_l->comment)
-    new_l->comment = apr_pstrdup(pool, new_l->comment);
+  new_l->comment = apr_pstrdup(pool, new_l->comment);
 
   return new_l;
 }

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/macos_keychain.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/macos_keychain.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/macos_keychain.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/macos_keychain.c Wed May 16 20:32:43 2012
@@ -160,14 +160,14 @@ keychain_simple_first_creds(void **crede
                             const char *realmstring,
                             apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton,
-                                             provider_baton,
-                                             parameters,
-                                             realmstring,
-                                             keychain_password_get,
-                                             SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials,
+                                          iter_baton,
+                                          provider_baton,
+                                          parameters,
+                                          realmstring,
+                                          keychain_password_get,
+                                          SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                          pool);
 }
 
 /* Save encrypted credentials to the simple provider's cache. */
@@ -179,13 +179,13 @@ keychain_simple_save_creds(svn_boolean_t
                            const char *realmstring,
                            apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton,
-                                            parameters,
-                                            realmstring,
-                                            keychain_password_set,
-                                            SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials,
+                                          provider_baton,
+                                          parameters,
+                                          realmstring,
+                                          keychain_password_set,
+                                          SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                          pool);
 }
 
 static const svn_auth_provider_t keychain_simple_provider = {
@@ -205,13 +205,12 @@ keychain_ssl_client_cert_pw_first_creds(
                                         const char *realmstring,
                                         apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_first_creds_helper
-           (credentials,
-            iter_baton, provider_baton,
-            parameters, realmstring,
-            keychain_password_get,
-            SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_get(credentials,
+                                                iter_baton, provider_baton,
+                                                parameters, realmstring,
+                                                keychain_password_get,
+                                                SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                                pool);
 }
 
 /* Save encrypted credentials to the ssl client cert password provider's
@@ -224,13 +223,12 @@ keychain_ssl_client_cert_pw_save_creds(s
                                        const char *realmstring,
                                        apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_save_creds_helper
-           (saved, credentials,
-            provider_baton, parameters,
-            realmstring,
-            keychain_password_set,
-            SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_set(saved, credentials,
+                                                provider_baton, parameters,
+                                                realmstring,
+                                                keychain_password_set,
+                                                SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                                pool);
 }
 
 static const svn_auth_provider_t keychain_ssl_client_cert_pw_provider = {

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c Wed May 16 20:32:43 2012
@@ -615,7 +615,7 @@ static svn_error_t *
 parse_revision_line(const char **input, const char *end, svn_mergeinfo_t hash,
                     apr_pool_t *scratch_pool)
 {
-  const char *pathname;
+  const char *pathname = "";
   apr_array_header_t *existing_rangelist;
   apr_array_header_t *rangelist = apr_array_make(scratch_pool, 1,
                                                  sizeof(svn_merge_range_t *));

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/path.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/path.c Wed May 16 20:32:43 2012
@@ -399,8 +399,8 @@ svn_path_compare_paths(const char *path1
   apr_size_t min_len = ((path1_len < path2_len) ? path1_len : path2_len);
   apr_size_t i = 0;
 
-  assert(is_canonical(path1, strlen(path1)));
-  assert(is_canonical(path2, strlen(path2)));
+  assert(is_canonical(path1, path1_len));
+  assert(is_canonical(path2, path2_len));
 
   /* Skip past common prefix. */
   while (i < min_len && path1[i] == path2[i])

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/pool.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/pool.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/pool.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/pool.c Wed May 16 20:32:43 2012
@@ -28,6 +28,7 @@
 
 #include <apr_general.h>
 #include <apr_pools.h>
+#include <apr_thread_mutex.h>
 
 #include "svn_pools.h"
 
@@ -97,3 +98,44 @@ svn_pool_create_ex(apr_pool_t *pool, apr
 }
 
 #endif /* APR_POOL_DEBUG */
+
+apr_allocator_t *
+svn_pool_create_allocator(svn_boolean_t thread_safe)
+{
+  apr_allocator_t *allocator;
+  apr_pool_t *pool;
+
+  /* create the allocator and limit it's internal free list to keep
+   * memory usage in check */
+
+  if (apr_allocator_create(&allocator))
+    abort_on_pool_failure(EXIT_FAILURE);
+
+  apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
+
+  /* create the root pool */
+
+  pool = svn_pool_create_ex(NULL, allocator);
+  apr_allocator_owner_set(allocator, pool);
+
+#if APR_POOL_DEBUG
+  apr_pool_tag (pool, "svn root pool");
+#endif
+
+  /* By default, allocators are *not* thread-safe. We must provide a mutex
+   * if we want thread-safety for that mutex. */
+
+#if APR_HAS_THREADS
+  if (thread_safe)
+    {
+      apr_thread_mutex_t *mutex;
+      apr_thread_mutex_create (&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
+      apr_allocator_mutex_set (allocator, mutex);
+    }
+#endif
+
+  /* better safe than sorry */
+  SVN_ERR_ASSERT_NO_RETURN(allocator != NULL);
+
+  return allocator;
+}

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/properties.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/properties.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/properties.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/properties.c Wed May 16 20:32:43 2012
@@ -62,31 +62,42 @@ svn_prop_has_svn_prop(const apr_hash_t *
 }
 
 
+#define SIZEOF_WC_PREFIX (sizeof(SVN_PROP_WC_PREFIX) - 1)
+#define SIZEOF_ENTRY_PREFIX (sizeof(SVN_PROP_ENTRY_PREFIX) - 1)
+
+svn_prop_kind_t
+svn_property_kind2(const char *prop_name)
+{
+
+  if (strncmp(prop_name, SVN_PROP_WC_PREFIX, SIZEOF_WC_PREFIX) == 0)
+    return svn_prop_wc_kind;
+
+  if (strncmp(prop_name, SVN_PROP_ENTRY_PREFIX, SIZEOF_ENTRY_PREFIX) == 0)
+    return svn_prop_entry_kind;
+
+  return svn_prop_regular_kind;
+}
+
+
+/* NOTE: this function is deprecated, but we cannot move it to deprecated.c
+   because we need the SIZEOF_*_PREFIX constant symbols defined above.  */
 svn_prop_kind_t
 svn_property_kind(int *prefix_len,
                   const char *prop_name)
 {
-  apr_size_t wc_prefix_len = sizeof(SVN_PROP_WC_PREFIX) - 1;
-  apr_size_t entry_prefix_len = sizeof(SVN_PROP_ENTRY_PREFIX) - 1;
+  svn_prop_kind_t kind = svn_property_kind2(prop_name);
 
-  if (strncmp(prop_name, SVN_PROP_WC_PREFIX, wc_prefix_len) == 0)
-    {
-      if (prefix_len)
-        *prefix_len = (int) wc_prefix_len;
-      return svn_prop_wc_kind;
-    }
-
-  if (strncmp(prop_name, SVN_PROP_ENTRY_PREFIX, entry_prefix_len) == 0)
+  if (prefix_len)
     {
-      if (prefix_len)
-        *prefix_len = (int) entry_prefix_len;
-      return svn_prop_entry_kind;
+      if (kind == svn_prop_wc_kind)
+        *prefix_len = SIZEOF_WC_PREFIX;
+      else if (kind == svn_prop_entry_kind)
+        *prefix_len = SIZEOF_ENTRY_PREFIX;
+      else
+        *prefix_len = 0;
     }
 
-  /* else... */
-  if (prefix_len)
-    *prefix_len = 0;
-  return svn_prop_regular_kind;
+  return kind;
 }
 
 
@@ -111,7 +122,7 @@ svn_categorize_props(const apr_array_hea
       enum svn_prop_kind kind;
 
       prop = &APR_ARRAY_IDX(proplist, i, svn_prop_t);
-      kind = svn_property_kind(NULL, prop->name);
+      kind = svn_property_kind2(prop->name);
       newprop = NULL;
 
       if (kind == svn_prop_regular_kind)
@@ -294,7 +305,7 @@ svn_prop_hash_dup(apr_hash_t *hash,
       void *prop;
 
       apr_hash_this(hi, &key, &klen, &prop);
-      apr_hash_set(new_hash, apr_pstrdup(pool, key), klen,
+      apr_hash_set(new_hash, apr_pstrmemdup(pool, key, klen), klen,
                    svn_string_dup(prop, pool));
     }
   return new_hash;

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/simple_providers.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/simple_providers.c Wed May 16 20:32:43 2012
@@ -127,20 +127,16 @@ simple_username_get(const char **usernam
   return FALSE;
 }
 
-/* Common implementation for simple_first_creds. Uses PARAMETERS, REALMSTRING
-   and the simple auth provider's username and password cache to fill a set of
-   CREDENTIALS. PASSWORD_GET is used to obtain the password value.
-   PASSTYPE identifies the type of the cached password. CREDENTIALS are
-   allocated from POOL. */
+
 svn_error_t *
-svn_auth__simple_first_creds_helper(void **credentials,
-                                    void **iter_baton,
-                                    void *provider_baton,
-                                    apr_hash_t *parameters,
-                                    const char *realmstring,
-                                    svn_auth__password_get_t password_get,
-                                    const char *passtype,
-                                    apr_pool_t *pool)
+svn_auth__simple_creds_cache_get(void **credentials,
+                                 void **iter_baton,
+                                 void *provider_baton,
+                                 apr_hash_t *parameters,
+                                 const char *realmstring,
+                                 svn_auth__password_get_t password_get,
+                                 const char *passtype,
+                                 apr_pool_t *pool)
 {
   const char *config_dir = apr_hash_get(parameters,
                                         SVN_AUTH_PARAM_CONFIG_DIR,
@@ -307,19 +303,15 @@ svn_auth__simple_first_creds_helper(void
 }
 
 
-/* Common implementation for simple_save_creds. Uses PARAMETERS and
-   REALMSTRING to save a set of CREDENTIALS to the simple auth provider's
-   username and password cache. PASSWORD_SET is used to store the password.
-   PASSTYPE identifies the type of the cached password. Allocates from POOL. */
 svn_error_t *
-svn_auth__simple_save_creds_helper(svn_boolean_t *saved,
-                                   void *credentials,
-                                   void *provider_baton,
-                                   apr_hash_t *parameters,
-                                   const char *realmstring,
-                                   svn_auth__password_set_t password_set,
-                                   const char *passtype,
-                                   apr_pool_t *pool)
+svn_auth__simple_creds_cache_set(svn_boolean_t *saved,
+                                 void *credentials,
+                                 void *provider_baton,
+                                 apr_hash_t *parameters,
+                                 const char *realmstring,
+                                 svn_auth__password_set_t password_set,
+                                 const char *passtype,
+                                 apr_pool_t *pool)
 {
   svn_auth_cred_simple_t *creds = credentials;
   apr_hash_t *creds_hash = NULL;
@@ -501,14 +493,12 @@ simple_first_creds(void **credentials,
                    const char *realmstring,
                    apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton,
-                                             provider_baton,
-                                             parameters,
-                                             realmstring,
-                                             svn_auth__simple_password_get,
-                                             SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials, iter_baton,
+                                          provider_baton, parameters,
+                                          realmstring,
+                                          svn_auth__simple_password_get,
+                                          SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                          pool);
 }
 
 /* Save (unencrypted) credentials to the simple provider's cache. */
@@ -520,13 +510,11 @@ simple_save_creds(svn_boolean_t *saved,
                   const char *realmstring,
                   apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton,
-                                            parameters,
-                                            realmstring,
-                                            svn_auth__simple_password_set,
-                                            SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials, provider_baton,
+                                          parameters, realmstring,
+                                          svn_auth__simple_password_set,
+                                          SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                          pool);
 }
 
 static const svn_auth_provider_t simple_provider = {

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c Wed May 16 20:32:43 2012
@@ -24,6 +24,8 @@
 #include "svn_string.h"
 #include "svn_error.h"
 #include "private/svn_skel.h"
+#include "private/svn_string_private.h"
+#include "private/svn_subr_private.h"
 
 
 /* Parsing skeletons.  */
@@ -582,9 +584,10 @@ void svn_skel__prepend_int(apr_int64_t v
                            svn_skel_t *skel,
                            apr_pool_t *result_pool)
 {
-  const char *str = apr_psprintf(result_pool, "%" APR_INT64_T_FMT, value);
+  char *val_string = apr_palloc(result_pool, SVN_INT64_BUFFER_SIZE);
+  svn__i64toa(val_string, value);
 
-  svn_skel__prepend_str(str, skel, result_pool);
+  svn_skel__prepend_str(val_string, skel, result_pool);
 }
 
 
@@ -678,7 +681,7 @@ svn_skel__parse_proplist(apr_hash_t **pr
     return skel_err("proplist");
 
   /* Create the returned structure */
-  proplist = apr_hash_make(pool);
+  proplist = svn_hash__make(pool);
   for (elt = skel->children; elt; elt = elt->next->next)
     {
       svn_string_t *value = svn_string_ncreate(elt->next->data,

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/spillbuf.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/spillbuf.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/spillbuf.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/spillbuf.c Wed May 16 20:32:43 2012
@@ -184,8 +184,14 @@ svn_spillbuf__write(svn_spillbuf_t *buf,
      in memory.  */
   if (buf->spill != NULL)
     {
-      /* NOTE: we assume the file position is at the END. The caller should
-         ensure this, so that we will append.  */
+      apr_off_t output_unused = 0;  /* ### stupid API  */
+
+      /* Seek to the end of the spill file. We don't know if a read has
+         occurred since our last write, and moved the file position.  */
+      SVN_ERR(svn_io_file_seek(buf->spill,
+                               APR_END, &output_unused,
+                               scratch_pool));
+
       SVN_ERR(svn_io_file_write_full(buf->spill, data, len,
                                      NULL, scratch_pool));
       buf->spill_size += len;
@@ -305,8 +311,10 @@ read_data(struct memblock_t **mem,
   /* Did we consume all the data from the spill file?  */
   if ((buf->spill_size -= (*mem)->size) == 0)
     {
+      /* Close and reset our spill file information.  */
       SVN_ERR(svn_io_file_close(buf->spill, scratch_pool));
       buf->spill = NULL;
+      buf->spill_start = 0;
     }
 
   /* *mem has been initialized. Done.  */
@@ -579,7 +587,8 @@ write_handler_spillbuf(void *baton, cons
 {
   struct spillbuf_baton *sb = baton;
 
-  SVN_ERR(svn_spillbuf__reader_write(sb->reader, data, *len, sb->scratch_pool));
+  SVN_ERR(svn_spillbuf__reader_write(sb->reader, data, *len,
+                                     sb->scratch_pool));
 
   svn_pool_clear(sb->scratch_pool);
   return SVN_NO_ERROR;
@@ -592,7 +601,7 @@ svn_stream__from_spillbuf(apr_size_t blo
                           apr_pool_t *result_pool)
 {
   svn_stream_t *stream;
-  struct spillbuf_baton *sb = apr_pcalloc(result_pool, sizeof(*sb));
+  struct spillbuf_baton *sb = apr_palloc(result_pool, sizeof(*sb));
 
   sb->reader = svn_spillbuf__reader_create(blocksize, maxsize, result_pool);
   sb->scratch_pool = svn_pool_create(result_pool);
@@ -602,6 +611,5 @@ svn_stream__from_spillbuf(apr_size_t blo
   svn_stream_set_read(stream, read_handler_spillbuf);
   svn_stream_set_write(stream, write_handler_spillbuf);
 
-
   return stream;
 }

Propchange: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/spillbuf.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/sqlite.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/sqlite.c Wed May 16 20:32:43 2012
@@ -300,7 +300,13 @@ vbindf(svn_sqlite__stmt_t *stmt, const c
                                           va_arg(ap, const char *)));
             break;
 
+          case 'd':
+            SVN_ERR(svn_sqlite__bind_int(stmt, count,
+                                         va_arg(ap, int)));
+            break;
+
           case 'i':
+          case 'L':
             SVN_ERR(svn_sqlite__bind_int64(stmt, count,
                                            va_arg(ap, apr_int64_t)));
             break;
@@ -718,8 +724,23 @@ close_apr(void *data)
   for (i = 0; i < db->nbr_statements; i++)
     {
       if (db->prepared_stmts[i])
-        err = svn_error_compose_create(
+        {
+          if (db->prepared_stmts[i]->needs_reset)
+            {
+#ifdef SVN_DEBUG
+              const char *stmt_text = db->statement_strings[i];
+              stmt_text = stmt_text; /* Provide value for debugger */
+
+              SVN_ERR_MALFUNCTION_NO_RETURN();
+#else
+              err = svn_error_compose_create(
+                            err,
+                            svn_sqlite__reset(db->prepared_stmts[i]));
+#endif
+            }
+          err = svn_error_compose_create(
                         svn_sqlite__finalize(db->prepared_stmts[i]), err);
+        }
     }
 
   result = sqlite3_close(db->db3);

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/ssl_client_cert_pw_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/ssl_client_cert_pw_providers.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/ssl_client_cert_pw_providers.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/ssl_client_cert_pw_providers.c Wed May 16 20:32:43 2012
@@ -104,15 +104,14 @@ svn_auth__ssl_client_cert_pw_set(svn_boo
 }
 
 svn_error_t *
-svn_auth__ssl_client_cert_pw_file_first_creds_helper
-  (void **credentials_p,
-   void **iter_baton,
-   void *provider_baton,
-   apr_hash_t *parameters,
-   const char *realmstring,
-   svn_auth__password_get_t passphrase_get,
-   const char *passtype,
-   apr_pool_t *pool)
+svn_auth__ssl_client_cert_pw_cache_get(void **credentials_p,
+                                       void **iter_baton,
+                                       void *provider_baton,
+                                       apr_hash_t *parameters,
+                                       const char *realmstring,
+                                       svn_auth__password_get_t passphrase_get,
+                                       const char *passtype,
+                                       apr_pool_t *pool)
 {
   svn_config_t *cfg = apr_hash_get(parameters,
                                    SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS,
@@ -166,15 +165,14 @@ svn_auth__ssl_client_cert_pw_file_first_
 
 
 svn_error_t *
-svn_auth__ssl_client_cert_pw_file_save_creds_helper
-  (svn_boolean_t *saved,
-   void *credentials,
-   void *provider_baton,
-   apr_hash_t *parameters,
-   const char *realmstring,
-   svn_auth__password_set_t passphrase_set,
-   const char *passtype,
-   apr_pool_t *pool)
+svn_auth__ssl_client_cert_pw_cache_set(svn_boolean_t *saved,
+                                       void *credentials,
+                                       void *provider_baton,
+                                       apr_hash_t *parameters,
+                                       const char *realmstring,
+                                       svn_auth__password_set_t passphrase_set,
+                                       const char *passtype,
+                                       apr_pool_t *pool)
 {
   svn_auth_cred_ssl_client_cert_pw_t *creds = credentials;
   apr_hash_t *creds_hash = NULL;
@@ -348,15 +346,12 @@ ssl_client_cert_pw_file_first_credential
                                           const char *realmstring,
                                           apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_first_creds_helper
-           (credentials_p,
-            iter_baton,
-            provider_baton,
-            parameters,
-            realmstring,
-            svn_auth__ssl_client_cert_pw_get,
-            SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_get(credentials_p, iter_baton,
+                                                provider_baton, parameters,
+                                                realmstring,
+                                                svn_auth__ssl_client_cert_pw_get,
+                                                SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                                pool);
 }
 
 
@@ -370,14 +365,13 @@ ssl_client_cert_pw_file_save_credentials
                                          const char *realmstring,
                                          apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_save_creds_helper
-           (saved, credentials,
-            provider_baton,
-            parameters,
-            realmstring,
-            svn_auth__ssl_client_cert_pw_set,
-            SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_set(saved, credentials,
+                                                provider_baton,
+                                                parameters,
+                                                realmstring,
+                                                svn_auth__ssl_client_cert_pw_set,
+                                                SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                                pool);
 }
 
 

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/stream.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/stream.c Wed May 16 20:32:43 2012
@@ -140,7 +140,7 @@ svn_error_t *
 svn_stream_read(svn_stream_t *stream, char *buffer, apr_size_t *len)
 {
   SVN_ERR_ASSERT(stream->read_fn != NULL);
-  return stream->read_fn(stream->baton, buffer, len);
+  return svn_error_trace(stream->read_fn(stream->baton, buffer, len));
 }
 
 
@@ -148,9 +148,10 @@ svn_error_t *
 svn_stream_skip(svn_stream_t *stream, apr_size_t len)
 {
   if (stream->skip_fn == NULL)
-    return skip_default_handler(stream->baton, len, stream->read_fn);
+    return svn_error_trace(
+            skip_default_handler(stream->baton, len, stream->read_fn));
 
-  return stream->skip_fn(stream->baton, len);
+  return svn_error_trace(stream->skip_fn(stream->baton, len));
 }
 
 
@@ -158,7 +159,7 @@ svn_error_t *
 svn_stream_write(svn_stream_t *stream, const char *data, apr_size_t *len)
 {
   SVN_ERR_ASSERT(stream->write_fn != NULL);
-  return stream->write_fn(stream->baton, data, len);
+  return svn_error_trace(stream->write_fn(stream->baton, data, len));
 }
 
 
@@ -182,7 +183,7 @@ svn_stream_mark(svn_stream_t *stream, sv
   if (stream->mark_fn == NULL)
     return svn_error_create(SVN_ERR_STREAM_SEEK_NOT_SUPPORTED, NULL, NULL);
 
-  return stream->mark_fn(stream->baton, mark, pool);
+  return svn_error_trace(stream->mark_fn(stream->baton, mark, pool));
 }
 
 svn_error_t *
@@ -191,7 +192,7 @@ svn_stream_seek(svn_stream_t *stream, co
   if (stream->seek_fn == NULL)
     return svn_error_create(SVN_ERR_STREAM_SEEK_NOT_SUPPORTED, NULL, NULL);
 
-  return stream->seek_fn(stream->baton, mark);
+  return svn_error_trace(stream->seek_fn(stream->baton, mark));
 }
 
 svn_boolean_t
@@ -208,9 +209,17 @@ svn_stream_close(svn_stream_t *stream)
 {
   if (stream->close_fn == NULL)
     return SVN_NO_ERROR;
-  return stream->close_fn(stream->baton);
+  return svn_error_trace(stream->close_fn(stream->baton));
 }
 
+svn_error_t *
+svn_stream_puts(svn_stream_t *stream,
+                const char *str)
+{
+  apr_size_t len;
+  len = strlen(str);
+  return svn_error_trace(svn_stream_write(stream, str, &len));
+}
 
 svn_error_t *
 svn_stream_printf(svn_stream_t *stream,
@@ -220,14 +229,12 @@ svn_stream_printf(svn_stream_t *stream,
 {
   const char *message;
   va_list ap;
-  apr_size_t len;
 
   va_start(ap, fmt);
   message = apr_pvsprintf(pool, fmt, ap);
   va_end(ap);
 
-  len = strlen(message);
-  return svn_stream_write(stream, message, &len);
+  return svn_error_trace(svn_stream_puts(stream, message));
 }
 
 
@@ -240,7 +247,6 @@ svn_stream_printf_from_utf8(svn_stream_t
 {
   const char *message, *translated;
   va_list ap;
-  apr_size_t len;
 
   va_start(ap, fmt);
   message = apr_pvsprintf(pool, fmt, ap);
@@ -249,9 +255,7 @@ svn_stream_printf_from_utf8(svn_stream_t
   SVN_ERR(svn_utf_cstring_from_utf8_ex2(&translated, message, encoding,
                                         pool));
 
-  len = strlen(translated);
-
-  return svn_stream_write(stream, translated, &len);
+  return svn_error_trace(svn_stream_puts(stream, translated));
 }
 
 /* Size that 90% of the lines we encounter will be not longer than.
@@ -411,7 +415,7 @@ stream_readline_chunky(svn_stringbuf_t *
   /* Move the stream read pointer to the first position behind the EOL.
    */
   SVN_ERR(svn_stream_seek(stream, mark));
-  return svn_stream_skip(stream, total_parsed);
+  return svn_error_trace(svn_stream_skip(stream, total_parsed));
 }
 
 /* Guts of svn_stream_readline().
@@ -680,31 +684,31 @@ svn_stream_tee(svn_stream_t *out1,
 static svn_error_t *
 read_handler_disown(void *baton, char *buffer, apr_size_t *len)
 {
-  return svn_stream_read(baton, buffer, len);
+  return svn_error_trace(svn_stream_read(baton, buffer, len));
 }
 
 static svn_error_t *
 skip_handler_disown(void *baton, apr_size_t len)
 {
-  return svn_stream_skip(baton, len);
+  return svn_error_trace(svn_stream_skip(baton, len));
 }
 
 static svn_error_t *
 write_handler_disown(void *baton, const char *buffer, apr_size_t *len)
 {
-  return svn_stream_write(baton, buffer, len);
+  return svn_error_trace(svn_stream_write(baton, buffer, len));
 }
 
 static svn_error_t *
 mark_handler_disown(void *baton, svn_stream_mark_t **mark, apr_pool_t *pool)
 {
-  return svn_stream_mark(baton, mark, pool);
+  return svn_error_trace(svn_stream_mark(baton, mark, pool));
 }
 
 static svn_error_t *
 seek_handler_disown(void *baton, const svn_stream_mark_t *mark)
 {
-  return svn_stream_seek(baton, mark);
+  return svn_error_trace(svn_stream_seek(baton, mark));
 }
 
 static svn_boolean_t
@@ -765,7 +769,7 @@ read_handler_apr(void *baton, char *buff
     err = svn_io_file_read_full2(btn->file, buffer, *len, len,
                                  &eof, btn->pool);
 
-  return err;
+  return svn_error_trace(err);
 }
 
 static svn_error_t *
@@ -774,7 +778,8 @@ skip_handler_apr(void *baton, apr_size_t
   struct baton_apr *btn = baton;
   apr_off_t offset = len;
 
-  return svn_io_file_seek(btn->file, APR_CUR, &offset, btn->pool);
+  return svn_error_trace(
+            svn_io_file_seek(btn->file, APR_CUR, &offset, btn->pool));
 }
 
 static svn_error_t *
@@ -792,7 +797,7 @@ write_handler_apr(void *baton, const cha
   else
     err = svn_io_file_write_full(btn->file, data, *len, len, btn->pool);
 
-  return err;
+  return svn_error_trace(err);
 }
 
 static svn_error_t *
@@ -800,7 +805,7 @@ close_handler_apr(void *baton)
 {
   struct baton_apr *btn = baton;
 
-  return svn_io_file_close(btn->file, btn->pool);
+  return svn_error_trace(svn_io_file_close(btn->file, btn->pool));
 }
 
 static svn_error_t *
@@ -1127,7 +1132,7 @@ close_handler_gz(void *baton)
     }
 
   if (btn->close != NULL)
-    return btn->close(btn->subbaton);
+    return svn_error_trace(btn->close(btn->subbaton));
   else
     return SVN_NO_ERROR;
 }
@@ -1202,7 +1207,7 @@ write_handler_checksum(void *baton, cons
   if (btn->write_checksum && *len > 0)
     SVN_ERR(svn_checksum_update(btn->write_ctx, buffer, *len));
 
-  return svn_stream_write(btn->proxy, buffer, len);
+  return svn_error_trace(svn_stream_write(btn->proxy, buffer, len));
 }
 
 
@@ -1231,7 +1236,7 @@ close_handler_checksum(void *baton)
   if (btn->write_ctx)
     SVN_ERR(svn_checksum_final(btn->write_checksum, btn->write_ctx, btn->pool));
 
-  return svn_stream_close(btn->proxy);
+  return svn_error_trace(svn_stream_close(btn->proxy));
 }
 
 
@@ -1287,21 +1292,21 @@ static svn_error_t *
 read_handler_md5(void *baton, char *buffer, apr_size_t *len)
 {
   struct md5_stream_baton *btn = baton;
-  return svn_stream_read(btn->proxy, buffer, len);
+  return svn_error_trace(svn_stream_read(btn->proxy, buffer, len));
 }
 
 static svn_error_t *
 skip_handler_md5(void *baton, apr_size_t len)
 {
   struct md5_stream_baton *btn = baton;
-  return svn_stream_skip(btn->proxy, len);
+  return svn_error_trace(svn_stream_skip(btn->proxy, len));
 }
 
 static svn_error_t *
 write_handler_md5(void *baton, const char *buffer, apr_size_t *len)
 {
   struct md5_stream_baton *btn = baton;
-  return svn_stream_write(btn->proxy, buffer, len);
+  return svn_error_trace(svn_stream_write(btn->proxy, buffer, len));
 }
 
 static svn_error_t *
@@ -1656,3 +1661,147 @@ svn_stream_buffered(apr_pool_t *result_p
   return svn_stream__from_spillbuf(BUFFER_BLOCK_SIZE, BUFFER_MAX_SIZE,
                                    result_pool);
 }
+
+
+
+/*** Lazyopen Streams ***/
+
+/* Custom baton for lazyopen-style wrapper streams. */
+typedef struct lazyopen_baton_t {
+
+  /* Callback function and baton for opening the wrapped stream. */
+  svn_stream_lazyopen_func_t open_func;
+  void *open_baton;
+
+  /* The wrapped stream, or NULL if the stream hasn't yet been
+     opened. */
+  svn_stream_t *real_stream;
+  apr_pool_t *pool;
+
+} lazyopen_baton_t;
+
+
+/* Use B->open_func/baton to create and set B->real_stream iff it
+   isn't already set. */
+static svn_error_t *
+lazyopen_if_unopened(lazyopen_baton_t *b)
+{
+  if (b->real_stream == NULL)
+    {
+      svn_stream_t *stream;
+      apr_pool_t *scratch_pool = svn_pool_create(b->pool);
+
+      SVN_ERR(b->open_func(&stream, b->open_baton,
+                           b->pool, scratch_pool));
+
+      svn_pool_destroy(scratch_pool);
+
+      b->real_stream = stream;
+    }
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_read_fn_t */
+static svn_error_t *
+read_handler_lazyopen(void *baton,
+                      char *buffer,
+                      apr_size_t *len)
+{
+  lazyopen_baton_t *b = baton;
+
+  SVN_ERR(lazyopen_if_unopened(b));
+  SVN_ERR(svn_stream_read(b->real_stream, buffer, len));
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_stream_skip_fn_t */
+static svn_error_t *
+skip_handler_lazyopen(void *baton,
+                      apr_size_t len)
+{
+  lazyopen_baton_t *b = baton;
+
+  SVN_ERR(lazyopen_if_unopened(b));
+  SVN_ERR(svn_stream_skip(b->real_stream, len));
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_write_fn_t */
+static svn_error_t *
+write_handler_lazyopen(void *baton,
+                       const char *data,
+                       apr_size_t *len)
+{
+  lazyopen_baton_t *b = baton;
+
+  SVN_ERR(lazyopen_if_unopened(b));
+  SVN_ERR(svn_stream_write(b->real_stream, data, len));
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_close_fn_t */
+static svn_error_t *
+close_handler_lazyopen(void *baton)
+{
+  lazyopen_baton_t *b = baton;
+
+  if (b->real_stream != NULL)
+    SVN_ERR(svn_stream_close(b->real_stream));
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_stream_mark_fn_t */
+static svn_error_t *
+mark_handler_lazyopen(void *baton,
+                      svn_stream_mark_t **mark,
+                      apr_pool_t *pool)
+{
+  lazyopen_baton_t *b = baton;
+
+  SVN_ERR(lazyopen_if_unopened(b));
+  SVN_ERR(svn_stream_mark(b->real_stream, mark, pool));
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_stream_seek_fn_t */
+static svn_error_t *
+seek_handler_lazyopen(void *baton,
+                      const svn_stream_mark_t *mark)
+{
+  lazyopen_baton_t *b = baton;
+
+  SVN_ERR(lazyopen_if_unopened(b));
+  SVN_ERR(svn_stream_seek(b->real_stream, mark));
+
+  return SVN_NO_ERROR;
+}
+
+svn_stream_t *
+svn_stream_lazyopen_create(svn_stream_lazyopen_func_t open_func,
+                           void *open_baton,
+                           apr_pool_t *result_pool)
+{
+  lazyopen_baton_t *lob = apr_pcalloc(result_pool, sizeof(*lob));
+  svn_stream_t *stream;
+
+  lob->open_func = open_func;
+  lob->open_baton = open_baton;
+  lob->real_stream = NULL;
+  lob->pool = result_pool;
+
+  stream = svn_stream_create(lob, result_pool);
+  svn_stream_set_read(stream, read_handler_lazyopen);
+  svn_stream_set_skip(stream, skip_handler_lazyopen);
+  svn_stream_set_write(stream, write_handler_lazyopen);
+  svn_stream_set_close(stream, close_handler_lazyopen);
+  svn_stream_set_mark(stream, mark_handler_lazyopen);
+  svn_stream_set_seek(stream, seek_handler_lazyopen);
+  
+  return stream;
+}

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/time.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/time.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/time.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/time.c Wed May 16 20:32:43 2012
@@ -116,14 +116,14 @@ svn_time_to_cstring(apr_time_t when, apr
 }
 
 
-static int
+static apr_int32_t
 find_matching_string(char *str, apr_size_t size, const char strings[][4])
 {
   apr_size_t i;
 
   for (i = 0; i < size; i++)
     if (strings[i] && (strcmp(str, strings[i]) == 0))
-      return i;
+      return (apr_int32_t) i;
 
   return -1;
 }
@@ -140,19 +140,19 @@ svn_time_from_cstring(apr_time_t *when, 
   /* Open-code parsing of the new timestamp format, as this
      is a hot path for reading the entries file.  This format looks
      like:  "2001-08-31T04:24:14.966996Z"  */
-  exploded_time.tm_year = strtol(data, &c, 10);
+  exploded_time.tm_year = (apr_int32_t) strtol(data, &c, 10);
   if (*c++ != '-') goto fail;
-  exploded_time.tm_mon = strtol(c, &c, 10);
+  exploded_time.tm_mon = (apr_int32_t) strtol(c, &c, 10);
   if (*c++ != '-') goto fail;
-  exploded_time.tm_mday = strtol(c, &c, 10);
+  exploded_time.tm_mday = (apr_int32_t) strtol(c, &c, 10);
   if (*c++ != 'T') goto fail;
-  exploded_time.tm_hour = strtol(c, &c, 10);
+  exploded_time.tm_hour = (apr_int32_t) strtol(c, &c, 10);
   if (*c++ != ':') goto fail;
-  exploded_time.tm_min = strtol(c, &c, 10);
+  exploded_time.tm_min = (apr_int32_t) strtol(c, &c, 10);
   if (*c++ != ':') goto fail;
-  exploded_time.tm_sec = strtol(c, &c, 10);
+  exploded_time.tm_sec = (apr_int32_t) strtol(c, &c, 10);
   if (*c++ != '.') goto fail;
-  exploded_time.tm_usec = strtol(c, &c, 10);
+  exploded_time.tm_usec = (apr_int32_t) strtol(c, &c, 10);
   if (*c++ != 'Z') goto fail;
 
   exploded_time.tm_year  -= 1900;

Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/win32_crashrpt.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/win32_crashrpt.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/win32_crashrpt.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/win32_crashrpt.c Wed May 16 20:32:43 2012
@@ -257,10 +257,10 @@ format_basic_type(char *buf, DWORD basic
   switch(length)
     {
       case 1:
-        sprintf(buf, "%x", *(unsigned char *)address);
+        sprintf(buf, "0x%02x", (int)*(unsigned char *)address);
         break;
       case 2:
-        sprintf(buf, "%x", *(unsigned short *)address);
+        sprintf(buf, "0x%04x", (int)*(unsigned short *)address);
         break;
       case 4:
         switch(basic_type)
@@ -270,7 +270,7 @@ format_basic_type(char *buf, DWORD basic
                 if (!IsBadStringPtr(*(PSTR*)address, 32))
                   sprintf(buf, "\"%.31s\"", *(unsigned long *)address);
                 else
-                  sprintf(buf, "%x", *(unsigned long *)address);
+                  sprintf(buf, "0x%08x", (int)*(unsigned long *)address);
               }
             case 6:  /* btInt */
               sprintf(buf, "%d", *(int *)address);
@@ -279,7 +279,7 @@ format_basic_type(char *buf, DWORD basic
               sprintf(buf, "%f", *(float *)address);
               break;
             default:
-              sprintf(buf, "%x", *(unsigned long *)address);
+              sprintf(buf, "0x%08x", *(unsigned long *)address);
               break;
           }
         break;
@@ -287,7 +287,10 @@ format_basic_type(char *buf, DWORD basic
         if (basic_type == 8) /* btFloat */
           sprintf(buf, "%lf", *(double *)address);
         else
-          sprintf(buf, "%I64X", *(unsigned __int64 *)address);
+          sprintf(buf, "0x%016I64X", *(unsigned __int64 *)address);
+        break;
+      default:
+        sprintf(buf, "[unhandled type 0x%08x of length 0x%08x]", basic_type, length);
         break;
     }
 }
@@ -336,6 +339,8 @@ format_value(char *value_str, DWORD64 mo
 
               free(type_name);
             }
+          else
+            sprintf(value_str, "[no symbol tag]");
         }
         break;
       case 16: /* SymTagBaseType */
@@ -369,7 +374,9 @@ format_value(char *value_str, DWORD64 mo
       case 13: /* SymTagFunctionType */
           sprintf(value_str, "0x%08x", *(DWORD *)value_addr);
           break;
-      default: break;
+      default:
+          sprintf(value_str, "[unhandled tag: 0x%08x]", tag);
+          break;
     }
 }