Exemplo n.º 1
0
svn_error_t *
svn_fs_x__dag_deserialize(void **out,
                          void *data,
                          apr_size_t data_len,
                          apr_pool_t *pool)
{
  dag_node_t *node = (dag_node_t *)data;
  if (data_len == 0)
    return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                            _("Empty noderev in cache"));

  /* Copy the _full_ buffer as it also contains the sub-structures. */
  node->fs = NULL;

  /* fixup all references to sub-structures */
  svn_fs_x__id_deserialize(node, &node->id);
  svn_fs_x__id_deserialize(node,
                            (svn_fs_id_t **)&node->fresh_root_predecessor_id);
  svn_fs_x__noderev_deserialize(node, &node->node_revision);
  node->node_pool = pool;

  svn_temp_deserializer__resolve(node, (void**)&node->created_path);

  /* return result */
  *out = node;

  return SVN_NO_ERROR;
}
Exemplo n.º 2
0
/* Deserialize an ID inside the BUFFER.
 */
void
svn_fs_fs__id_deserialize(void *buffer, svn_fs_id_t **in_out)
{
  fs_fs__id_t *id;

  /* The id maybe all what is in the whole buffer.
   * Don't try to fixup the pointer in that case*/
  if (*in_out != buffer)
    svn_temp_deserializer__resolve(buffer, (void**)in_out);

  id = (fs_fs__id_t *)*in_out;

  /* no id, no sub-structure fixup necessary */
  if (id == NULL)
    return;

  /* the stored vtable is bogus at best -> set the right one */
  id->generic_id.vtable = &id_vtable;
  id->generic_id.fsap_data = id;
}