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