FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/index.c
/* 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.
 */
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.
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;
  for (i = 0; i < sizeof(buffer); ++i)
    {
      buffer[i] = (apr_byte_t)value;
      value >>= CHAR_BIT;
    }
  SVN_ERR(svn_io_file_write_full(proto_index, buffer, sizeof(buffer),
                                 &written, scratch_pool));
  SVN_ERR_ASSERT(written == sizeof(buffer));
  return SVN_NO_ERROR;
}
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 ; for ( i = 0 ; i < sizeof ( buffer ) ; ++ i ) { buffer [ i ] = ( apr_byte_t ) value ; value >>= CHAR_BIT ; } SVN_ERR ( svn_io_file_write_full ( proto_index , buffer , sizeof ( buffer ) , & written , scratch_pool ) ) ; SVN_ERR_ASSERT ( written == sizeof ( buffer ) ) ; return SVN_NO_ERROR ; }
Write VALUE to the PROTO_INDEX file, using SCRATCH_POOL for temporary
 allocations.
Write VALUE to the PROTO_INDEX file using SCRATCH_POOL for temporary allocations .
/* Split VALUE into 8 bytes using LE ordering. */ /* Unsigned conversions are well-defined ... */ /* Write it all to disk. */