summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-10-05 11:04:26 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-10-05 11:04:26 +0200
commitd0caac91ac0a03e021d50d1de978733e11ba2ccd (patch)
treeb763e376e8f289baaccf332398d9354663115792 /common
parentc41d3e7d896492dd70cd1d548ef4fd5b3cbe4954 (diff)
downloadtuxcmd-modules-d0caac91ac0a03e021d50d1de978733e11ba2ccd.tar.xz
VFS API break: Introduce FDisplayName propertyv0.6.52
Diffstat (limited to 'common')
-rw-r--r--common/treepath_vfs.c9
-rw-r--r--common/treepathutils.c15
-rw-r--r--common/vfs_types.h5
-rw-r--r--common/vfsutils.c3
4 files changed, 20 insertions, 12 deletions
diff --git a/common/treepath_vfs.c b/common/treepath_vfs.c
index cdea20c..a1c6e91 100644
--- a/common/treepath_vfs.c
+++ b/common/treepath_vfs.c
@@ -127,8 +127,9 @@ TVFSResult vfs_filelist_file_info(struct VfsFilelistData *data, char *AFileName,
if (node) {
if (node->data) {
copy_vfs_item(node->data, Item);
- Item->sFileName = strdup(AFileName);
- printf("(II) VFSFileInfo: found file: '%s'\n", Item->sFileName);
+ Item->FName = strdup(AFileName);
+ Item->FDisplayName = strdup(AFileName);
+ printf("(II) VFSFileInfo: found file: '%s'\n", Item->FName);
return cVFS_OK;
} else {
printf("(EE) VFSFileInfo: node->data == NULL! \n");
@@ -167,7 +168,7 @@ TVFSResult vfs_filelist_list_first(struct VfsFilelistData *data, char *sDir, str
struct PathTree* node = filelist_tree_get_item_by_index(data->list_dir_node, data->list_dir_index);
if (node) {
copy_vfs_item(node->data, Item);
- printf("(II) VFSListFirst: found file: %s\n", Item->sFileName);
+ printf("(II) VFSListFirst: found file: %s\n", Item->FName);
return cVFS_OK;
} else {
printf("(II) VFSListFirst: no more files\n");
@@ -190,7 +191,7 @@ TVFSResult vfs_filelist_list_next(struct VfsFilelistData *data, char *sDir, stru
struct PathTree* node = filelist_tree_get_item_by_index(data->list_dir_node, data->list_dir_index);
if (node) {
copy_vfs_item(node->data, Item);
- printf("(II) VFSListNext: found file: %s\n", Item->sFileName);
+ printf("(II) VFSListNext: found file: %s\n", Item->FName);
return cVFS_OK;
} else {
printf("(II) VFSListNext: no more files\n");
diff --git a/common/treepathutils.c b/common/treepathutils.c
index d249444..d8a5f10 100644
--- a/common/treepathutils.c
+++ b/common/treepathutils.c
@@ -46,7 +46,8 @@ struct PathTree* filelist_tree_new()
// create placeholder data
tree->data = (struct TVFSItem*)malloc(sizeof(struct TVFSItem));
memset(tree->data, 0, sizeof(struct TVFSItem));
- tree->data->sFileName = strdup(tree->node);
+ tree->data->FName = strdup(tree->node);
+ tree->data->FDisplayName = strdup(tree->node);
tree->data->ItemType = vDirectory;
tree->data->iMode = S_IRWXO + S_IRWXG + S_IRWXU;
tree->data->iUID = geteuid();
@@ -75,7 +76,8 @@ void filelist_tree_free(struct PathTree *tree)
if (tree->items)
g_ptr_array_free(tree->items, TRUE);
if (tree->data) {
- if (tree->data->sFileName) free(tree->data->sFileName);
+ if (tree->data->FName) free(tree->data->FName);
+ if (tree->data->FDisplayName) free(tree->data->FDisplayName);
if (tree->data->sLinkTo) free(tree->data->sLinkTo);
free(tree->data);
}
@@ -206,7 +208,8 @@ void filelist_tree_add_item_recurr(struct PathTree *tree, const char *path, stru
t->data = item;
t->index = index;
t->node = strdup(path);
- if (t->data) t->data->sFileName = strdup(path);
+ if (t->data) t->data->FName = strdup(path);
+ if (t->data) t->data->FDisplayName = strdup(path);
// create new list of subitems and add new item
if (! tree->items) tree->items = g_ptr_array_new();
g_ptr_array_add(tree->items, t);
@@ -241,7 +244,8 @@ void filelist_tree_add_item_recurr(struct PathTree *tree, const char *path, stru
// create placeholder data
node->data = (struct TVFSItem*)malloc(sizeof(struct TVFSItem));
memset(node->data, 0, sizeof(struct TVFSItem));
- node->data->sFileName = strdup(node->node);
+ node->data->FName = strdup(node->node);
+ node->data->FDisplayName = strdup(node->node);
node->data->ItemType = vDirectory;
node->data->iMode = S_IRWXO + S_IRWXG + S_IRWXU;
node->data->iUID = geteuid();
@@ -298,7 +302,8 @@ gboolean filelist_tree_add_item(struct PathTree *tree, const char *path, struct
// free old data
if (found->data) free_vfs_item(found->data);
found->data = item;
- if (found->data) found->data->sFileName = strdup(found->node);
+ if (found->data) found->data->FName = strdup(found->node);
+ if (found->data) found->data->FDisplayName = strdup(found->node);
} else
// create new item recursively
filelist_tree_add_item_recurr(tree, pp, item, index);
diff --git a/common/vfs_types.h b/common/vfs_types.h
index 609a78b..753f5c5 100644
--- a/common/vfs_types.h
+++ b/common/vfs_types.h
@@ -35,7 +35,7 @@ typedef void (* TVFSLogFunc)(char *s);
typedef int (* TVFSCopyCallBackFunc)(u_int64_t iPos, u_int64_t iMax, void *data);
typedef void *TVFSFileDes;
-static const int cVFSVersion = 3; // current version of the VFS API
+static const int cVFSVersion = 4; // current version of the VFS API
// Capabilities
static const int capVFS_nil = 0;
@@ -91,7 +91,8 @@ enum TVFSItemType {
struct TVFSItem {
- char *sFileName;
+ char *FName;
+ char *FDisplayName;
u_int64_t iSize;
__time_t m_time; // numbers should be located before the other variables (bug?)
__time_t a_time;
diff --git a/common/vfsutils.c b/common/vfsutils.c
index cc54828..71080eb 100644
--- a/common/vfsutils.c
+++ b/common/vfsutils.c
@@ -48,7 +48,8 @@ void copy_vfs_item(struct TVFSItem *src, struct TVFSItem *dst)
void free_vfs_item(struct TVFSItem *item)
{
if (item) {
- if (item->sFileName) free(item->sFileName);
+ if (item->FName) free(item->FName);
+ if (item->FDisplayName) free(item->FDisplayName);
if (item->sLinkTo) free(item->sLinkTo);
free(item);
}