mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
VFS: don't use vfs_s_inode::data_offset for file name normalization.
Use new member vfs_s_entry::leading_spaces for that. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
52fd6215b0
commit
5db6715a5f
@ -1720,18 +1720,18 @@ vfs_s_normalize_filename_leading_spaces (struct vfs_s_inode *root_inode, size_t
|
|||||||
{
|
{
|
||||||
struct vfs_s_entry *entry = VFS_ENTRY (iter->data);
|
struct vfs_s_entry *entry = VFS_ENTRY (iter->data);
|
||||||
|
|
||||||
if ((size_t) entry->ino->data_offset > final_num_spaces)
|
if ((size_t) entry->leading_spaces > final_num_spaces)
|
||||||
{
|
{
|
||||||
char *source_name, *spacer;
|
char *source_name, *spacer;
|
||||||
|
|
||||||
source_name = entry->name;
|
source_name = entry->name;
|
||||||
spacer = g_strnfill (entry->ino->data_offset - final_num_spaces, ' ');
|
spacer = g_strnfill ((size_t) entry->leading_spaces - final_num_spaces, ' ');
|
||||||
entry->name = g_strconcat (spacer, source_name, (char *) NULL);
|
entry->name = g_strconcat (spacer, source_name, (char *) NULL);
|
||||||
g_free (spacer);
|
g_free (spacer);
|
||||||
g_free (source_name);
|
g_free (source_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->ino->data_offset = -1;
|
entry->leading_spaces = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ struct vfs_s_entry
|
|||||||
struct vfs_s_inode *dir; /* Directory we are in, i.e. our parent */
|
struct vfs_s_inode *dir; /* Directory we are in, i.e. our parent */
|
||||||
char *name; /* Name of this entry */
|
char *name; /* Name of this entry */
|
||||||
struct vfs_s_inode *ino; /* ... and its inode */
|
struct vfs_s_inode *ino; /* ... and its inode */
|
||||||
|
ssize_t leading_spaces; /* number of leading spases in the file name */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Single virtual file - inode */
|
/* Single virtual file - inode */
|
||||||
@ -197,7 +198,7 @@ void vfs_s_normalize_filename_leading_spaces (struct vfs_s_inode *root_inode, si
|
|||||||
static inline void
|
static inline void
|
||||||
vfs_s_store_filename_leading_spaces (struct vfs_s_entry *entry, size_t position)
|
vfs_s_store_filename_leading_spaces (struct vfs_s_entry *entry, size_t position)
|
||||||
{
|
{
|
||||||
entry->ino->data_offset = (off_t) position;
|
entry->leading_spaces = (ssize_t) position;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user