Hi,
In <200510151724.j9FHO4J08094@morbius.ch.collab.net>
"svn commit: r16735 - in trunk/subversion: libsvn_subr libsvn_wc" on Sat, 15 Oct 2005 12:24:04 -0500,
djames@tigris.org wrote:
> Author: djames
> Date: Sat Oct 15 12:24:04 2005
> New Revision: 16735
> Modified: trunk/subversion/libsvn_subr/constructors.c
I found some bugs of svn_string_hash_dup().
> +/**
> + * Duplicate a @a hash containing (char * -> svn_string_t *) key/value
> + * pairs using @a pool.
> + */
> +static apr_hash_t *
> +svn_string_hash_dup (apr_hash_t *hash, apr_pool_t *pool)
> +{
> + apr_hash_index_t *hi;
> + const char *key;
> + apr_ssize_t klen;
> + svn_string_t *val;
> + apr_hash_t *new_hash = apr_hash_make (pool);
> + for (hi = apr_hash_first (pool, hash); hi; hi = apr_hash_next (hi) )
> + {
> + apr_hash_this (hi, (const void *) &key, &klen, (void *) &val);
Compiler says a warning. 'key' should be casted to 'const void
**'.
> + key = apr_pstrdup (pool, key);
> + val = svn_string_dup (val, pool);
> + apr_hash_set (hash, key, klen, val);
'hash' must be 'new_hash'.
> + }
> + return new_hash;
> +}
Thanks,
--
kou
Index: subversion/libsvn_subr/constructors.c
===================================================================
--- subversion/libsvn_subr/constructors.c (revision 16742)
+++ subversion/libsvn_subr/constructors.c (working copy)
@@ -106,10 +106,10 @@
apr_hash_t *new_hash = apr_hash_make (pool);
for (hi = apr_hash_first (pool, hash); hi; hi = apr_hash_next (hi) )
{
- apr_hash_this (hi, (const void *) &key, &klen, (void *) &val);
+ apr_hash_this (hi, (const void **) &key, &klen, (void *) &val);
key = apr_pstrdup (pool, key);
val = svn_string_dup (val, pool);
- apr_hash_set (hash, key, klen, val);
+ apr_hash_set (new_hash, key, klen, val);
}
return new_hash;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 16 09:29:30 2005