C. Michael Pilato wrote:
> Julian Foad <julianfoad@btopenworld.com> writes:
>
>>Index: subversion/mod_dav_svn/deadprops.c
>>===================================================================
>>--- subversion/mod_dav_svn/deadprops.c (revision 13967)
>>+++ subversion/mod_dav_svn/deadprops.c (working copy)
>>@@ -286,8 +286,7 @@ static dav_error *dav_svn_db_output_valu
>> across the wire. */
>> if (! svn_xml_is_xml_safe(propval->data, propval->len))
>> {
>>- propval = (svn_string_t *)svn_base64_encode_string(propval, pool);
>>- xml_safe = propval->data;
>>+ xml_safe = svn_base64_encode_string(propval, pool)->data;
>
> Personal preference: I *really* dislike FUNCTION->MEMBER syntax in C
> code.
Fair point. Although it's hard to state the reasons, my intuition tells me
that you are right now that you have mentioned it.
(We've only got about six instances of it in all our C code so far:
subversion/libsvn_wc/update_editor.c:1622:
= (svn_base64_from_md5 (digest, pool))->data;
subversion/libsvn_wc/adm_crawler.c:794:
= (svn_base64_from_md5 (tb_digest, pool))->data;
subversion/mod_dav_svn/update.c:784:
qval = svn_base64_encode_string(value, pool)->data;
subversion/libsvn_ra_dav/util.c:710:
code = ne_get_status(req)->code;
subversion/libsvn_fs_fs/fs_fs.c:2683:
svn_fs_fs__id_unparse (id, pool)->data);
subversion/libsvn_fs_fs/fs_fs.c:2838:
idstr = svn_fs_fs__id_unparse (change->node_rev_id, pool)->data;
)
The attached version of the patch introduces a temporary variable instead.
- Julian
Eliminate three poor type casts.
* subversion/mod_dav_svn/deadprops.c
(dav_svn_db_output_value, dav_svn_db_store): Don't cast away "const".
* subversion/mod_dav_svn/version.c
(send_get_locations_report): Don't cast away "const".
Index: subversion/mod_dav_svn/deadprops.c
===================================================================
--- subversion/mod_dav_svn/deadprops.c (revision 13994)
+++ subversion/mod_dav_svn/deadprops.c (working copy)
@@ -286,8 +286,9 @@ static dav_error *dav_svn_db_output_valu
across the wire. */
if (! svn_xml_is_xml_safe(propval->data, propval->len))
{
- propval = (svn_string_t *)svn_base64_encode_string(propval, pool);
- xml_safe = propval->data;
+ const svn_string_t *enc_propval
+ = svn_base64_encode_string(propval, pool);
+ xml_safe = enc_propval->data;
encoding = apr_pstrcat(pool, " V:encoding=\"base64\"", NULL);
}
else
@@ -325,7 +326,7 @@ static dav_error *dav_svn_db_store(dav_d
const apr_xml_elem *elem,
dav_namespace_map *mapping)
{
- svn_string_t *propval;
+ const svn_string_t *propval;
apr_pool_t *pool = db->p;
apr_xml_attr *attr = elem->attr;
@@ -347,7 +348,7 @@ static dav_error *dav_svn_db_store(dav_d
/* Handle known encodings here. */
if (enc_type && (strcmp (enc_type, "base64") == 0))
- propval = (svn_string_t *)svn_base64_decode_string(propval, pool);
+ propval = svn_base64_decode_string(propval, pool);
else
return dav_new_error (pool, HTTP_INTERNAL_SERVER_ERROR, 0,
"Unknown property encoding");
Index: subversion/mod_dav_svn/version.c
===================================================================
--- subversion/mod_dav_svn/version.c (revision 13994)
+++ subversion/mod_dav_svn/version.c (working copy)
@@ -1206,7 +1206,7 @@ static apr_status_t send_get_locations_r
path_quoted = apr_xml_quote_string(pool, value, 1);
apr_err = ap_fprintf(output, bb, "<S:location "
"rev=\"%ld\" path=\"%s\"/>" DEBUG_CR,
- *(svn_revnum_t *)key, path_quoted);
+ *(const svn_revnum_t *)key, path_quoted);
if (apr_err)
return apr_err;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 7 01:09:10 2005