You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Justin Erenkrantz <ju...@erenkrantz.com> on 2004/05/04 18:42:05 UTC

Compile error in ra_svn was Re: 1.0.2 build error on AIX 4.3.2, 4.3.3, 5.1, 5.2

--On Monday, May 3, 2004 3:48 PM -0500 Albert Chin 
<su...@mlists.thewrittenword.com> wrote:

> Is the patch below acceptable? The prototype for apr_md5_final() is:
>   apr_status_t apr_md5_final(unsigned char digest[16],
>                              apr_md5_ctx_t *context);
> and digest is of type 'char *':
>   static void compute_digest(char *digest, const char *challenge,
>                              const char *password)
>
> The main reason for the problem is the addition of -qHALT=E to CFLAGS
> by apr/build/apr_hints.m4. This causes a compiler failure on these
> errors while otherwise the compiler would not fail.

FWIW, I get the same error with Sun's C compiler.  And, I have the same 
patch applied locally as well.  However, I think we brought this up before 
and GregH didn't seem overly enthusiastic for anyone to commit it.

*shrug*  -- justin

> --- subversion/libsvn_ra_svn/cram.c.orig	Mon May  3 15:42:00 2004
> +++ subversion/libsvn_ra_svn/cram.c	Mon May  3 15:42:08 2004
> @@ -96,13 +96,13 @@
>    apr_md5_init(&ctx);
>    apr_md5_update(&ctx, secret, sizeof(secret));
>    apr_md5_update(&ctx, challenge, strlen(challenge));
> -  apr_md5_final(digest, &ctx);
> +  apr_md5_final((unsigned char *)digest, &ctx);
>    for (i = 0; i < sizeof(secret); i++)
>      secret[i] ^= (0x36 ^ 0x5c);
>    apr_md5_init(&ctx);
>    apr_md5_update(&ctx, secret, sizeof(secret));
>    apr_md5_update(&ctx, digest, APR_MD5_DIGESTSIZE);
> -  apr_md5_final(digest, &ctx);
> +  apr_md5_final((unsigned char *)digest, &ctx);
>  }
>
>  /* Fail the authentication, from the server's perspective. */
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Compile error in ra_svn was Re: 1.0.2 build error on AIX 4.3.2, 4.3.3, 5.1, 5.2

Posted by Albert Chin <su...@mlists.thewrittenword.com>.
On Fri, May 14, 2004 at 01:32:51PM -0500, Albert Chin wrote:
> On Tue, May 04, 2004 at 03:22:04PM -0400, Greg Hudson wrote:
> > On Tue, 2004-05-04 at 14:42, Justin Erenkrantz wrote:
> > > FWIW, I get the same error with Sun's C compiler.  And, I have the same 
> > > patch applied locally as well.  However, I think we brought this up before 
> > > and GregH didn't seem overly enthusiastic for anyone to commit it.
> > 
> > I thought this was taken care of in r8343.  I guess not.
> > 
> > At any rate, I'd appreciate if people would put a little more effort
> > into getting the variable declarations right rather than just bashing
> > stuff with casts.  Let me know if this patch works:
> 
> Your patch works. I also had to apply the following patch to work
> around the same issue. This patch simply works around the issue
> though. read_handler_gz() should be of type svn_read_fn_t which is:
>   typedef svn_error_t *(*svn_read_fn_t) (void *baton,
>                                          char *buffer,
>                                          apr_size_t *len);
> 
> Should *all* functions that are of type svn_error_t accept 'unsigned
> char' as the second argument? Ditto for write_handler_gz() and:
>   typedef svn_error_t *(*svn_write_fn_t) (void *baton,
>                                           const char *data,
>                                           apr_size_t *len);

Scratch that patch. I spoke too soon. So how do I solve this problem?
The problem is the following in read_handler_gz():
  btn->in->next_out = buffer;

buffer is 'char *'. btn->in->next_out is 'unsigned char *'.

-- 
albert chin (china@thewrittenword.com)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Compile error in ra_svn was Re: 1.0.2 build error on AIX 4.3.2, 4.3.3, 5.1, 5.2

Posted by Albert Chin <su...@mlists.thewrittenword.com>.
On Tue, May 04, 2004 at 03:22:04PM -0400, Greg Hudson wrote:
> On Tue, 2004-05-04 at 14:42, Justin Erenkrantz wrote:
> > FWIW, I get the same error with Sun's C compiler.  And, I have the same 
> > patch applied locally as well.  However, I think we brought this up before 
> > and GregH didn't seem overly enthusiastic for anyone to commit it.
> 
> I thought this was taken care of in r8343.  I guess not.
> 
> At any rate, I'd appreciate if people would put a little more effort
> into getting the variable declarations right rather than just bashing
> stuff with casts.  Let me know if this patch works:

Your patch works. I also had to apply the following patch to work
around the same issue. This patch simply works around the issue
though. read_handler_gz() should be of type svn_read_fn_t which is:
  typedef svn_error_t *(*svn_read_fn_t) (void *baton,
                                         char *buffer,
                                         apr_size_t *len);

Should *all* functions that are of type svn_error_t accept 'unsigned
char' as the second argument? Ditto for write_handler_gz() and:
  typedef svn_error_t *(*svn_write_fn_t) (void *baton,
                                          const char *data,
                                          apr_size_t *len);

--- subversion/libsvn_subr/stream.c.orig	Fri May 14 12:48:05 2004
+++ subversion/libsvn_subr/stream.c	Fri May 14 12:48:28 2004
@@ -385,7 +385,7 @@
 
 /* Handle reading from a compressed stream */
 static svn_error_t *
-read_handler_gz (void *baton, char *buffer, apr_size_t *len)
+read_handler_gz (void *baton, unsigned char *buffer, apr_size_t *len)
 {
   struct zbaton *btn = baton;
   int zerr;
@@ -433,7 +433,7 @@
 
 /* Compress data and write it to the substream */
 static svn_error_t *
-write_handler_gz (void *baton, const char *buffer, apr_size_t *len)
+write_handler_gz (void *baton, const unsigned char *buffer, apr_size_t *len)
 {
   struct zbaton *btn = baton;
   apr_pool_t *subpool;
@@ -458,7 +458,7 @@
   subpool = svn_pool_create (btn->pool);
   write_buf = apr_palloc (subpool, buf_size);
   
-  btn->out->next_in = (char *) buffer;
+  btn->out->next_in = (unsigned char *) buffer;
   btn->out->avail_in = *len;
   
   while (btn->out->avail_in > 0)

-- 
albert chin (china@thewrittenword.com)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Compile error in ra_svn was Re: 1.0.2 build error on AIX 4.3.2, 4.3.3, 5.1, 5.2

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2004-05-04 at 14:42, Justin Erenkrantz wrote:
> FWIW, I get the same error with Sun's C compiler.  And, I have the same 
> patch applied locally as well.  However, I think we brought this up before 
> and GregH didn't seem overly enthusiastic for anyone to commit it.

I thought this was taken care of in r8343.  I guess not.

At any rate, I'd appreciate if people would put a little more effort
into getting the variable declarations right rather than just bashing
stuff with casts.  Let me know if this patch works:

Index: subversion/libsvn_ra_svn/cram.c
===================================================================
--- subversion/libsvn_ra_svn/cram.c     (revision 9618)
+++ subversion/libsvn_ra_svn/cram.c     (working copy)
@@ -49,7 +49,7 @@
   return (v < 10) ? '0' + v : 'a' + (v - 10);
 }
 
-static svn_boolean_t hex_decode(char *hashval, const char *hexval)
+static svn_boolean_t hex_decode(unsigned char *hashval, const char *hexval)
 {
   int i, h1, h2;
 
@@ -75,7 +75,7 @@
     }
 }
 
-static void compute_digest(char *digest, const char *challenge,
+static void compute_digest(unsigned char *digest, const char *challenge,
                            const char *password)
 {
   unsigned char secret[64];
@@ -134,7 +134,7 @@
   apr_status_t status;
   apr_uint64_t nonce;
   char hostbuf[APRMAXHOSTLEN + 1];
-  char cdigest[APR_MD5_DIGESTSIZE], sdigest[APR_MD5_DIGESTSIZE];
+  unsigned char cdigest[APR_MD5_DIGESTSIZE], sdigest[APR_MD5_DIGESTSIZE];
   const char *challenge, *sep, *password;
   svn_ra_svn_item_t *item;
   svn_string_t *resp;


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org