On Sun, Dec 03, 2000 at 02:39:02AM -0600, Sam TH wrote:
> Here are a number of fixes to get Subversion to compile on BeOS PPC.
> It still doesn't work, but that's another email. Two patches still
> need to be committed to APR,
Looks like Ryan is offline, so I'll go and commit the isascii fix. I'm not
sure on the include header stuff, though, so I'm going to pass that one up.
> and I'll provide a Neon patch in about 30
> seconds.
>
>
> --include-deps removes the gcc dependency generation command, which
> other compilers understandably don't like.
I think we're going to need a different solution.
>...
> These fixes are all casts, since the MetroWorks compiler is quite
> strict about this sort of thing.
Needing a cast invariably means that something *else* is wrong. Adding a
cast is a almost always band-aid which does not solve the underlying
problem.
That said: your patch points out where some problems exist, and we can solve
those properly.
>...
> --- subversion/libsvn_delta/svndiff.c 2000/11/22 23:48:53 1.9
> +++ subversion/libsvn_delta/svndiff.c 2000/12/03 08:31:46
> @@ -79,7 +79,7 @@
> *p++ = ((val >> (n * 7)) & 0x7f) | cont;
> }
>
> - return p;
> + return (char *)p;
> }
I changed the type of p to "char *".
> @@ -89,7 +89,7 @@
> {
> char buf[128], *p;
>
> - p = encode_int (buf, val);
> + p = encode_int ((unsigned char *)buf, val);
Not needed, now that the prototype is "char *"
>...
> @@ -139,10 +139,10 @@
> if (op->length >> 6 == 0)
> *ip++ |= op->length;
> else
> - ip = encode_int (ip + 1, op->length);
> + ip = (unsigned char *)encode_int (ip + 1, op->length);
> if (op->action_code != svn_txdelta_new)
> - ip = encode_int (ip, op->offset);
> - svn_string_appendbytes (instructions, ibuf, ip - ibuf);
> + ip = (unsigned char *)encode_int (ip, op->offset);
> + svn_string_appendbytes (instructions, (const char *)ibuf, ip - ibuf);
I removed the "unsigned" from ibuf and ip.
>...
> --- subversion/libsvn_subr/base64.c 2000/11/26 15:13:13 1.8
> +++ subversion/libsvn_subr/base64.c 2000/12/03 08:31:59
> @@ -76,7 +76,7 @@
> memcpy (inbuf + *inbuflen, p, 3 - *inbuflen);
> p += (3 - *inbuflen);
> encode_group (inbuf, group);
> - svn_string_appendbytes (str, group, 4);
> + svn_string_appendbytes (str, (const char *)group, 4);
> *inbuflen = 0;
> *linelen += 4;
> if (*linelen == BASE64_LINELEN)
> @@ -106,7 +106,7 @@
> memset (ingroup + len, 0, 3 - len);
> encode_group (ingroup, outgroup);
> memset (outgroup + (len + 1), '=', 4 - (len + 1));
> - svn_string_appendbytes (str, outgroup, 4);
> + svn_string_appendbytes (str, (const char *)outgroup, 4);
Now that is just a dumb compiler if it is complaining about those. "char *"
can legally be passed to a "const char *" function. The other possibility is
that it doesn't think that "char foo[]" is compatible with "char *foo" --
again, a big problem with the compiler.
[ I believe both of those issues are consider "standard C" and we shouldn't
"have" to cast. ]
Which of the two problems is the compiler talking about? const or [] ?
I considered changing the lines to something like &group[0]. I don't like
it, but that is the form to get a "char *" from a "char []".
>...
> @@ -127,7 +127,7 @@
> if (*len > 0)
> encode_bytes (encoded, data, *len, eb->buf, &eb->buflen, &eb->linelen);
> else
> - encode_partial_group (encoded, eb->buf, eb->buflen, eb->linelen);
> + encode_partial_group (encoded, (const char *)eb->buf, eb->buflen, eb->linelen);
>
> /* Write the output, clean up, go home. */
> enclen = encoded->len;
> @@ -170,7 +170,7 @@
> int ingrouplen = 0, linelen = 0;
>
> encode_bytes (encoded, str->data, str->len, ingroup, &ingrouplen, &linelen);
> - encode_partial_group (encoded, ingroup, ingrouplen, linelen);
> + encode_partial_group (encoded, (const char *)ingroup, ingrouplen, linelen);
I've done a bit of tweaking with "unsigned" char declarations. It has
probably resolved some of the problems, but possibly introduced another
warning related to encode_bytes.
>...
> @@ -222,8 +222,8 @@
> if (*inbuflen >= 2)
> {
> memset (inbuf + *inbuflen, 0, 4 - *inbuflen);
> - decode_group (inbuf, group);
> - svn_string_appendbytes (str, group, *inbuflen - 1);
> + decode_group ((const unsigned char *)inbuf, group);
> + svn_string_appendbytes (str, (const char *)group, *inbuflen - 1);
> }
> *done = TRUE;
> }
> @@ -234,8 +234,8 @@
> inbuf[(*inbuflen)++] = find - base64tab;
> if (*inbuflen == 4)
> {
> - decode_group (inbuf, group);
> - svn_string_appendbytes (str, group, 3);
> + decode_group ((const unsigned char *)inbuf, group);
> + svn_string_appendbytes (str, (const char *)group, 3);
I've done some more rationalizing of signed vs unsigned chars.
>...
> --- subversion/libsvn_subr/hashdump.c 2000/11/22 23:49:16 1.18
> +++ subversion/libsvn_subr/hashdump.c 2000/12/03 08:32:15
> @@ -218,7 +218,7 @@
> {
> /* Read a key length line. Might be END, though. */
> int len = SVN_KEYLINE_MAXLEN;
> - err = read_length_line (srcfile, buf, &len);
> + err = read_length_line (srcfile, buf, (unsigned long *)&len);
> if ((err == APR_EOF) && first_time)
> /* We got an EOF on our very first attempt to read, which
> means it's a zero-byte file. No problem, just go home. */
> @@ -254,7 +254,7 @@
>
> /* Read a val length line */
> len = SVN_KEYLINE_MAXLEN;
> - err = read_length_line (srcfile, buf, &len);
> + err = read_length_line (srcfile, buf, (unsigned long *)&len);
The read_length_line() prototype was changed from size_t to apr_size_t. The
"len" variable was declared wrong, and should have been apr_size_t rather
than "int. I also tossed the repeated use of SVN_KEYLINE_MAXLEN and replaced
them with sizeof(buf) [in case the buf decl changes, the len= lines will
automatically compensate]
>..
> --- subversion/libsvn_delta/tests/vdelta-test.c 2000/11/22 23:48:55 1.4
> +++ subversion/libsvn_delta/tests/vdelta-test.c 2000/12/03 08:31:46
> @@ -15,6 +15,7 @@
> #include <stdio.h>
> #include <string.h>
> #include <apr_general.h>
> +#include <apr_lib.h>
> #include "svn_delta.h"
> #include "svn_error.h"
>
> @@ -78,7 +79,7 @@
> for (tmp = offset; tmp < offset + length; ++tmp)
> {
> int const dat = window->new->data[tmp];
> - if (iscntrl (dat) || !isascii(dat))
> + if (iscntrl (dat) || !apr_isascii(dat))
That reference to iscntrl() should change, too. No reason to do one and not
the other.
I'm compiling the changes now and will check in soon.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:16 2006