gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29246 - in gnunet/src: fs util


From: gnunet
Subject: [GNUnet-SVN] r29246 - in gnunet/src: fs util
Date: Fri, 13 Sep 2013 21:46:45 +0200

Author: grothoff
Date: 2013-09-13 21:46:45 +0200 (Fri, 13 Sep 2013)
New Revision: 29246

Modified:
   gnunet/src/fs/fs_api.c
   gnunet/src/fs/fs_api.h
   gnunet/src/util/bio.c
   gnunet/src/util/common_logging.c
Log:
-fixing resuming publish operation

Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c      2013-09-13 19:00:16 UTC (rev 29245)
+++ gnunet/src/fs/fs_api.c      2013-09-13 19:46:45 UTC (rev 29246)
@@ -1187,7 +1187,7 @@
  *
  * @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,
@@ -1330,6 +1330,9 @@
     }
     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,
@@ -1348,6 +1351,9 @@
     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 !=
@@ -1398,9 +1404,6 @@
 
   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) &&
@@ -1416,7 +1419,7 @@
  * 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)
@@ -1424,7 +1427,7 @@
  * @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,
@@ -1442,8 +1445,8 @@
     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))
   {
@@ -1459,7 +1462,7 @@
  * 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)
  */

Modified: gnunet/src/fs/fs_api.h
===================================================================
--- gnunet/src/fs/fs_api.h      2013-09-13 19:00:16 UTC (rev 29245)
+++ gnunet/src/fs/fs_api.h      2013-09-13 19:46:45 UTC (rev 29246)
@@ -340,7 +340,7 @@
       int do_index;
 
       /**
-       * Is "file_id" already valid?  Set to GNUNET_YES once the hash
+       * Is "file_id" already valid?  Set to #GNUNET_YES once the hash
        * has been calculated.
        */
       int have_hash;

Modified: gnunet/src/util/bio.c
===================================================================
--- gnunet/src/util/bio.c       2013-09-13 19:00:16 UTC (rev 29245)
+++ gnunet/src/util/bio.c       2013-09-13 19:46:45 UTC (rev 29246)
@@ -75,7 +75,7 @@
  *
  * @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)
@@ -100,7 +100,7 @@
  * @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,
@@ -111,7 +111,7 @@
   size_t pos;
   ssize_t ret;
 
-  if (h->emsg != NULL)
+  if (NULL != h->emsg)
     return GNUNET_SYSERR;
   pos = 0;
   do
@@ -131,15 +131,19 @@
     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;
     }
@@ -159,7 +163,7 @@
  * @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,
@@ -180,7 +184,7 @@
  * @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,
@@ -195,7 +199,7 @@
     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;
@@ -209,7 +213,7 @@
   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))
   {
@@ -227,7 +231,7 @@
  * @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,
@@ -277,7 +281,7 @@
  * @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,
@@ -299,7 +303,7 @@
  * @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,
@@ -357,7 +361,7 @@
  * 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)
@@ -376,7 +380,7 @@
  * 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
@@ -402,7 +406,7 @@
  * @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,
@@ -441,10 +445,11 @@
  *
  * @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;
 
@@ -462,7 +467,7 @@
  *
  * @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,

Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c    2013-09-13 19:00:16 UTC (rev 29245)
+++ gnunet/src/util/common_logging.c    2013-09-13 19:46:45 UTC (rev 29246)
@@ -663,7 +663,7 @@
  * @param comp default component to use
  * @param loglevel what types of messages should be logged
  * @param logfile which file to write log messages to (can be NULL)
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 int
 GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]