*
* @param wh write handle
* @param fi file with reader
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
*/
static int
copy_from_reader (struct GNUNET_BIO_WriteHandle *wh,
}
break;
case 4: /* directory */
+ if ( (NULL != fi->data.dir.entries) &&
+ (NULL == fi->data.dir.entries->serialization) )
+ GNUNET_FS_file_information_sync_ (fi->data.dir.entries);
if ((GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->data.dir.dir_size)) ||
(GNUNET_OK !=
GNUNET_BIO_write (wh, fi->data.dir.dir_data,
GNUNET_assert (0);
goto cleanup;
}
+ if ( (NULL != fi->next) &&
+ (NULL == fi->next->serialization) )
+ GNUNET_FS_file_information_sync_ (fi->next);
if (GNUNET_OK !=
GNUNET_BIO_write_string (wh,
(fi->next !=
while (NULL != pos)
{
- fprintf (stderr,
- "CMP: %s %s\n",
- srch, pos->serialization);
if (0 == strcmp (srch, pos->serialization))
return pos;
if ( (GNUNET_YES == pos->is_directory) &&
* Signal the FS's progress function that we are resuming
* an upload.
*
- * @param cls closure (of type "struct GNUNET_FS_PublishContext*")
+ * @param cls closure (of type `struct GNUNET_FS_PublishContext *`, for the parent (!))
* @param fi the entry in the publish-structure
* @param length length of the file or directory
* @param meta metadata for the file or directory (can be modified)
* @param bo block options (can be modified)
* @param do_index should we index?
* @param client_info pointer to client context set upon creation (can be modified)
- * @return GNUNET_OK to continue (always)
+ * @return #GNUNET_OK to continue (always)
*/
static int
fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi,
return GNUNET_OK;
}
pi.status = GNUNET_FS_STATUS_PUBLISH_RESUME;
- pi.value.publish.specifics.resume.message = pc->fi->emsg;
- pi.value.publish.specifics.resume.chk_uri = pc->fi->chk_uri;
+ pi.value.publish.specifics.resume.message = fi->emsg;
+ pi.value.publish.specifics.resume.chk_uri = fi->chk_uri;
*client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0);
if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
{
* Function called with a filename of serialized publishing operation
* to deserialize.
*
- * @param cls the 'struct GNUNET_FS_Handle*'
+ * @param cls the `struct GNUNET_FS_Handle *`
* @param filename complete filename (absolute path)
* @return #GNUNET_OK (continue to iterate)
*/
*
* @param h file handle
* @param emsg set to the error message
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
int
GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg)
* @param what describes what is being read (for error message creation)
* @param result the buffer to write the result to
* @param len the number of bytes to read
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
size_t pos;
ssize_t ret;
- if (h->emsg != NULL)
+ if (NULL != h->emsg)
return GNUNET_SYSERR;
pos = 0;
do
GNUNET_assert (h->have == h->pos);
/* fill buffer */
ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size);
- if (ret == -1)
+ if (-1 == ret)
{
- GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what,
+ GNUNET_asprintf (&h->emsg,
+ _("Error reading `%s': %s"),
+ what,
STRERROR (errno));
return GNUNET_SYSERR;
}
- if (ret == 0)
+ if (0 == ret)
{
- GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what,
+ GNUNET_asprintf (&h->emsg,
+ _("Error reading `%s': %s"),
+ what,
_("End of file"));
return GNUNET_SYSERR;
}
* @param line line number in the source file
* @param result the buffer to write the result to
* @param len the number of bytes to read
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line,
* @param result the buffer to store a pointer to the (allocated) string to
* (note that *result could be set to NULL as well)
* @param maxLen maximum allowed length for the string
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
GNUNET_asprintf (&h->emsg, _("Error reading length of string `%s'"), what);
return GNUNET_SYSERR;
}
- if (big == 0)
+ if (0 == big)
{
*result = NULL;
return GNUNET_OK;
buf = GNUNET_malloc (big);
*result = buf;
buf[--big] = '\0';
- if (big == 0)
+ if (0 == big)
return GNUNET_OK;
if (GNUNET_OK != GNUNET_BIO_read (h, what, buf, big))
{
* @param h handle to an open file
* @param what describes what is being read (for error message creation)
* @param result the buffer to store a pointer to the (allocated) metadata
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what,
* @param file name of the source file
* @param line line number in the source file
* @param i address of 32-bit integer to read
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
* @param file name of the source file
* @param line line number in the source file
* @param i address of 64-bit integer to read
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
* Close an open file for writing.
*
* @param h file handle
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
int
GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h)
* Force a buffered writer to flush its buffer
*
* @param h the writer handle
- * @return GNUNET_OK upon success. Upon failure GNUNET_SYSERR is returned and
+ * @return #GNUNET_OK upon success. Upon failure #GNUNET_SYSERR is returned and
* the file is closed
*/
int
* @param h handle to open file
* @param buffer the data to write
* @param n number of bytes to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
*
* @param h handle to open file
* @param s string to write (can be NULL)
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s)
+GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h,
+ const char *s)
{
uint32_t slen;
*
* @param h handle to open file
* @param m metadata to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h,