gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7117 - in GNUnet/src: applications/fs/fsui util/containers


From: gnunet
Subject: [GNUnet-SVN] r7117 - in GNUnet/src: applications/fs/fsui util/containers
Date: Tue, 10 Jun 2008 02:55:02 -0600 (MDT)

Author: holindho
Date: 2008-06-10 02:55:01 -0600 (Tue, 10 Jun 2008)
New Revision: 7117

Modified:
   GNUnet/src/applications/fs/fsui/upload.c
   GNUnet/src/util/containers/meta.c
Log:
one OS's dir separator may well appear in other OS's filenames.


Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2008-06-10 06:33:26 UTC (rev 
7116)
+++ GNUnet/src/applications/fs/fsui/upload.c    2008-06-10 08:55:01 UTC (rev 
7117)
@@ -422,9 +422,19 @@
             tpos--;
           if (tpos + 1 < tend)
             {
-              pfn = GNUNET_malloc (tend - tpos + 1);
+              char *p;
+              pfn = p = GNUNET_malloc (tend - tpos + 1);
               pfn[tend - tpos] = '\0';
               memcpy (pfn, &utc->filename[tpos + 1], tend - tpos);
+              /* change OS native dir separators to unix '/' and others to 
'_'*/
+              while (*p != '\0')
+                {
+                  if (*p == DIR_SEPARATOR)
+                    *p = '/';
+                  else if (*p == '/' || *p == '\\')
+                    *p = '_';
+                  p++;
+                }
               GNUNET_meta_data_insert (utc->meta, EXTRACTOR_RELATION, pfn);
               GNUNET_free (pfn);
             }

Modified: GNUnet/src/util/containers/meta.c
===================================================================
--- GNUnet/src/util/containers/meta.c   2008-06-10 06:33:26 UTC (rev 7116)
+++ GNUnet/src/util/containers/meta.c   2008-06-10 08:55:01 UTC (rev 7117)
@@ -111,11 +111,17 @@
   md->items[idx].type = type;
   md->items[idx].data = p = GNUNET_strdup (data);
 
-  /* remove hints to OS */
+  /* change OS native dir separators to unix '/' and others to '_' */
   if (type == EXTRACTOR_FILENAME)
     {
-      while ((p = strchr (p, '\\')))
-        *p = '/';
+      while (*p != '\0')
+        {
+          if (*p == DIR_SEPARATOR)
+            *p = '/';
+          else if (*p == '/' || *p == '\\')
+            *p = '_';
+          p++;
+        }
     }
 
   return GNUNET_OK;





reply via email to

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