axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alastair FETTES" <afet...@mdacorporation.com>
Subject [Axis2C] Casting away const
Date Wed, 09 Jan 2008 22:43:17 GMT
Axis2C Developers:

There seems to be a fundamental problem with functions that return
values of type axis2_chart_t*.  We have only investigated a couple of
them but it appears that const values are being casted away in some
instances.  Please view the following example:

<snippet>
AXIS2_EXTERN 
axis2_char_t*
axiom_attribute_get_value(
    axiom_attribute_t * attribute,
    const axutil_env_t * env)
{
    if (attribute->value)
    {
        return (axis2_char_t *)
axutil_string_get_buffer(attribute->value, env);
    }
    return NULL;
}
</snippet>

Note that the return value of axiom_attribute_get_value is a NON-const
axis2_char_t*.  Note the cast on the return value of function
axutil_string_get_buffer.  Here is the declaration of
axutil_string_get_buffer.

<snippet>
AXIS2_EXTERN 
const axis2_char_t*
axutil_string_get_buffer(
    const struct axutil_string *string,
    const axutil_env_t * env);
</snippet>

Note that the return value is a CONST axis2_char_t*. The const attribute
of this pointer is being removed via the cast.

Is this expected functionality?  If not I suggest you research all
functions that return axis2_char_t*.

Regards.

Alastair Fettes

This e-mail and any attachments are intended solely for the use of the
intended recipient(s) and may contain legally privileged, proprietary
and/or confidential information.  Any use, disclosure, dissemination,
distribution or copying of this e-mail and any attachments for any
purposes that have not been specifically authorized by the sender is
strictly prohibited.  If you are not the intended recipient, please
immediately notify the sender by reply e-mail and permanently delete all
copies and attachments.

The entire content of this e-mail is for "information purposes" only and
should not be relied upon by the recipient in any way unless otherwise
confirmed in writing by way of letter or facsimile. 


Mime
View raw message