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

Re: svn commit: r1628093 - in /subversion/trunk/subversion/libsvn_fs_fs: index.c structure-indexes

From: Branko Čibej <brane_at_wandisco.com>
Date: Mon, 03 Nov 2014 15:41:47 +0100

On 28.09.2014 19:56, stefan2_at_apache.org wrote:
> Author: stefan2
> Date: Sun Sep 28 17:56:01 2014
> New Revision: 1628093
>
> URL: http://svn.apache.org/r1628093
> Log:
> Support FSFS format 7 commits in load balanced mixed-architecture clusters.

> +/* Write VALUE to the PROTO_INDEX file, using SCRATCH_POOL for temporary
> + * allocations.
> + *
> + * The point of this function is to ensure an architecture-independent
> + * proto-index file format. All data is written as unsigned 64 bits ints
> + * in little endian byte order. 64 bits is the largest portable integer
> + * we have and unsigned values have well-defined conversions in C.
> + */
> +static svn_error_t *
> +write_uint64_to_proto_index(apr_file_t *proto_index,
> + apr_uint64_t value,
> + apr_pool_t *scratch_pool)
> +{
> + apr_byte_t buffer[sizeof(value)];
> + int i;
> + apr_size_t written;
> +
> + /* Split VALUE into 8 bytes using LE ordering. */
> + for (i = 0; i < sizeof(buffer); ++i)
> + {
> + /* Unsigned conversions are well-defined ... */
> + buffer[i] = (apr_byte_t)value;
> + value >>= CHAR_BIT;

Does APR guarantee that sizeof(apr_byte_t) == CHAR_BIT?

-- Brane
Received on 2014-11-03 15:43:54 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.