Browse Source

* direntry.c: Added const qualifiers to work around gcc
warnings.
* extfs.c: Likewise.
* fish.c: Likewise.
* ftpfs.c: Likewise.
* sfs.c: Likewise.
* xdirentry.h: Likewise.

Roland Illig 19 years ago
parent
commit
7e7b81b73e
7 changed files with 36 additions and 22 deletions
  1. 10 0
      vfs/ChangeLog
  2. 9 9
      vfs/direntry.c
  3. 5 4
      vfs/extfs.c
  4. 8 6
      vfs/fish.c
  5. 2 1
      vfs/ftpfs.c
  6. 1 1
      vfs/sfs.c
  7. 1 1
      vfs/xdirentry.h

+ 10 - 0
vfs/ChangeLog

@@ -1,3 +1,13 @@
+2005-09-05  Roland Illig  <roland.illig@gmx.de>
+
+	* direntry.c: Added const qualifiers to work around gcc
+	warnings.
+	* extfs.c: Likewise.
+	* fish.c: Likewise.
+	* ftpfs.c: Likewise.
+	* sfs.c: Likewise.
+	* xdirentry.h: Likewise.
+
 2005-08-15  Roland Illig  <roland.illig@gmx.de>
 
 	* vfs-impl.h (union vfs_dirent): Using the offsetof macro

+ 9 - 9
vfs/direntry.c

@@ -456,10 +456,11 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
  * Dissect the path and create corresponding superblock.  Note that inname
  * can be changed and the result may point inside the original string.
  */
-char *
+const char *
 vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
 		       struct vfs_s_super **archive, int flags)
 {
+    const char *retval;
     char *local, *op;
     const char *archive_name;
     int result = -1;
@@ -468,8 +469,7 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
 
     archive_name = inname;
     vfs_split (inname, &local, &op);
-    if (!local)
-	local = "";
+    retval = (local) ? local : "";
 
     if (MEDATA->archive_check)
 	if (!(cookie = MEDATA->archive_check (me, archive_name, op)))
@@ -506,7 +506,7 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
 
   return_success:
     *archive = super;
-    return local;
+    return retval;
 }
 
 
@@ -518,12 +518,12 @@ static char *
 vfs_s_get_path (struct vfs_class *me, const char *inname,
 		struct vfs_s_super **archive, int flags)
 {
-    char * const buf = g_strdup (inname);
-    char *res = vfs_s_get_path_mangle (me, buf, archive, flags);
-    if (res)
-	res = g_strdup (res);
+    char *buf, *retval;
+
+    buf = g_strdup (inname);
+    retval = g_strdup (vfs_s_get_path_mangle (me, buf, archive, flags));
     g_free (buf);
-    return res;
+    return retval;
 }
 
 void

+ 5 - 4
vfs/extfs.c

@@ -155,7 +155,7 @@ static void extfs_make_dots (struct entry *ent)
 }
 
 static struct entry *extfs_generate_entry (struct archive *archive, 
-    char *name, struct entry *parentry, mode_t mode)
+    const char *name, struct entry *parentry, mode_t mode)
 {
     mode_t myumask;
     struct inode *inode, *parent; 
@@ -452,7 +452,7 @@ extfs_get_path_mangle (struct vfs_class *me, char *inname, struct archive **arch
     if (fstype == -1)
 	return NULL;
     if (!local)
-	local = "";
+	local = inname + strlen (inname);
 
     /*
      * All filesystems should have some local archive, at least
@@ -582,9 +582,10 @@ static struct entry *extfs_resolve_symlinks (struct entry *entry)
     return res;
 }
 
-static char *extfs_get_archive_name (struct archive *archive)
+static const char *
+extfs_get_archive_name (struct archive *archive)
 {
-    char *archive_name;
+    const char *archive_name;
 
     if (archive->local_name)
 	archive_name = archive->local_name;

+ 8 - 6
vfs/fish.c

@@ -712,13 +712,14 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *c
 
 #define PREFIX \
     char buf[BUF_LARGE]; \
+    const char *crpath; \
     char *rpath, *mpath = g_strdup (path); \
     struct vfs_s_super *super; \
-    if (!(rpath = vfs_s_get_path_mangle (me, mpath, &super, 0))) { \
+    if (!(crpath = vfs_s_get_path_mangle (me, mpath, &super, 0))) { \
 	g_free (mpath); \
 	return -1; \
     } \
-    rpath = name_quote (rpath, 0); \
+    rpath = name_quote (crpath, 0); \
     g_free (mpath);
 
 #define POSTFIX(flags) \
@@ -741,20 +742,21 @@ fish_chmod (struct vfs_class *me, const char *path, int mode)
 static int fish_##name (struct vfs_class *me, const char *path1, const char *path2) \
 { \
     char buf[BUF_LARGE]; \
+    const char *crpath1, *crpath2; \
     char *rpath1, *rpath2, *mpath1, *mpath2; \
     struct vfs_s_super *super1, *super2; \
-    if (!(rpath1 = vfs_s_get_path_mangle (me, mpath1 = g_strdup(path1), &super1, 0))) { \
+    if (!(crpath1 = vfs_s_get_path_mangle (me, mpath1 = g_strdup(path1), &super1, 0))) { \
 	g_free (mpath1); \
 	return -1; \
     } \
-    if (!(rpath2 = vfs_s_get_path_mangle (me, mpath2 = g_strdup(path2), &super2, 0))) { \
+    if (!(crpath2 = vfs_s_get_path_mangle (me, mpath2 = g_strdup(path2), &super2, 0))) { \
 	g_free (mpath1); \
 	g_free (mpath2); \
 	return -1; \
     } \
-    rpath1 = name_quote (rpath1, 0); \
+    rpath1 = name_quote (crpath1, 0); \
     g_free (mpath1); \
-    rpath2 = name_quote (rpath2, 0); \
+    rpath2 = name_quote (crpath2, 0); \
     g_free (mpath2); \
     g_snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \
     g_free (rpath1); \

+ 2 - 1
vfs/ftpfs.c

@@ -1461,7 +1461,8 @@ static int ftpfs_ctl (void *fh, int ctlop, void *arg)
 static int
 ftpfs_send_command(struct vfs_class *me, const char *filename, const char *cmd, int flags)
 {
-    char *rpath, *p, *mpath = g_strdup(filename);
+    const char *rpath;
+    char *p, *mpath = g_strdup(filename);
     struct vfs_s_super *super;
     int r;
     int flush_directory_cache = (flags & OPT_FLUSH);

+ 1 - 1
vfs/sfs.c

@@ -148,7 +148,7 @@ sfs_vfmake (struct vfs_class *me, const char *name, char *cache)
     return 0;			/* OK */
 }
 
-static char *
+static const char *
 sfs_redirect (struct vfs_class *me, const char *name)
 {
     struct cachedfile *cur = head;

+ 1 - 1
vfs/xdirentry.h

@@ -182,7 +182,7 @@ struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me,
 /* outside interface */
 void vfs_s_init_class (struct vfs_class *vclass,
 		       struct vfs_s_subclass *sub);
-char *vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
+const char *vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
 			     struct vfs_s_super **archive, int flags);
 void vfs_s_invalidate (struct vfs_class *me, struct vfs_s_super *super);
 char *vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino);