1
1
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Slava Zanko 2010-11-10 11:20:09 +02:00 коммит произвёл Andrew Borodin
родитель 32a9d93978
Коммит c57566af00
4 изменённых файлов: 25 добавлений и 25 удалений

Просмотреть файл

@ -208,13 +208,13 @@ lock_file (const char *fname)
/* Locking on VFS is not supported */ /* Locking on VFS is not supported */
if (!vfs_file_is_local (fname)) if (!vfs_file_is_local (fname))
{ {
g_free (fname); g_free ((gpointer) fname);
return 0; return 0;
} }
/* Check if already locked */ /* Check if already locked */
lockfname = lock_build_symlink_name (fname); lockfname = lock_build_symlink_name (fname);
g_free (fname); g_free ((gpointer) fname);
if (lockfname == NULL) if (lockfname == NULL)
return 0; return 0;
@ -280,7 +280,7 @@ unlock_file (const char *fname)
fname = tilde_expand (fname); fname = tilde_expand (fname);
lockfname = lock_build_symlink_name (fname); lockfname = lock_build_symlink_name (fname);
g_free (fname); g_free ((gpointer) fname);
if (lockfname == NULL) if (lockfname == NULL)
return 0; return 0;

Просмотреть файл

@ -1629,7 +1629,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
struct vfs_s_entry *ent; struct vfs_s_entry *ent;
struct vfs_s_super *super = dir->super; struct vfs_s_super *super = dir->super;
int sock, num_entries = 0; int sock, num_entries = 0;
char buffer[BUF_8K]; char lc_buffer[BUF_8K];
int cd_first; int cd_first;
cd_first = ftpfs_first_cd_then_ls || (SUP.strict == RFC_STRICT) cd_first = ftpfs_first_cd_then_ls || (SUP.strict == RFC_STRICT)
@ -1677,7 +1677,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
while (1) while (1)
{ {
int i; int i;
int res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), int res = vfs_s_get_line_interruptible (me, lc_buffer, sizeof (lc_buffer),
sock); sock);
if (!res) if (!res)
break; break;
@ -1694,14 +1694,14 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
if (MEDATA->logfile) if (MEDATA->logfile)
{ {
fputs (buffer, MEDATA->logfile); fputs (lc_buffer, MEDATA->logfile);
fputs ("\n", MEDATA->logfile); fputs ("\n", MEDATA->logfile);
fflush (MEDATA->logfile); fflush (MEDATA->logfile);
} }
ent = vfs_s_generate_entry (me, NULL, dir, 0); ent = vfs_s_generate_entry (me, NULL, dir, 0);
i = ent->ino->st.st_nlink; i = ent->ino->st.st_nlink;
if (!vfs_parse_ls_lga (buffer, &ent->ino->st, &ent->name, &ent->ino->linkname)) if (!vfs_parse_ls_lga (lc_buffer, &ent->ino->st, &ent->name, &ent->ino->linkname))
{ {
vfs_s_free_entry (me, ent); vfs_s_free_entry (me, ent);
continue; continue;
@ -1765,7 +1765,7 @@ ftpfs_file_store (struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *l
#else #else
int flag_one = 1; int flag_one = 1;
#endif #endif
char buffer[8192]; char lc_buffer[8192];
struct stat s; struct stat s;
char *w_buf; char *w_buf;
struct vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
@ -1793,7 +1793,7 @@ ftpfs_file_store (struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *l
tty_enable_interrupt_key (); tty_enable_interrupt_key ();
while (1) while (1)
{ {
while ((n_read = read (h, buffer, sizeof (buffer))) == -1) while ((n_read = read (h, lc_buffer, sizeof (lc_buffer))) == -1)
{ {
if (errno == EINTR) if (errno == EINTR)
{ {
@ -1811,7 +1811,7 @@ ftpfs_file_store (struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *l
if (n_read == 0) if (n_read == 0)
break; break;
n_stored += n_read; n_stored += n_read;
w_buf = buffer; w_buf = lc_buffer;
while ((n_written = write (sock, w_buf, n_read)) != n_read) while ((n_written = write (sock, w_buf, n_read)) != n_read)
{ {
if (n_written == -1) if (n_written == -1)

Просмотреть файл

@ -375,7 +375,7 @@ fetch_hosts (const char *filename)
{ {
FILE *file = fopen (filename, "r"); FILE *file = fopen (filename, "r");
char buffer[256], *name; char buffer[256], *name;
char *start; char *lc_start;
char *bi; char *bi;
if (!file) if (!file)
@ -420,12 +420,12 @@ fetch_hosts (const char *filename)
str_next_char (&bi); str_next_char (&bi);
if (bi[0] == '#') if (bi[0] == '#')
continue; continue;
for (start = bi; bi[0] != '\0' && !str_isspace (bi); str_next_char (&bi)); for (lc_start = bi; bi[0] != '\0' && !str_isspace (bi); str_next_char (&bi));
if (bi - start == 0) if (bi - lc_start == 0)
continue; continue;
name = g_strndup (start, bi - start); name = g_strndup (lc_start, bi - lc_start);
{ {
char **host_p; char **host_p;
@ -789,7 +789,7 @@ completion_matches (const char *text, CompletionFunction entry_function, INPUT_C
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Check if directory completion is needed */ /** Check if directory completion is needed */
static int static int
check_is_cd (const char *text, int start, INPUT_COMPLETE_FLAGS flags) check_is_cd (const char *text, int lc_start, INPUT_COMPLETE_FLAGS flags)
{ {
char *p, *q; char *p, *q;
int test = 0; int test = 0;
@ -800,7 +800,7 @@ check_is_cd (const char *text, int start, INPUT_COMPLETE_FLAGS flags)
/* Skip initial spaces */ /* Skip initial spaces */
p = (char *) text; p = (char *) text;
q = (char *) text + start; q = (char *) text + lc_start;
while (p < q && p[0] != '\0' && str_isspace (p)) while (p < q && p[0] != '\0' && str_isspace (p))
str_next_char (&p); str_next_char (&p);
@ -819,18 +819,18 @@ check_is_cd (const char *text, int start, INPUT_COMPLETE_FLAGS flags)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Returns an array of matches, or NULL if none. */ /** Returns an array of matches, or NULL if none. */
static char ** static char **
try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags) try_complete (char *text, int *lc_start, int *lc_end, INPUT_COMPLETE_FLAGS flags)
{ {
int in_command_position = 0; int in_command_position = 0;
char *word; char *word;
char **matches = NULL; char **matches = NULL;
const char *command_separator_chars = ";|&{(`"; const char *command_separator_chars = ";|&{(`";
char *p = NULL, *q = NULL, *r = NULL; char *p = NULL, *q = NULL, *r = NULL;
int is_cd = check_is_cd (text, *start, flags); int is_cd = check_is_cd (text, *lc_start, flags);
char *ti; char *ti;
SHOW_C_CTX ("try_complete"); SHOW_C_CTX ("try_complete");
word = g_strndup (text + *start, *end - *start); word = g_strndup (text + *lc_start, *lc_end - *lc_start);
/* Determine if this could be a command word. It is if it appears at /* Determine if this could be a command word. It is if it appears at
the start of the line (ignoring preceding whitespace), or if it the start of the line (ignoring preceding whitespace), or if it
@ -838,7 +838,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
be in a INPUT_COMPLETE_COMMANDS flagged Input line. */ be in a INPUT_COMPLETE_COMMANDS flagged Input line. */
if (!is_cd && (flags & INPUT_COMPLETE_COMMANDS)) if (!is_cd && (flags & INPUT_COMPLETE_COMMANDS))
{ {
ti = str_get_prev_char (&text[*start]); ti = str_get_prev_char (&text[*lc_start]);
while (ti > text && (ti[0] == ' ' || ti[0] == '\t')) while (ti > text && (ti[0] == ' ' || ti[0] == '\t'))
str_prev_char (&ti); str_prev_char (&ti);
if (ti <= text && (ti[0] == ' ' || ti[0] == '\t')) if (ti <= text && (ti[0] == ' ' || ti[0] == '\t'))
@ -887,7 +887,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
command_completion_function, command_completion_function,
flags & (~INPUT_COMPLETE_FILENAMES)); flags & (~INPUT_COMPLETE_FILENAMES));
if (matches) if (matches)
*start += str_get_next_char (p) - word; *lc_start += str_get_next_char (p) - word;
} }
/* Variable name? */ /* Variable name? */
@ -896,7 +896,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
SHOW_C_CTX ("try_complete:var_subst"); SHOW_C_CTX ("try_complete:var_subst");
matches = completion_matches (q, variable_completion_function, flags); matches = completion_matches (q, variable_completion_function, flags);
if (matches) if (matches)
*start += q - word; *lc_start += q - word;
} }
/* Starts with '@', then look through the known hostnames for /* Starts with '@', then look through the known hostnames for
@ -906,7 +906,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
SHOW_C_CTX ("try_complete:host_subst"); SHOW_C_CTX ("try_complete:host_subst");
matches = completion_matches (r, hostname_completion_function, flags); matches = completion_matches (r, hostname_completion_function, flags);
if (matches) if (matches)
*start += r - word; *lc_start += r - word;
} }
/* Starts with `~' and there is no slash in the word, then /* Starts with `~' and there is no slash in the word, then
@ -937,7 +937,7 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
matches = completion_matches (word, filename_completion_function, flags); matches = completion_matches (word, filename_completion_function, flags);
if (!matches && is_cd && *word != PATH_SEP && *word != '~') if (!matches && is_cd && *word != PATH_SEP && *word != '~')
{ {
q = text + *start; q = text + *lc_start;
for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); str_next_char (&p)); for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); str_next_char (&p));
if (!strncmp (p, "cd", 2)) if (!strncmp (p, "cd", 2))
for (p += 2; *p && p < q && (*p == ' ' || *p == '\t'); str_next_char (&p)); for (p += 2; *p && p < q && (*p == ' ' || *p == '\t'); str_next_char (&p));

Просмотреть файл

@ -635,7 +635,7 @@ find_parameters (char **start_dir, char **pattern, char **content)
*content = (options.content_use && in_with->buffer[0] != '\0') *content = (options.content_use && in_with->buffer[0] != '\0')
? g_strdup (in_with->buffer) : NULL; ? g_strdup (in_with->buffer) : NULL;
*start_dir = in_start->buffer[0] != '\0' ? in_start->buffer : "."; *start_dir = in_start->buffer[0] != '\0' ? in_start->buffer : (char *) ".";
*pattern = g_strdup (in_name->buffer); *pattern = g_strdup (in_name->buffer);
if (in_start_dir != INPUT_LAST_TEXT) if (in_start_dir != INPUT_LAST_TEXT)
g_free (in_start_dir); g_free (in_start_dir);