[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Error While Checking out Git Repository

From: Peter Samuelson <peter_at_p12n.org>
Date: Thu, 9 Feb 2012 12:01:04 -0600

[Philip Martin]
> --- ../src/subversion/libsvn_subr/svn_base64.c (revision 1242045)
> +++ ../src/subversion/libsvn_subr/svn_base64.c (working copy)
> @@ -410,7 +410,7 @@
> /* Resize the stringbuf to make room for the (approximate) size of
> output, to avoid repeated resizes later.
> The optimizations in decode_line rely on no resizes being necessary! */
> - svn_stringbuf_ensure(str, str->len + (len / 4) * 3 + 3);
> + svn_stringbuf_ensure(str, str->len + (len / 4) * 3 + 4);
>
> while ( !*done && p < end )
> {
>
> but I don't really understand the comment. There doesn't seem to be
> anything "approximate" about this calculation?

It is approximate because the encoded length is always a multiple of 4,
even if the input length was not a multiple of 3. (This is why so many
base64 strings end in = or ==; those are padding to a 4-byte output
group.) The decoder doesn't yet know if the final group of 4 bytes
will decode to 1, 2 or 3 bytes of plaintext.
Received on 2012-02-09 19:01:51 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.