FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/index.c
/* Navigate STREAM to packed stream offset OFFSET.  There will be no checks
 * whether the given OFFSET is valid.
 */
Navigate STREAM to packed stream offset OFFSET.  There will be no checks
whether the given OFFSET is valid.
Navigate STREAM to packed stream offset OFFSET . There will be no checks whether the given OFFSET is valid .
static void
packed_stream_seek(svn_fs_fs__packed_number_stream_t *stream,
                   apr_off_t offset)
{
  apr_off_t file_offset = offset + stream->stream_start;
  if (   stream->used == 0
      || offset < stream->start_offset
      || offset >= stream->next_offset)
    {
      stream->start_offset = file_offset;
      stream->next_offset = file_offset;
      stream->current = 0;
      stream->used = 0;
    }
  else
    {
      apr_size_t i;
      for (i = 0; i < stream->used; ++i)
        if (stream->buffer[i].total_len > file_offset - stream->start_offset)
          break;
      stream->current = i;
    }
}
static void packed_stream_seek ( svn_fs_fs__packed_number_stream_t * stream , apr_off_t offset ) { apr_off_t file_offset = offset + stream -> stream_start ; if ( stream -> used == 0 || offset < stream -> start_offset || offset >= stream -> next_offset ) { stream -> start_offset = file_offset ; stream -> next_offset = file_offset ; stream -> current = 0 ; stream -> used = 0 ; } else { apr_size_t i ; for ( i = 0 ; i < stream -> used ; ++ i ) if ( stream -> buffer [ i ] . total_len > file_offset - stream -> start_offset ) break ; stream -> current = i ; } }
Navigate STREAM to packed stream offset OFFSET.
Navigate STREAM to packed stream offset OFFSET .
/* outside buffered data.  Next get() will read() from OFFSET. */ /* Find the suitable location in the stream buffer.
       * Since our buffer is small, it is efficient enough to simply scan
       * it for the desired position. */