fs_tree.c   fs_tree.c 
skipping to change at line 284 skipping to change at line 284
te->size = size; te->size = size;
te->cls = cls; te->cls = cls;
te->reader = reader; te->reader = reader;
te->proc = proc; te->proc = proc;
te->progress = progress; te->progress = progress;
te->cont = cont; te->cont = cont;
te->chk_tree_depth = GNUNET_FS_compute_depth (size); te->chk_tree_depth = GNUNET_FS_compute_depth (size);
te->chk_tree = te->chk_tree =
GNUNET_malloc (te->chk_tree_depth * CHK_PER_INODE * GNUNET_malloc (te->chk_tree_depth * CHK_PER_INODE *
sizeof (struct ContentHashKey)); sizeof (struct ContentHashKey));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created tree encoder for file with %llu bytes and depth %u\n"
,
(unsigned long long) size,
te->chk_tree_depth);
return te; return te;
} }
/** /**
* Compute the offset of the CHK for the * Compute the offset of the CHK for the
* current block in the IBlock above. * current block in the IBlock above.
* *
* @param depth depth of the IBlock in the tree (aka overall * @param depth depth of the IBlock in the tree (aka overall
* number of tree levels minus depth); 0 == DBlock * number of tree levels minus depth); 0 == DBlock
* @param end_offset current offset in the overall file, * @param end_offset current offset in the overall file,
skipping to change at line 352 skipping to change at line 356
te->cont (te->cls, NULL); te->cont (te->cls, NULL);
return; return;
} }
if (0 == te->current_depth) if (0 == te->current_depth)
{ {
/* read DBLOCK */ /* read DBLOCK */
pt_size = GNUNET_MIN (DBLOCK_SIZE, te->size - te->publish_offset); pt_size = GNUNET_MIN (DBLOCK_SIZE, te->size - te->publish_offset);
if (pt_size != if (pt_size !=
te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg)) te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg))
{ {
te->cont (te->cls, NULL);
te->in_next = GNUNET_NO; te->in_next = GNUNET_NO;
te->cont (te->cls, NULL);
return; return;
} }
pt_block = iob; pt_block = iob;
} }
else else
{ {
pt_size = pt_size =
GNUNET_FS_tree_compute_iblock_size (te->current_depth, GNUNET_FS_tree_compute_iblock_size (te->current_depth,
te->publish_offset); te->publish_offset);
pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE]; pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE];
skipping to change at line 419 skipping to change at line 423
* @param uri set to the resulting URI (if encoding finished) * @param uri set to the resulting URI (if encoding finished)
* @param emsg set to an error message (if an error occured * @param emsg set to an error message (if an error occured
* within the tree encoder; if this function is called * within the tree encoder; if this function is called
* prior to completion and prior to an internal error, * prior to completion and prior to an internal error,
* both "*uri" and "*emsg" will be set to NULL). * both "*uri" and "*emsg" will be set to NULL).
*/ */
void void
GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te,
struct GNUNET_FS_Uri **uri, char **emsg) struct GNUNET_FS_Uri **uri, char **emsg)
{ {
(void) te->reader (te->cls, UINT64_MAX, 0, 0, NULL);
GNUNET_assert (GNUNET_NO == te->in_next); GNUNET_assert (GNUNET_NO == te->in_next);
if (uri != NULL) if (uri != NULL)
*uri = te->uri; *uri = te->uri;
else if (NULL != te->uri) else if (NULL != te->uri)
GNUNET_FS_uri_destroy (te->uri); GNUNET_FS_uri_destroy (te->uri);
if (emsg != NULL) if (emsg != NULL)
*emsg = te->emsg; *emsg = te->emsg;
else else
GNUNET_free_non_null (te->emsg); GNUNET_free_non_null (te->emsg);
GNUNET_free (te->chk_tree); GNUNET_free (te->chk_tree);
 End of changes. 4 change blocks. 
1 lines changed or deleted 7 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/