mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Ticket #123: fixed types to avoid file size limitation in VFS layer.
Fixed modifiers and removed types recastin in envoronment variables and messages forming. Minor code cleanup. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
bae864990e
commit
232ca56501
@ -974,15 +974,15 @@ vfs_s_print_stats (const char *fs_name, const char *action,
|
|||||||
|
|
||||||
if (i18n_percent_transf_format == NULL)
|
if (i18n_percent_transf_format == NULL)
|
||||||
{
|
{
|
||||||
i18n_percent_transf_format = _("%s: %s: %s %3d%% (%lu bytes transferred)");
|
i18n_percent_transf_format = _("%s: %s: %s %3d%% (%ju bytes transferred)");
|
||||||
i18n_transf_format = _("%s: %s: %s %lu bytes transferred");
|
i18n_transf_format = _("%s: %s: %s %ju bytes transferred");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need)
|
if (need)
|
||||||
print_vfs_message (i18n_percent_transf_format, fs_name, action,
|
print_vfs_message (i18n_percent_transf_format, fs_name, action,
|
||||||
file_name, (int) ((double) have * 100 / need), (unsigned long) have);
|
file_name, (int) ((double) have * 100 / need), have);
|
||||||
else
|
else
|
||||||
print_vfs_message (i18n_transf_format, fs_name, action, file_name, (unsigned long) have);
|
print_vfs_message (i18n_transf_format, fs_name, action, file_name, have);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -802,16 +802,16 @@ fish_file_store (struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *lo
|
|||||||
/* FIXME: File size is limited to ULONG_MAX */
|
/* FIXME: File size is limited to ULONG_MAX */
|
||||||
if (!fh->u.fish.append)
|
if (!fh->u.fish.append)
|
||||||
{
|
{
|
||||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILESIZE=%lu;\n",
|
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILESIZE=%ju;\n",
|
||||||
SUP.scr_append, (char *) NULL);
|
SUP.scr_append, (char *) NULL);
|
||||||
n = fish_command (me, super, WAIT_REPLY, shell_commands, quoted_name, (unsigned long) s.st_size);
|
n = fish_command (me, super, WAIT_REPLY, shell_commands, quoted_name, s.st_size);
|
||||||
g_free (shell_commands);
|
g_free (shell_commands);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILESIZE=%lu;\n",
|
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILESIZE=%ju;\n",
|
||||||
SUP.scr_send, (char *) NULL);
|
SUP.scr_send, (char *) NULL);
|
||||||
n = fish_command (me, super, WAIT_REPLY, shell_commands, quoted_name, (unsigned long) s.st_size);
|
n = fish_command (me, super, WAIT_REPLY, shell_commands, quoted_name, s.st_size);
|
||||||
g_free (shell_commands);
|
g_free (shell_commands);
|
||||||
}
|
}
|
||||||
if (n != PRELIM)
|
if (n != PRELIM)
|
||||||
@ -848,8 +848,8 @@ fish_file_store (struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *lo
|
|||||||
}
|
}
|
||||||
tty_disable_interrupt_key ();
|
tty_disable_interrupt_key ();
|
||||||
total += n;
|
total += n;
|
||||||
print_vfs_message (_("fish: storing %s %d (%lu)"),
|
print_vfs_message (_("fish: storing %s %d (%ju)"),
|
||||||
was_error ? _("zeros") : _("file"), total, (unsigned long) s.st_size);
|
was_error ? _("zeros") : _("file"), total, s.st_size);
|
||||||
}
|
}
|
||||||
close (h);
|
close (h);
|
||||||
g_free (quoted_name);
|
g_free (quoted_name);
|
||||||
@ -885,10 +885,9 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
|
|||||||
* standard output (i.e. over the network).
|
* standard output (i.e. over the network).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_START_OFFSET=%lu;\n",
|
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_START_OFFSET=%ju;\n",
|
||||||
SUP.scr_get, (char *) NULL);
|
SUP.scr_get, (char *) NULL);
|
||||||
offset = fish_command (me, super, WANT_STRING, shell_commands, quoted_name,
|
offset = fish_command (me, super, WANT_STRING, shell_commands, quoted_name, offset);
|
||||||
(unsigned long) offset);
|
|
||||||
g_free (shell_commands);
|
g_free (shell_commands);
|
||||||
g_free (quoted_name);
|
g_free (quoted_name);
|
||||||
if (offset != PRELIM)
|
if (offset != PRELIM)
|
||||||
@ -897,9 +896,9 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
|
|||||||
fh->u.fish.got = 0;
|
fh->u.fish.got = 0;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
#if SIZEOF_OFF_T == SIZEOF_LONG
|
#if SIZEOF_OFF_T == SIZEOF_LONG
|
||||||
fh->u.fish.total = strtol (reply_str, NULL, 10);
|
fh->u.fish.total = (off_t) strtol (reply_str, NULL, 10);
|
||||||
#else
|
#else
|
||||||
fh->u.fish.total = strtoll (reply_str, NULL, 10);
|
fh->u.fish.total = (off_t) strtoll (reply_str, NULL, 10);
|
||||||
#endif
|
#endif
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
ERRNOR (E_REMOTE, 0);
|
ERRNOR (E_REMOTE, 0);
|
||||||
@ -1016,8 +1015,8 @@ fish_send_command (struct vfs_class *me, struct vfs_s_super *super, const char *
|
|||||||
crpath = vfs_s_get_path_mangle (me, mpath, &super, 0); \
|
crpath = vfs_s_get_path_mangle (me, mpath, &super, 0); \
|
||||||
if (crpath == NULL) \
|
if (crpath == NULL) \
|
||||||
{ \
|
{ \
|
||||||
g_free (mpath); \
|
g_free (mpath); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
rpath = strutils_shell_escape (crpath); \
|
rpath = strutils_shell_escape (crpath); \
|
||||||
g_free (mpath);
|
g_free (mpath);
|
||||||
@ -1064,13 +1063,16 @@ fish_link (struct vfs_class *me, const char *path1, const char *path2)
|
|||||||
const char *crpath1, *crpath2;
|
const char *crpath1, *crpath2;
|
||||||
char *rpath1, *rpath2, *mpath1, *mpath2;
|
char *rpath1, *rpath2, *mpath1, *mpath2;
|
||||||
struct vfs_s_super *super, *super2;
|
struct vfs_s_super *super, *super2;
|
||||||
crpath1 = vfs_s_get_path_mangle (me, mpath1 = g_strdup(path1), &super, 0);
|
|
||||||
|
mpath1 = g_strdup (path1);
|
||||||
|
crpath1 = vfs_s_get_path_mangle (me, mpath1, &super, 0);
|
||||||
if (crpath1 == NULL)
|
if (crpath1 == NULL)
|
||||||
{
|
{
|
||||||
g_free (mpath1);
|
g_free (mpath1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
crpath2 = vfs_s_get_path_mangle (me, mpath2 = g_strdup(path2), &super2, 0);
|
mpath2 = g_strdup (path2);
|
||||||
|
crpath2 = vfs_s_get_path_mangle (me, mpath2, &super2, 0);
|
||||||
if (crpath2 == NULL)
|
if (crpath2 == NULL)
|
||||||
{
|
{
|
||||||
g_free (mpath1);
|
g_free (mpath1);
|
||||||
@ -1097,8 +1099,10 @@ fish_symlink (struct vfs_class *me, const char *setto, const char *path)
|
|||||||
gchar *shell_commands = NULL;
|
gchar *shell_commands = NULL;
|
||||||
char buf[BUF_LARGE];
|
char buf[BUF_LARGE];
|
||||||
const char *crpath;
|
const char *crpath;
|
||||||
char *rpath, *mpath = g_strdup (path);
|
char *rpath, *mpath;
|
||||||
struct vfs_s_super *super;
|
struct vfs_s_super *super;
|
||||||
|
|
||||||
|
mpath = g_strdup (path);
|
||||||
crpath = vfs_s_get_path_mangle (me, mpath, &super, 0);
|
crpath = vfs_s_get_path_mangle (me, mpath, &super, 0);
|
||||||
if (crpath == NULL)
|
if (crpath == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1660,8 +1660,7 @@ ftpfs_file_store (struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *l
|
|||||||
w_buf += n_written;
|
w_buf += n_written;
|
||||||
n_read -= n_written;
|
n_read -= n_written;
|
||||||
}
|
}
|
||||||
print_vfs_message (_("ftpfs: storing file %lu (%lu)"),
|
print_vfs_message (_("ftpfs: storing file %ju (%ju)"), n_stored, s.st_size);
|
||||||
(unsigned long) n_stored, (unsigned long) s.st_size);
|
|
||||||
}
|
}
|
||||||
tty_disable_interrupt_key ();
|
tty_disable_interrupt_key ();
|
||||||
close (sock);
|
close (sock);
|
||||||
|
@ -125,14 +125,14 @@ struct vfs_s_inode
|
|||||||
char *linkname; /* Symlink's contents */
|
char *linkname; /* Symlink's contents */
|
||||||
char *localname; /* Filename of local file, if we have one */
|
char *localname; /* Filename of local file, if we have one */
|
||||||
struct timeval timestamp; /* Subclass specific */
|
struct timeval timestamp; /* Subclass specific */
|
||||||
long data_offset; /* Subclass specific */
|
off_t data_offset; /* Subclass specific */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Data associated with an open file */
|
/* Data associated with an open file */
|
||||||
struct vfs_s_fh
|
struct vfs_s_fh
|
||||||
{
|
{
|
||||||
struct vfs_s_inode *ino;
|
struct vfs_s_inode *ino;
|
||||||
long pos; /* This is for module's use */
|
off_t pos; /* This is for module's use */
|
||||||
int handle; /* This is for module's use, but if != -1, will be mc_close()d */
|
int handle; /* This is for module's use, but if != -1, will be mc_close()d */
|
||||||
int changed; /* Did this file change? */
|
int changed; /* Did this file change? */
|
||||||
int linear; /* Is that file open with O_LINEAR? */
|
int linear; /* Is that file open with O_LINEAR? */
|
||||||
|
Loading…
Reference in New Issue
Block a user