gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29251 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r29251 - gnunet/src/fs
Date: Sat, 14 Sep 2013 16:16:46 +0200

Author: grothoff
Date: 2013-09-14 16:16:46 +0200 (Sat, 14 Sep 2013)
New Revision: 29251

Modified:
   gnunet/src/fs/fs_api.c
   gnunet/src/fs/fs_file_information.c
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/fs_tree.c
Log:
-more complete fix for #3034

Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c      2013-09-14 13:56:30 UTC (rev 29250)
+++ gnunet/src/fs/fs_api.c      2013-09-14 14:16:46 UTC (rev 29251)
@@ -496,7 +496,7 @@
 {
   struct FileInfo *fi;
 
-  fi = GNUNET_malloc (sizeof (struct FileInfo));
+  fi = GNUNET_new (struct FileInfo);
   fi->filename = GNUNET_STRINGS_filename_expand (filename);
   if (NULL == fi->filename)
   {

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2013-09-14 13:56:30 UTC (rev 29250)
+++ gnunet/src/fs/fs_file_information.c 2013-09-14 14:16:46 UTC (rev 29251)
@@ -123,7 +123,7 @@
     return NULL;
   }
   fi = GNUNET_FS_make_file_reader_context_ (filename);
-  if (fi == NULL)
+  if (NULL == fi)
   {
     GNUNET_break (0);
     return NULL;
@@ -261,7 +261,7 @@
  * Test if a given entry represents a directory.
  *
  * @param ent check if this FI represents a directory
- * @return GNUNET_YES if so, GNUNET_NO if not
+ * @return #GNUNET_YES if so, #GNUNET_NO if not
  */
 int
 GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation
@@ -409,7 +409,7 @@
   int no;
 
   no = GNUNET_NO;
-  if (fi->is_directory == GNUNET_YES)
+  if (GNUNET_YES == fi->is_directory)
   {
     /* clean up directory */
     while (NULL != (pos = fi->data.dir.entries))

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2013-09-14 13:56:30 UTC (rev 29250)
+++ gnunet/src/fs/fs_publish.c  2013-09-14 14:16:46 UTC (rev 29251)
@@ -345,8 +345,8 @@
 {
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_FileInformation *p;
+  const char *dd;
   size_t pt_size;
-  const char *dd;
 
   p = pc->fi_pos;
   if (GNUNET_YES == p->is_directory)
@@ -359,16 +359,15 @@
   {
     if (UINT64_MAX == offset) 
     {
-      if (NULL != p->data.file.reader)
-      {
-       pt_size = p->data.file.reader (p->data.file.reader_cls, offset, 0, 
NULL, NULL);
-       p->data.file.reader = NULL;
-       return pt_size;
+      if (&GNUNET_FS_data_reader_file_ == p->data.file.reader)
+      {        
+       /* force closing the file to avoid keeping too many files open */
+       p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL);
       }
       return 0;
     }
     pt_size = GNUNET_MIN (max, p->data.file.file_size - offset);
-    if (pt_size == 0)
+    if (0 == pt_size)
       return 0;                 /* calling reader with pt_size==0
                                  * might free buf, so don't! */
     if (pt_size !=

Modified: gnunet/src/fs/fs_tree.c
===================================================================
--- gnunet/src/fs/fs_tree.c     2013-09-14 13:56:30 UTC (rev 29250)
+++ gnunet/src/fs/fs_tree.c     2013-09-14 14:16:46 UTC (rev 29251)
@@ -250,13 +250,13 @@
 
 
 /**
- * Initialize a tree encoder.  This function will call "proc" and
+ * Initialize a tree encoder.  This function will call @a proc and
  * "progress" on each block in the tree.  Once all blocks have been
- * processed, "cont" will be scheduled.  The "reader" will be called
+ * processed, "cont" will be scheduled.  The @a reader will be called
  * to obtain the (plaintext) blocks for the file.  Note that this
- * function will not actually call "proc".  The client must
- * call "GNUNET_FS_tree_encoder_next" to trigger encryption (and
- * calling of "proc") for the each block.
+ * function will not actually call @a proc.  The client must
+ * call #GNUNET_FS_tree_encoder_next to trigger encryption (and
+ * calling of @a proc) for the each block.
  *
  * @param h the global FS context
  * @param size overall size of the file to encode
@@ -268,7 +268,8 @@
  */
 struct GNUNET_FS_TreeEncoder *
 GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size,
-                               void *cls, GNUNET_FS_DataReader reader,
+                               void *cls,
+                              GNUNET_FS_DataReader reader,
                                GNUNET_FS_TreeBlockProcessor proc,
                                GNUNET_FS_TreeProgressCallback progress,
                                GNUNET_SCHEDULER_Task cont)




reply via email to

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