On Sat, Jul 20, 2013 at 2:03 AM, <stefan2_at_apache.org> wrote:
> Author: stefan2
> Date: Fri Jul 19 22:03:34 2013
> New Revision: 1505046
>
> URL: http://svn.apache.org/r1505046
> Log:
> Merge revisions r1453590,1454307 from branches/fsfs-format7.
> These introduce base36 conversion routines.
>
> Modified:
> subversion/trunk/ (props changed)
> subversion/trunk/subversion/include/private/svn_string_private.h
> subversion/trunk/subversion/libsvn_subr/string.c
>
> Propchange: subversion/trunk/
> ------------------------------------------------------------------------------
> Merged /subversion/branches/fsfs-format7:r1453590,1454307
>
> Modified: subversion/trunk/subversion/include/private/svn_string_private.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_string_private.h?rev=1505046&r1=1505045&r2=1505046&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/private/svn_string_private.h (original)
> +++ subversion/trunk/subversion/include/private/svn_string_private.h Fri Jul 19 22:03:34 2013
> @@ -175,6 +175,32 @@ svn__ui64toa_sep(apr_uint64_t number, ch
> char *
> svn__i64toa_sep(apr_int64_t number, char seperator, apr_pool_t *pool);
>
> +
> +/** Writes the @a number as base36-encoded string into @a dest. The latter
> + * must provide space for at least #SVN_INT64_BUFFER_SIZE characters.
> + * Returns the number chars written excluding the terminating NUL.
> + *
> + * @note The actual maximum buffer requirement is much shorter than
> + * #SVN_INT64_BUFFER_SIZE but introducing yet another constant is only
> + * marginally useful and may open the door to security issues when e.g.
> + * switching between base10 and base36 encoding.
> + */
> +apr_size_t
> +svn__ui64tobase36(char *dest, apr_uint64_t number);
> +
> +/** Returns the value of the base36 encoded unsigned integer starting at
> + * @a source. If @a next is not NULL, @a *next will be set to the first
> + * position after the integer.
> + *
> + * The data in @a source will be considered part of the number to parse
> + * as long as the characters are within the base36 range. If there are
> + * no such characters to begin with, 0 is returned. Inputs with more than
> + * #SVN_INT64_BUFFER_SIZE digits will not be fully parsed, i.e. the value
> + * of @a *next as well as the return value are undefined.
> + */
> +apr_uint64_t
> +svn__base36toui64(const char **next, const char *source);
> +
Hi Stefan,
Simple tests would be useful IMHO.
--
Ivan Zhakov
Received on 2013-07-20 00:26:29 CEST