eh? why "void *" in this case? The proper type would seem to be
"unsigned char *" (and still const, of course)
On Tue, Jan 6, 2009 at 10:15, Julian Foad <julianfoad_at_btopenworld.com> wrote:
> Author: julianfoad
> Date: Tue Jan 6 10:15:33 2009
> New Revision: 35050
>
> Log:
> Tweak a local function signature to avoid the need for a type cast. (This
> particular type cast was casting away "const" though it need not have done.)
>
> * subversion/libsvn_subr/svn_base64.c
> (encode_bytes): Take "void *" instead of "char *" input data.
> (svn_base64_from_checksum): Remove a type cast in calling encode_bytes().
>
> Modified:
> trunk/subversion/libsvn_subr/svn_base64.c
>
> Modified: trunk/subversion/libsvn_subr/svn_base64.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/svn_base64.c?pathrev=35050&r1=35049&r2=35050
> ==============================================================================
> --- trunk/subversion/libsvn_subr/svn_base64.c Tue Jan 6 09:11:11 2009 (r35049)
> +++ trunk/subversion/libsvn_subr/svn_base64.c Tue Jan 6 10:15:33 2009 (r35050)
> @@ -68,12 +68,12 @@ encode_group(const unsigned char *in, ch
> initialize *INBUFLEN and *LINELEN to 0. Output will be appended to
> STR. Include newlines every so often if BREAK_LINES is true. */
> static void
> -encode_bytes(svn_stringbuf_t *str, const char *data, apr_size_t len,
> +encode_bytes(svn_stringbuf_t *str, const void *data, apr_size_t len,
> unsigned char *inbuf, int *inbuflen, int *linelen,
> svn_boolean_t break_lines)
> {
> char group[4];
> - const char *p = data, *end = data + len;
> + const char *p = data, *end = p + len;
>
> /* Keep encoding three-byte groups until we run out. */
> while (*inbuflen + (end - p) >= 3)
> @@ -381,10 +381,7 @@ svn_base64_from_checksum(svn_checksum_t
> int ingrouplen = 0, linelen = 0;
> checksum_str = svn_stringbuf_create("", pool);
>
> - /* This cast is safe because we know encode_bytes does a memcpy and
> - * does an implicit unsigned char * cast.
> - */
> - encode_bytes(checksum_str, (char*)checksum->digest,
> + encode_bytes(checksum_str, checksum->digest,
> svn_checksum_size(checksum), ingroup, &ingrouplen,
> &linelen, TRUE);
> encode_partial_group(checksum_str, ingroup, ingrouplen, linelen, TRUE);
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1008146
>
Received on 2009-01-09 12:10:58 CET