On 03.11.2014 16:16, Stefan Fuhrmann wrote:
> On Mon, Nov 3, 2014 at 3:41 PM, Branko Čibej <brane_at_wandisco.com
> <mailto:brane_at_wandisco.com>> wrote:
>
> On 28.09.2014 19:56, stefan2_at_apache.org
> <mailto: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?
>
>
> No. It guarantees that sizeof(apr_byte_t) == 1
> (you probably meant to say that).
Meh, yes I did ...
> APR.H on all
> platform defines it as 'unsigned char' - as opposed
> to apr_uint16_t and friends, which could be anything.
Ack, looks OK then.
-- Brane
Received on 2014-11-03 16:18:13 CET