You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Julian Foad <ju...@btopenworld.com> on 2004/11/16 00:09:40 UTC
[PATCH] Remove unnecessary casting away of "const"
See subject line and log message within patch.
- Julian
Re: [PATCH] Remove unnecessary casting away of "const"
Posted by Joe Orton <jo...@redhat.com>.
On Tue, Nov 16, 2004 at 04:58:34AM -0500, Jeff Trawick wrote:
> On Tue, 16 Nov 2004 07:02:47 +0000, Joe Orton <jo...@redhat.com> wrote:
> > On Mon, Nov 15, 2004 at 11:09:40PM +0000, Julian Foad wrote:
> > > Remove unnecessary type casts that were casting away "const".
> > > No functional change.
> >
> > These ones aren't unnecessary, some compilers are more picky about
> > implicit signed char * -> unsigned char * conversion, so this will
> > introduce warnings (or possibly errors) with some compilers.
...
> except that apr_md5_update was changed to accept "const void *" and
> handle required char signed-ness internally to avoid bothering callers
> with this sort of nonsense; the missing piece seems to be to remove
> those casts; ACK?
Ah sorry, I missed that. I'll commit this then when the SVN repos comes
back online.
joe
Re: [PATCH] Remove unnecessary casting away of "const"
Posted by Jeff Trawick <tr...@gmail.com>.
On Tue, 16 Nov 2004 07:02:47 +0000, Joe Orton <jo...@redhat.com> wrote:
> On Mon, Nov 15, 2004 at 11:09:40PM +0000, Julian Foad wrote:
> > Remove unnecessary type casts that were casting away "const".
> > No functional change.
>
> These ones aren't unnecessary, some compilers are more picky about
> implicit signed char * -> unsigned char * conversion, so this will
> introduce warnings (or possibly errors) with some compilers.
>
> > * apr-util/crypto/apr_md5.c
> > (apr_md5_encode): Remove some type casts.
> >
> > Index: apr-util/crypto/apr_md5.c
> > ===================================================================
> > --- apr-util/crypto/apr_md5.c (revision 65585)
> > +++ apr-util/crypto/apr_md5.c (working copy)
> > @@ -536,25 +536,25 @@ APU_DECLARE(apr_status_t) apr_md5_encode
> > /*
> > * The password first, since that is what is most unknown
> > */
> > - apr_md5_update(&ctx, (unsigned char *)pw, strlen(pw));
> > + apr_md5_update(&ctx, pw, strlen(pw));
except that apr_md5_update was changed to accept "const void *" and
handle required char signed-ness internally to avoid bothering callers
with this sort of nonsense; the missing piece seems to be to remove
those casts; ACK?
APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context,
const void *_input,
apr_size_t inputLen)
{
const unsigned char *input = _input;
http://cvs.apache.org/viewcvs.cgi/apr-util/crypto/apr_md5.c?r1=1.3&r2=1.4&diff_format=h
Re: [PATCH] Remove unnecessary casting away of "const"
Posted by Joe Orton <jo...@redhat.com>.
On Mon, Nov 15, 2004 at 11:09:40PM +0000, Julian Foad wrote:
> Remove unnecessary type casts that were casting away "const".
> No functional change.
These ones aren't unnecessary, some compilers are more picky about
implicit signed char * -> unsigned char * conversion, so this will
introduce warnings (or possibly errors) with some compilers.
> * apr-util/crypto/apr_md5.c
> (apr_md5_encode): Remove some type casts.
>
> Index: apr-util/crypto/apr_md5.c
> ===================================================================
> --- apr-util/crypto/apr_md5.c (revision 65585)
> +++ apr-util/crypto/apr_md5.c (working copy)
> @@ -536,25 +536,25 @@ APU_DECLARE(apr_status_t) apr_md5_encode
> /*
> * The password first, since that is what is most unknown
> */
> - apr_md5_update(&ctx, (unsigned char *)pw, strlen(pw));
> + apr_md5_update(&ctx, pw, strlen(pw));
...