FreeBSD/contrib/subversion/subversion/libsvn_ra_serf/get_file.c
/* Helper svn_ra_serf__get_file(). Attempts to fetch file contents
 * using SESSION->wc_callbacks->get_wc_contents() if sha1 property is
 * present in PROPS.
 *
 * Sets *FOUND_P to TRUE if file contents was successfuly fetched.
 *
 * Performs all temporary allocations in POOL.
 */


Sets *FOUND_P to TRUE if file contents was successfuly fetched.

Performs all temporary allocations in POOL.
Sets * FOUND_P to TRUE if file contents was successfuly fetched . Performs all temporary allocations in POOL .
static svn_error_t *
try_get_wc_contents(svn_boolean_t *found_p,
                    svn_ra_serf__session_t *session,
                    const char *sha1_checksum_prop,
                    svn_stream_t *dst_stream,
                    apr_pool_t *pool)
{
  svn_checksum_t *checksum;
  svn_stream_t *wc_stream;
  svn_error_t *err;
  *found_p = FALSE;
  if (!session->wc_callbacks->get_wc_contents
      || sha1_checksum_prop == NULL)
    {
      return SVN_NO_ERROR;
    }
  SVN_ERR(svn_checksum_parse_hex(&checksum, svn_checksum_sha1,
                                 sha1_checksum_prop, pool));
  err = session->wc_callbacks->get_wc_contents(
          session->wc_callback_baton, &wc_stream, checksum, pool);
  if (err)
    {
      svn_error_clear(err);
      return SVN_NO_ERROR;
    }
  if (wc_stream)
    {
        SVN_ERR(svn_stream_copy3(wc_stream,
                                 svn_stream_disown(dst_stream, pool),
                                 NULL, NULL, pool));
      *found_p = TRUE;
    }
  return SVN_NO_ERROR;
}
static svn_error_t * try_get_wc_contents ( svn_boolean_t * found_p , svn_ra_serf__session_t * session , const char * sha1_checksum_prop , svn_stream_t * dst_stream , apr_pool_t * pool ) { svn_checksum_t * checksum ; svn_stream_t * wc_stream ; svn_error_t * err ; * found_p = FALSE ; if ( ! session -> wc_callbacks -> get_wc_contents || sha1_checksum_prop == NULL ) { return SVN_NO_ERROR ; } SVN_ERR ( svn_checksum_parse_hex ( & checksum , svn_checksum_sha1 , sha1_checksum_prop , pool ) ) ; err = session -> wc_callbacks -> get_wc_contents ( session -> wc_callback_baton , & wc_stream , checksum , pool ) ; if ( err ) { svn_error_clear ( err ) ; return SVN_NO_ERROR ; } if ( wc_stream ) { SVN_ERR ( svn_stream_copy3 ( wc_stream , svn_stream_disown ( dst_stream , pool ) , NULL , NULL , pool ) ) ; * found_p = TRUE ; } return SVN_NO_ERROR ; }
Helper svn_ra_serf__get_file().
Helper svn_ra_serf__get_file () .
/* No contents found by default. */ /* Nothing to do. */ /* Ignore errors for now. */