1
1

Cleanup of code for compile with new warnings options for compilator

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Slava Zanko 2009-10-30 03:12:04 +02:00
родитель a5fa537f2e
Коммит 51f10b3038
50 изменённых файлов: 528 добавлений и 540 удалений

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

@ -803,6 +803,7 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename,
edit->utf8 = 0; edit->utf8 = 0;
edit->converter = str_cnv_from_term; edit->converter = str_cnv_from_term;
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
{
const char *cp_id = NULL; const char *cp_id = NULL;
cp_id = get_codepage_id (source_codepage >= 0 ? cp_id = get_codepage_id (source_codepage >= 0 ?
source_codepage : display_codepage); source_codepage : display_codepage);
@ -818,6 +819,7 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename,
} }
if (cp_id != NULL) if (cp_id != NULL)
edit->utf8 = str_isutf8 (cp_id); edit->utf8 = str_isutf8 (cp_id);
}
#endif #endif
edit->loading_done = 1; edit->loading_done = 1;
@ -1186,7 +1188,7 @@ edit_insert (WEdit *edit, int c)
edit->curs1++; edit->curs1++;
} }
void static void
edit_insert_over (WEdit * edit) edit_insert_over (WEdit * edit)
{ {
int i; int i;

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

@ -629,36 +629,36 @@ static char *next_file (void)
static void apply_advanced_chowns (struct stat *sf) static void apply_advanced_chowns (struct stat *sf)
{ {
char *fname; char *lc_fname;
gid_t a_gid = sf->st_gid; gid_t a_gid = sf->st_gid;
uid_t a_uid = sf->st_uid; uid_t a_uid = sf->st_uid;
fname = current_panel->dir.list[current_file].fname; lc_fname = current_panel->dir.list[current_file].fname;
need_update = end_chown = 1; need_update = end_chown = 1;
if (mc_chmod (fname, get_mode ()) == -1) if (mc_chmod (lc_fname, get_mode ()) == -1)
message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "), message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "),
fname, unix_error_string (errno)); lc_fname, unix_error_string (errno));
/* call mc_chown only, if mc_chmod didn't fail */ /* call mc_chown only, if mc_chmod didn't fail */
else if (mc_chown (fname, (ch_flags[9] == '+') ? sf->st_uid : (uid_t) -1, else if (mc_chown (lc_fname, (ch_flags[9] == '+') ? sf->st_uid : (uid_t) -1,
(ch_flags[10] == '+') ? sf->st_gid : (gid_t) -1) == -1) (ch_flags[10] == '+') ? sf->st_gid : (gid_t) -1) == -1)
message (D_ERROR, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "), message (D_ERROR, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
fname, unix_error_string (errno)); lc_fname, unix_error_string (errno));
do_file_mark (current_panel, current_file, 0); do_file_mark (current_panel, current_file, 0);
do { do {
fname = next_file (); lc_fname = next_file ();
if (mc_stat (fname, sf) != 0) if (mc_stat (lc_fname, sf) != 0)
break; break;
ch_cmode = sf->st_mode; ch_cmode = sf->st_mode;
if (mc_chmod (fname, get_mode ()) == -1) if (mc_chmod (lc_fname, get_mode ()) == -1)
message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "), message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "),
fname, unix_error_string (errno)); lc_fname, unix_error_string (errno));
/* call mc_chown only, if mc_chmod didn't fail */ /* call mc_chown only, if mc_chmod didn't fail */
else if (mc_chown (fname, (ch_flags[9] == '+') ? a_uid : (uid_t) -1, else if (mc_chown (lc_fname, (ch_flags[9] == '+') ? a_uid : (uid_t) -1,
(ch_flags[10] == '+') ? a_gid : (gid_t) -1) == -1) (ch_flags[10] == '+') ? a_gid : (gid_t) -1) == -1)
message (D_ERROR, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "), message (D_ERROR, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
fname, unix_error_string (errno)); lc_fname, unix_error_string (errno));
do_file_mark (current_panel, current_file, 0); do_file_mark (current_panel, current_file, 0);
} while (current_panel->marked); } while (current_panel->marked);

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

@ -88,7 +88,7 @@ register_task_running (FileOpContext *ctx, pid_t pid, int fd, int to_child,
add_select_channel (fd, background_attention, ctx); add_select_channel (fd, background_attention, ctx);
} }
int static int
destroy_task_and_return_fd (pid_t pid) destroy_task_and_return_fd (pid_t pid)
{ {
TaskList *p = task_list; TaskList *p = task_list;

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

@ -975,7 +975,7 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain,
static int dialog_x = 44; static int dialog_x = 44;
enum { b0 = 3, dialog_y = 12}; enum { b0 = 3, dialog_y = 12};
struct smb_authinfo *return_value; struct smb_authinfo *return_value;
static const char* labs[] = {N_("Domain:"), N_("Username:"), N_("Password:")}; static const char* lc_labs[] = {N_("Domain:"), N_("Username:"), N_("Password:")};
static const char* buts[] = {N_("&OK"), N_("&Cancel")}; static const char* buts[] = {N_("&OK"), N_("&Cancel")};
static int ilen = 30, istart = 14; static int ilen = 30, istart = 14;
static int b2 = 30; static int b2 = 30;
@ -990,12 +990,12 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain,
if (!i18n_flag) if (!i18n_flag)
{ {
register int i = sizeof(labs)/sizeof(labs[0]); register int i = sizeof(lc_labs)/sizeof(lc_labs[0]);
int l1, maxlen = 0; int l1, maxlen = 0;
while (i--) while (i--)
{ {
l1 = str_term_width1 (labs [i] = _(labs [i])); l1 = str_term_width1 (lc_labs [i] = _(lc_labs [i]));
if (l1 > maxlen) if (l1 > maxlen)
maxlen = l1; maxlen = l1;
} }
@ -1048,9 +1048,9 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain,
in_password->is_password = 1; in_password->is_password = 1;
add_widget (auth_dlg, in_password); add_widget (auth_dlg, in_password);
add_widget (auth_dlg, label_new (7, 3, labs[2])); add_widget (auth_dlg, label_new (7, 3, lc_labs[2]));
add_widget (auth_dlg, label_new (5, 3, labs[1])); add_widget (auth_dlg, label_new (5, 3, lc_labs[1]));
add_widget (auth_dlg, label_new (3, 3, labs[0])); add_widget (auth_dlg, label_new (3, 3, lc_labs[0]));
run_dlg (auth_dlg); run_dlg (auth_dlg);

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

@ -118,7 +118,7 @@ examine_cd (const char *_path)
/* CDPATH handling */ /* CDPATH handling */
if (*q != PATH_SEP && !result) { if (*q != PATH_SEP && !result) {
char * const cdpath = g_strdup (getenv ("CDPATH")); char * const cdpath = g_strdup (getenv ("CDPATH"));
char *p = cdpath; p = cdpath;
if (p == NULL) if (p == NULL)
c = 0; c = 0;
else else
@ -173,7 +173,7 @@ void do_cd_command (char * orig_cmd)
sync_tree (home_dir); sync_tree (home_dir);
} else if (strcmp (cmd+3, "..") == 0){ } else if (strcmp (cmd+3, "..") == 0){
char *dir = current_panel->cwd; char *dir = current_panel->cwd;
int len = strlen (dir); len = strlen (dir);
while (len && dir [--len] != PATH_SEP); while (len && dir [--len] != PATH_SEP);
dir [len] = 0; dir [len] = 0;
if (len) if (len)
@ -201,9 +201,9 @@ void do_cd_command (char * orig_cmd)
/* Handle Enter on the command line */ /* Handle Enter on the command line */
static cb_ret_t static cb_ret_t
enter (WInput *cmdline) enter (WInput *lc_cmdline)
{ {
char *cmd = cmdline->buffer; char *cmd = lc_cmdline->buffer;
if (!command_prompt) if (!command_prompt)
return MSG_HANDLED; return MSG_HANDLED;
@ -217,7 +217,7 @@ enter (WInput *cmdline)
if (strncmp (cmd, "cd ", 3) == 0 || strcmp (cmd, "cd") == 0) { if (strncmp (cmd, "cd ", 3) == 0 || strcmp (cmd, "cd") == 0) {
do_cd_command (cmd); do_cd_command (cmd);
new_input (cmdline); new_input (lc_cmdline);
return MSG_HANDLED; return MSG_HANDLED;
} else { } else {
char *command, *s; char *command, *s;
@ -261,7 +261,7 @@ enter (WInput *cmdline)
} }
command[j] = 0; command[j] = 0;
} }
new_input (cmdline); new_input (lc_cmdline);
shell_execute (command, 0); shell_execute (command, 0);
g_free (command); g_free (command);

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

@ -811,14 +811,14 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags)
SHOW_C_CTX("try_complete:filename_subst_1"); SHOW_C_CTX("try_complete:filename_subst_1");
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 != '~'){
char *p, *q = text + *start; q = text + *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));
if (p == q){ if (p == q){
char * const cdpath_ref = g_strdup (getenv ("CDPATH")); char * const cdpath_ref = g_strdup (getenv ("CDPATH"));
char *cdpath = cdpath_ref; char *cdpath = cdpath_ref;
char c, *s, *r; char c, *s;
if (cdpath == NULL) if (cdpath == NULL)
c = 0; c = 0;
@ -1054,8 +1054,8 @@ complete_engine (WInput *in, int what_to_do)
if (in->completions){ if (in->completions){
if (what_to_do & DO_INSERTION || ((what_to_do & DO_QUERY) && !in->completions[1])) { if (what_to_do & DO_INSERTION || ((what_to_do & DO_QUERY) && !in->completions[1])) {
char * complete = in->completions [0]; char * lc_complete = in->completions [0];
if (insert_text (in, complete, strlen (complete))){ if (insert_text (in, lc_complete, strlen (lc_complete))){
if (in->completions [1]) if (in->completions [1])
tty_beep (); tty_beep ();
else else

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

@ -70,16 +70,16 @@ static void
send_contents (char *buffer, unsigned int columns, unsigned int rows) send_contents (char *buffer, unsigned int columns, unsigned int rows)
{ {
unsigned char begin_line = 0, end_line = 0; unsigned char begin_line = 0, end_line = 0;
unsigned int lastline, index, x; unsigned int lastline, lc_index, x;
unsigned char message, outbuf[1024], *p; unsigned char message, outbuf[1024], *p;
unsigned short bytes; unsigned short bytes;
index = 2 * rows * columns; lc_index = 2 * rows * columns;
for (lastline = rows; lastline > 0; lastline--) for (lastline = rows; lastline > 0; lastline--)
for (x = 0; x < columns; x++) for (x = 0; x < columns; x++)
{ {
index -= 2; lc_index -= 2;
if (buffer [index] != ' ') if (buffer [lc_index] != ' ')
goto out; goto out;
} }
out: out:
@ -94,20 +94,20 @@ out:
if (end_line > lastline) if (end_line > lastline)
end_line = lastline; end_line = lastline;
index = (end_line - begin_line) * columns; lc_index = (end_line - begin_line) * columns;
bytes = index; bytes = lc_index;
if (index != bytes) if (lc_index != bytes)
bytes = 0; bytes = 0;
write (1, &bytes, 2); write (1, &bytes, 2);
if (! bytes) if (! bytes)
return; return;
p = outbuf; p = outbuf;
for (index = 2 * begin_line * columns; for (lc_index = 2 * begin_line * columns;
index < 2 * end_line * columns; lc_index < 2 * end_line * columns;
index += 2) lc_index += 2)
{ {
*p++ = buffer [index]; *p++ = buffer [lc_index];
if (p == outbuf + sizeof (outbuf)) if (p == outbuf + sizeof (outbuf))
{ {
write (1, outbuf, sizeof (outbuf)); write (1, outbuf, sizeof (outbuf));

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

@ -257,10 +257,10 @@ clean_dir (dir_list *list, int count)
} }
static int static int
add_dotdot_to_list (dir_list *list, int index) add_dotdot_to_list (dir_list *list, int lc_index)
{ {
/* Need to grow the *list? */ /* Need to grow the *list? */
if (index == list->size) { if (lc_index == list->size) {
list->list = g_realloc (list->list, sizeof (file_entry) * list->list = g_realloc (list->list, sizeof (file_entry) *
(list->size + RESIZE_STEPS)); (list->size + RESIZE_STEPS));
if (!list->list) if (!list->list)
@ -268,14 +268,14 @@ add_dotdot_to_list (dir_list *list, int index)
list->size += RESIZE_STEPS; list->size += RESIZE_STEPS;
} }
memset (&(list->list) [index], 0, sizeof(file_entry)); memset (&(list->list) [lc_index], 0, sizeof(file_entry));
(list->list) [index].fnamelen = 2; (list->list) [lc_index].fnamelen = 2;
(list->list) [index].fname = g_strdup (".."); (list->list) [lc_index].fname = g_strdup ("..");
(list->list) [index].f.link_to_dir = 0; (list->list) [lc_index].f.link_to_dir = 0;
(list->list) [index].f.stale_link = 0; (list->list) [lc_index].f.stale_link = 0;
(list->list) [index].f.dir_size_computed = 0; (list->list) [lc_index].f.dir_size_computed = 0;
(list->list) [index].f.marked = 0; (list->list) [lc_index].f.marked = 0;
(list->list) [index].st.st_mode = 040755; (list->list) [lc_index].st.st_mode = 040755;
return 1; return 1;
} }
@ -382,8 +382,8 @@ handle_path (dir_list *list, const char *path,
} }
int int
do_load_dir (const char *path, dir_list *list, sortfn *sort, int reverse, do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse,
int case_sensitive, int exec_ff, const char *filter) int lc_case_sensitive, int exec_ff, const char *filter)
{ {
DIR *dirp; DIR *dirp;
struct dirent *dp; struct dirent *dp;
@ -431,7 +431,7 @@ do_load_dir (const char *path, dir_list *list, sortfn *sort, int reverse,
} }
if (next_free) { if (next_free) {
do_sort (list, sort, next_free - 1, reverse, case_sensitive, exec_ff); do_sort (list, sort, next_free - 1, lc_reverse, lc_case_sensitive, exec_ff);
} }
mc_closedir (dirp); mc_closedir (dirp);
@ -490,7 +490,7 @@ alloc_dir_copy (int size)
/* If filter is null, then it is a match */ /* If filter is null, then it is a match */
int int
do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count, do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
int rev, int case_sensitive, int exec_ff, const char *filter) int rev, int lc_case_sensitive, int exec_ff, const char *filter)
{ {
DIR *dirp; DIR *dirp;
struct dirent *dp; struct dirent *dp;
@ -591,7 +591,7 @@ do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
tree_store_end_check (); tree_store_end_check ();
g_hash_table_destroy (marked_files); g_hash_table_destroy (marked_files);
if (next_free) { if (next_free) {
do_sort (list, sort, next_free - 1, rev, case_sensitive, exec_ff); do_sort (list, sort, next_free - 1, rev, lc_case_sensitive, exec_ff);
} }
clean_dir (&dir_copy, count); clean_dir (&dir_copy, count);
return next_free; return next_free;

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

@ -112,7 +112,7 @@ do_possible_cd (const char *new_dir)
#endif /* HAVE_SUBSHELL_SUPPORT */ #endif /* HAVE_SUBSHELL_SUPPORT */
static void static void
do_execute (const char *shell, const char *command, int flags) do_execute (const char *lc_shell, const char *command, int flags)
{ {
#ifdef HAVE_SUBSHELL_SUPPORT #ifdef HAVE_SUBSHELL_SUPPORT
char *new_dir = NULL; char *new_dir = NULL;
@ -146,7 +146,7 @@ do_execute (const char *shell, const char *command, int flags)
#endif /* !USE_VFS */ #endif /* !USE_VFS */
} else } else
#endif /* HAVE_SUBSHELL_SUPPORT */ #endif /* HAVE_SUBSHELL_SUPPORT */
my_system (flags, shell, command); my_system (flags, lc_shell, command);
if (!(flags & EXECUTE_INTERNAL)) { if (!(flags & EXECUTE_INTERNAL)) {
if ((pause_after_run == pause_always if ((pause_after_run == pause_always

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

@ -64,7 +64,7 @@ flush_extension_file (void)
typedef char *(*quote_func_t) (const char *name, int quote_percent); typedef char *(*quote_func_t) (const char *name, int quote_percent);
static void static void
exec_extension (const char *filename, const char *data, int *move_dir, exec_extension (const char *filename, const char *lc_data, int *move_dir,
int start_line) int start_line)
{ {
char *fn; char *fn;
@ -74,7 +74,7 @@ exec_extension (const char *filename, const char *data, int *move_dir,
char *cmd = NULL; char *cmd = NULL;
int expand_prefix_found = 0; int expand_prefix_found = 0;
int parameter_found = 0; int parameter_found = 0;
char prompt[80]; char lc_prompt[80];
int run_view = 0; int run_view = 0;
int def_hex_mode = mcview_default_hex_mode, changed_hex_mode = 0; int def_hex_mode = mcview_default_hex_mode, changed_hex_mode = 0;
int def_nroff_flag = mcview_default_nroff_flag, changed_nroff_flag = 0; int def_nroff_flag = mcview_default_nroff_flag, changed_nroff_flag = 0;
@ -89,7 +89,7 @@ exec_extension (const char *filename, const char *data, int *move_dir,
quote_func_t quote_func = name_quote; quote_func_t quote_func = name_quote;
g_return_if_fail (filename != NULL); g_return_if_fail (filename != NULL);
g_return_if_fail (data != NULL); g_return_if_fail (lc_data != NULL);
/* Avoid making a local copy if we are doing a cd */ /* Avoid making a local copy if we are doing a cd */
if (!vfs_file_is_local (filename)) if (!vfs_file_is_local (filename))
@ -114,13 +114,13 @@ exec_extension (const char *filename, const char *data, int *move_dir,
cmd_file = fdopen (cmd_file_fd, "w"); cmd_file = fdopen (cmd_file_fd, "w");
fputs ("#! /bin/sh\n", cmd_file); fputs ("#! /bin/sh\n", cmd_file);
prompt[0] = 0; lc_prompt[0] = 0;
for (; *data && *data != '\n'; data++) { for (; *lc_data && *lc_data != '\n'; lc_data++) {
if (parameter_found) { if (parameter_found) {
if (*data == '}') { if (*lc_data == '}') {
char *parameter; char *parameter;
parameter_found = 0; parameter_found = 0;
parameter = input_dialog (_(" Parameter "), prompt, MC_HISTORY_EXT_PARAMETER, ""); parameter = input_dialog (_(" Parameter "), lc_prompt, MC_HISTORY_EXT_PARAMETER, "");
if (!parameter) { if (!parameter) {
/* User canceled */ /* User canceled */
fclose (cmd_file); fclose (cmd_file);
@ -136,38 +136,38 @@ exec_extension (const char *filename, const char *data, int *move_dir,
written_nonspace = 1; written_nonspace = 1;
g_free (parameter); g_free (parameter);
} else { } else {
size_t len = strlen (prompt); size_t len = strlen (lc_prompt);
if (len < sizeof (prompt) - 1) { if (len < sizeof (lc_prompt) - 1) {
prompt[len] = *data; lc_prompt[len] = *lc_data;
prompt[len + 1] = 0; lc_prompt[len + 1] = 0;
} }
} }
} else if (expand_prefix_found) { } else if (expand_prefix_found) {
expand_prefix_found = 0; expand_prefix_found = 0;
if (*data == '{') if (*lc_data == '{')
parameter_found = 1; parameter_found = 1;
else { else {
int i = check_format_view (data); int i = check_format_view (lc_data);
char *v; char *v;
if (i) { if (i) {
data += i - 1; lc_data += i - 1;
run_view = 1; run_view = 1;
} else if ((i = check_format_cd (data)) > 0) { } else if ((i = check_format_cd (lc_data)) > 0) {
is_cd = 1; is_cd = 1;
quote_func = fake_name_quote; quote_func = fake_name_quote;
do_local_copy = 0; do_local_copy = 0;
p = buffer; p = buffer;
data += i - 1; lc_data += i - 1;
} else if ((i = check_format_var (data, &v)) > 0 && v) { } else if ((i = check_format_var (lc_data, &v)) > 0 && v) {
fputs (v, cmd_file); fputs (v, cmd_file);
g_free (v); g_free (v);
data += i; lc_data += i;
} else { } else {
char *text; char *text;
if (*data == 'f') { if (*lc_data == 'f') {
if (do_local_copy) { if (do_local_copy) {
localcopy = mc_getlocalcopy (filename); localcopy = mc_getlocalcopy (filename);
if (localcopy == NULL) { if (localcopy == NULL) {
@ -185,7 +185,7 @@ exec_extension (const char *filename, const char *data, int *move_dir,
g_free (fn); g_free (fn);
} }
} else { } else {
text = expand_format (NULL, *data, !is_cd); text = expand_format (NULL, *lc_data, !is_cd);
} }
if (!is_cd) if (!is_cd)
fputs (text, cmd_file); fputs (text, cmd_file);
@ -198,15 +198,15 @@ exec_extension (const char *filename, const char *data, int *move_dir,
} }
} }
} else { } else {
if (*data == '%') if (*lc_data == '%')
expand_prefix_found = 1; expand_prefix_found = 1;
else { else {
if (*data != ' ' && *data != '\t') if (*lc_data != ' ' && *lc_data != '\t')
written_nonspace = 1; written_nonspace = 1;
if (is_cd) if (is_cd)
*(p++) = *data; *(p++) = *lc_data;
else else
fputc (*data, cmd_file); fputc (*lc_data, cmd_file);
} }
} }
} /* for */ } /* for */

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

@ -175,15 +175,15 @@ transform_source (FileOpContext *ctx, const char *source)
} }
static void static void
free_linklist (struct link **linklist) free_linklist (struct link **lc_linklist)
{ {
struct link *lp, *lp2; struct link *lp, *lp2;
for (lp = *linklist; lp != NULL; lp = lp2) { for (lp = *lc_linklist; lp != NULL; lp = lp2) {
lp2 = lp->next; lp2 = lp->next;
g_free (lp); g_free (lp);
} }
*linklist = NULL; *lc_linklist = NULL;
} }
static int static int
@ -1788,8 +1788,11 @@ panel_operate_generate_prompt (const WPanel *panel, const int operation,
} }
#ifdef WITH_BACKGROUND #ifdef WITH_BACKGROUND
int end_bg_process (FileOpContext *ctx, enum OperationMode mode) { static int
end_bg_process (FileOpContext *ctx, enum OperationMode mode) {
int pid = ctx->pid; int pid = ctx->pid;
(void) mode;
ctx->pid = 0; ctx->pid = 0;
unregister_task_with_pid(pid); unregister_task_with_pid(pid);

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

@ -1034,11 +1034,11 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation,
ctx->umask_kill = 0777777; ctx->umask_kill = 0777777;
ctx->preserve_uidgid = (geteuid () == 0) ? 1 : 0; ctx->preserve_uidgid = (geteuid () == 0) ? 1 : 0;
} else { } else {
int i; int i2;
ctx->preserve = ctx->preserve_uidgid = 0; ctx->preserve = ctx->preserve_uidgid = 0;
i = umask (0); i2 = umask (0);
umask (i); umask (i2);
ctx->umask_kill = i ^ 0777777; ctx->umask_kill = i2 ^ 0777777;
} }
if (!dest_dir || !*dest_dir) { if (!dest_dir || !*dest_dir) {

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

@ -200,7 +200,7 @@ get_list_info (char **file, char **dir)
} }
/* check regular expression */ /* check regular expression */
gboolean static gboolean
find_check_regexp (const char *r) find_check_regexp (const char *r)
{ {
mc_search_t *search; mc_search_t *search;
@ -1182,17 +1182,17 @@ find_file (const char *start_dir, const char *pattern, const char *content,
for (i = 0; entry != NULL && i < find_list->count; for (i = 0; entry != NULL && i < find_list->count;
entry = entry->next, i++) { entry = entry->next, i++) {
const char *filename = NULL; const char *lc_filename = NULL;
if (!entry->text || !entry->data) if (!entry->text || !entry->data)
continue; continue;
if (content_pattern != NULL) if (content_pattern != NULL)
filename = strchr (entry->text + 4, ':') + 1; lc_filename = strchr (entry->text + 4, ':') + 1;
else else
filename = entry->text + 4; lc_filename = entry->text + 4;
name = make_fullname (entry->data, filename); name = make_fullname (entry->data, lc_filename);
status = status =
handle_path (list, name, &st, next_free, &link_to_dir, handle_path (list, name, &st, next_free, &link_to_dir,
&stale_link); &stale_link);

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

@ -243,16 +243,16 @@ static void move_to_bottom (void)
move_backward (help_lines - 1); move_backward (help_lines - 1);
} }
static const char *help_follow_link (const char *start, const char *selected_item) static const char *help_follow_link (const char *start, const char *lc_selected_item)
{ {
char link_name [MAXLINKNAME]; char link_name [MAXLINKNAME];
const char *p; const char *p;
int i = 0; int i = 0;
if (!selected_item) if (!lc_selected_item)
return start; return start;
for (p = selected_item; *p && *p != CHAR_NODE_END && *p != CHAR_LINK_POINTER; p++) for (p = lc_selected_item; *p && *p != CHAR_NODE_END && *p != CHAR_LINK_POINTER; p++)
; ;
if (*p == CHAR_LINK_POINTER){ if (*p == CHAR_LINK_POINTER){
link_name [0] = '['; link_name [0] = '[';

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

@ -1038,16 +1038,16 @@ static void add_new_group_cmd (void)
void add2hotlist_cmd (void) void add2hotlist_cmd (void)
{ {
char *prompt, *label; char *lc_prompt, *label;
const char *cp = _("Label for \"%s\":"); const char *cp = _("Label for \"%s\":");
int l = str_term_width1 (cp); int l = str_term_width1 (cp);
char *label_string = g_strdup (current_panel->cwd); char *label_string = g_strdup (current_panel->cwd);
strip_password (label_string, 1); strip_password (label_string, 1);
prompt = g_strdup_printf (cp, path_trunc (current_panel->cwd, COLS-2*UX-(l+8))); lc_prompt = g_strdup_printf (cp, path_trunc (current_panel->cwd, COLS-2*UX-(l+8)));
label = input_dialog (_(" Add to hotlist "), prompt, MC_HISTORY_HOTLIST_ADD, label_string); label = input_dialog (_(" Add to hotlist "), lc_prompt, MC_HISTORY_HOTLIST_ADD, label_string);
g_free (prompt); g_free (lc_prompt);
if (!label || !*label) { if (!label || !*label) {
g_free (label_string); g_free (label_string);

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

@ -782,7 +782,7 @@ lookup_action (const char *keyname)
return 0; return 0;
} }
void static void
keymap_add (GArray *keymap, int key, int cmd, const char *caption) keymap_add (GArray *keymap, int key, int cmd, const char *caption)
{ {
if (key != 0 && cmd != 0) { if (key != 0 && cmd != 0) {

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

@ -607,12 +607,12 @@ mc_refresh (void)
} }
static void static void
panel_do_cols (int index) panel_do_cols (int lc_index)
{ {
if (get_display_type (index) == view_listing) if (get_display_type (lc_index) == view_listing)
set_panel_formats ((WPanel *) panels [index].widget); set_panel_formats ((WPanel *) panels [lc_index].widget);
else { else {
panel_update_cols (panels [index].widget, frame_half); panel_update_cols (panels [lc_index].widget, frame_half);
} }
} }
@ -1075,15 +1075,15 @@ void swap_panels ()
} }
} }
int get_display_type (int index) int get_display_type (int lc_index)
{ {
return panels [index].type; return panels [lc_index].type;
} }
struct Widget * struct Widget *
get_panel_widget (int index) get_panel_widget (int lc_index)
{ {
return panels[index].widget; return panels[lc_index].widget;
} }
int get_current_index (void) int get_current_index (void)
@ -1125,30 +1125,30 @@ int get_other_type (void)
/* Save current list_view widget directory into panel */ /* Save current list_view widget directory into panel */
void void
save_panel_dir (int index) save_panel_dir (int lc_index)
{ {
int type = get_display_type (index); int type = get_display_type (lc_index);
Widget *widget = get_panel_widget (index); Widget *widget = get_panel_widget (lc_index);
if ((type == view_listing) && (widget != NULL)) { if ((type == view_listing) && (widget != NULL)) {
WPanel *w = (WPanel *) widget; WPanel *w = (WPanel *) widget;
char *widget_work_dir = w->cwd; char *widget_work_dir = w->cwd;
g_free(panels [index].last_saved_dir); /* last path no needed */ g_free(panels [lc_index].last_saved_dir); /* last path no needed */
/* Because path can be nonlocal */ /* Because path can be nonlocal */
panels [index].last_saved_dir = vfs_translate_url(widget_work_dir); panels [lc_index].last_saved_dir = vfs_translate_url(widget_work_dir);
} }
} }
/* Save current list_view widget directory into panel */ /* Save current list_view widget directory into panel */
Widget * Widget *
restore_into_right_dir_panel (int index, Widget *from_widget) restore_into_right_dir_panel (int lc_index, Widget *from_widget)
{ {
Widget *new_widget = 0; Widget *new_widget = 0;
const char *saved_dir = panels [index].last_saved_dir; const char *saved_dir = panels [lc_index].last_saved_dir;
gboolean last_was_panel = (from_widget && gboolean last_was_panel = (from_widget &&
get_display_type(index) != view_listing); get_display_type(lc_index) != view_listing);
const char *p_name = get_nth_panel_name (index); const char *p_name = get_nth_panel_name (lc_index);
if (last_was_panel) if (last_was_panel)
new_widget = (Widget *) panel_new_with_dir (p_name, saved_dir); new_widget = (Widget *) panel_new_with_dir (p_name, saved_dir);

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

@ -300,12 +300,4 @@ listmode_edit (char *oldlistformat)
listmode_done (listmode_dlg); listmode_done (listmode_dlg);
return newformat; return newformat;
} }
#else
void listmode__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* LISTMODE_EDITOR */ #endif /* LISTMODE_EDITOR */

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

@ -187,7 +187,7 @@ static int
string_len (const char *buffer) string_len (const char *buffer)
{ {
static int anchor_flag = 0; /* Flag: Inside hypertext anchor name */ static int anchor_flag = 0; /* Flag: Inside hypertext anchor name */
static int link_flag = 0; /* Flag: Inside hypertext link target name */ static int lc_link_flag = 0; /* Flag: Inside hypertext link target name */
int backslash_flag = 0; /* Flag: Backslash quoting */ int backslash_flag = 0; /* Flag: Backslash quoting */
int c; /* Current character */ int c; /* Current character */
int len = 0; /* Result: the length of the string */ int len = 0; /* Result: the length of the string */
@ -195,9 +195,9 @@ string_len (const char *buffer)
while (*(buffer)) { while (*(buffer)) {
c = *buffer++; c = *buffer++;
if (c == CHAR_LINK_POINTER) if (c == CHAR_LINK_POINTER)
link_flag = 1; /* Link target name starts */ lc_link_flag = 1; /* Link target name starts */
else if (c == CHAR_LINK_END) else if (c == CHAR_LINK_END)
link_flag = 0; /* Link target name ends */ lc_link_flag = 0; /* Link target name ends */
else if (c == CHAR_NODE_END) { else if (c == CHAR_NODE_END) {
/* Node anchor name starts */ /* Node anchor name starts */
anchor_flag = 1; anchor_flag = 1;
@ -214,7 +214,7 @@ string_len (const char *buffer)
} }
backslash_flag = 0; backslash_flag = 0;
/* Increase length if not inside anchor name or link target name */ /* Increase length if not inside anchor name or link target name */
if (!anchor_flag && !link_flag) if (!anchor_flag && !lc_link_flag)
len++; len++;
if (anchor_flag && c == ']') { if (anchor_flag && c == ']') {
/* Node anchor name ends */ /* Node anchor name ends */
@ -671,7 +671,7 @@ main (int argc, char **argv)
FILE *f_man; /* Manual file */ FILE *f_man; /* Manual file */
FILE *f_tmpl; /* Template file */ FILE *f_tmpl; /* Template file */
char buffer[BUFFER_SIZE]; /* Full input line */ char buffer[BUFFER_SIZE]; /* Full input line */
char *node = NULL; char *lc_node = NULL;
char *outfile_buffer; /* Large buffer to keep the output file */ char *outfile_buffer; /* Large buffer to keep the output file */
long cont_start; /* Start of [Contents] */ long cont_start; /* Start of [Contents] */
long file_end; /* Length of the output file */ long file_end; /* Length of the output file */
@ -754,21 +754,21 @@ main (int argc, char **argv)
/* Repeat for each input line */ /* Repeat for each input line */
/* Read a line */ /* Read a line */
while (fgets (buffer, BUFFER_SIZE, f_tmpl)) { while (fgets (buffer, BUFFER_SIZE, f_tmpl)) {
if (node) { if (lc_node) {
if (*buffer && *buffer != '\n') { if (*buffer && *buffer != '\n') {
cnode->lname = strdup (buffer); cnode->lname = strdup (buffer);
node = strchr (cnode->lname, '\n'); lc_node = strchr (cnode->lname, '\n');
if (node) if (lc_node)
*node = 0; *lc_node = 0;
} }
node = NULL; lc_node = NULL;
} else { } else {
node = strchr (buffer, CHAR_NODE_END); lc_node = strchr (buffer, CHAR_NODE_END);
if (node && (node[1] == '[')) { if (lc_node && (lc_node[1] == '[')) {
char *p = strchr (node, ']'); char *p = strchr (lc_node, ']');
if (p) { if (p) {
if (strncmp (node + 1, "[main]", 6) == 0) { if (strncmp (lc_node + 1, "[main]", 6) == 0) {
node = NULL; lc_node = NULL;
} else { } else {
if (!cnode) { if (!cnode) {
cnode = &nodes; cnode = &nodes;
@ -776,16 +776,16 @@ main (int argc, char **argv)
cnode->next = malloc (sizeof (nodes)); cnode->next = malloc (sizeof (nodes));
cnode = cnode->next; cnode = cnode->next;
} }
cnode->node = strdup (node + 2); cnode->node = strdup (lc_node + 2);
cnode->node[p - node - 2] = 0; cnode->node[p - lc_node - 2] = 0;
cnode->lname = NULL; cnode->lname = NULL;
cnode->next = NULL; cnode->next = NULL;
cnode->heading_level = 0; cnode->heading_level = 0;
} }
} else } else
node = NULL; lc_node = NULL;
} else } else
node = NULL; lc_node = NULL;
} }
fputs (buffer, f_out); fputs (buffer, f_out);
} }
@ -829,12 +829,12 @@ main (int argc, char **argv)
} }
for (cnode = &nodes; cnode && cnode->node;) { for (cnode = &nodes; cnode && cnode->node;) {
char *node = cnode->node;
struct node *next = cnode->next; struct node *next = cnode->next;
lc_node = cnode->node;
if (*node) if (*lc_node)
fprintf (f_out, " %*s\001%s\002%s\003", cnode->heading_level, fprintf (f_out, " %*s\001%s\002%s\003", cnode->heading_level,
"", cnode->lname ? cnode->lname : node, node); "", cnode->lname ? cnode->lname : lc_node, lc_node);
fprintf (f_out, "\n"); fprintf (f_out, "\n");
free (cnode->node); free (cnode->node);

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

@ -770,12 +770,12 @@ display_mini_info (WPanel *panel)
set_colors (panel); set_colors (panel);
if (S_ISLNK (panel->dir.list [panel->selected].st.st_mode)){ if (S_ISLNK (panel->dir.list [panel->selected].st.st_mode)){
char *link, link_target [MC_MAXPATHLEN]; char *lc_link, link_target [MC_MAXPATHLEN];
int len; int len;
link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname); lc_link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname);
len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1); len = mc_readlink (lc_link, link_target, MC_MAXPATHLEN - 1);
g_free (link); g_free (lc_link);
if (len > 0){ if (len > 0){
link_target[len] = 0; link_target[len] = 0;
tty_print_string ("-> "); tty_print_string ("-> ");
@ -2470,13 +2470,13 @@ static gsize
panel_get_format_field_count(WPanel *panel) panel_get_format_field_count(WPanel *panel)
{ {
format_e *format; format_e *format;
gsize index; gsize lc_index;
for ( for (
index=0, format = panel->format; lc_index=0, format = panel->format;
format != NULL; format != NULL;
format = format->next, index++ format = format->next, lc_index++
); );
return index; return lc_index;
} }
/* /*
@ -2486,38 +2486,38 @@ static gsize
panel_get_format_field_index_by_name(WPanel *panel, const char *name) panel_get_format_field_index_by_name(WPanel *panel, const char *name)
{ {
format_e *format; format_e *format;
gsize index; gsize lc_index;
for ( for (
index=1, format = panel->format; lc_index=1, format = panel->format;
! ( format == NULL || strcmp(format->title, name) == 0 ); ! ( format == NULL || strcmp(format->title, name) == 0 );
format = format->next, index++ format = format->next, lc_index++
); );
if (format == NULL) if (format == NULL)
index = 0; lc_index = 0;
return index; return lc_index;
} }
format_e * static format_e *
panel_get_format_field_by_index(WPanel *panel, gsize index) panel_get_format_field_by_index(WPanel *panel, gsize lc_index)
{ {
format_e *format; format_e *format;
for ( for (
format = panel->format; format = panel->format;
! ( format == NULL || index == 0 ); ! ( format == NULL || lc_index == 0 );
format = format->next, index-- format = format->next, lc_index--
); );
return format; return format;
} }
static const panel_field_t * static const panel_field_t *
panel_get_sortable_field_by_format(WPanel *panel, gsize index) panel_get_sortable_field_by_format(WPanel *panel, gsize lc_index)
{ {
const panel_field_t *pfield; const panel_field_t *pfield;
format_e *format; format_e *format;
format = panel_get_format_field_by_index(panel, index); format = panel_get_format_field_by_index(panel, lc_index);
if (format == NULL) if (format == NULL)
return NULL; return NULL;
pfield = panel_get_field_by_title(format->title); pfield = panel_get_field_by_title(format->title);
@ -2531,19 +2531,19 @@ panel_get_sortable_field_by_format(WPanel *panel, gsize index)
static void static void
panel_toggle_sort_order_prev(WPanel *panel) panel_toggle_sort_order_prev(WPanel *panel)
{ {
gsize index, i; gsize lc_index, i;
gchar *title; gchar *title;
const panel_field_t *pfield = NULL; const panel_field_t *pfield = NULL;
title = panel_get_title_without_hotkey(panel->current_sort_field->title_hotkey); title = panel_get_title_without_hotkey(panel->current_sort_field->title_hotkey);
index = panel_get_format_field_index_by_name(panel, title); lc_index = panel_get_format_field_index_by_name(panel, title);
g_free(title); g_free(title);
if (index > 1){ if (lc_index > 1){
/* search for prev sortable column in panel format */ /* search for prev sortable column in panel format */
for ( for (
i = index-1 ; i = lc_index-1 ;
i != 0 && (pfield = panel_get_sortable_field_by_format(panel, i-1)) == NULL ; i != 0 && (pfield = panel_get_sortable_field_by_format(panel, i-1)) == NULL ;
i-- i--
); );
@ -2567,19 +2567,19 @@ panel_toggle_sort_order_prev(WPanel *panel)
static void static void
panel_toggle_sort_order_next(WPanel *panel) panel_toggle_sort_order_next(WPanel *panel)
{ {
gsize index, i; gsize lc_index, i;
const panel_field_t *pfield = NULL; const panel_field_t *pfield = NULL;
gsize format_field_count = panel_get_format_field_count(panel); gsize format_field_count = panel_get_format_field_count(panel);
gchar *title; gchar *title;
title = panel_get_title_without_hotkey(panel->current_sort_field->title_hotkey); title = panel_get_title_without_hotkey(panel->current_sort_field->title_hotkey);
index = panel_get_format_field_index_by_name(panel, title); lc_index = panel_get_format_field_index_by_name(panel, title);
g_free(title); g_free(title);
if (index != 0 && index != format_field_count){ if (lc_index != 0 && lc_index != format_field_count){
/* search for prev sortable column in panel format */ /* search for prev sortable column in panel format */
for ( for (
i = index; i = lc_index;
i != format_field_count && (pfield = panel_get_sortable_field_by_format(panel, i)) == NULL ; i != format_field_count && (pfield = panel_get_sortable_field_by_format(panel, i)) == NULL ;
i++ i++
); );
@ -2885,10 +2885,10 @@ panel_callback (Widget *w, widget_msg_t msg, int parm)
} }
void void
file_mark (WPanel *panel, int index, int val) file_mark (WPanel *panel, int lc_index, int val)
{ {
if (panel->dir.list[index].f.marked != val) { if (panel->dir.list[lc_index].f.marked != val) {
panel->dir.list[index].f.marked = val; panel->dir.list[lc_index].f.marked = val;
panel->dirty = 1; panel->dirty = 1;
} }
} }
@ -2935,7 +2935,7 @@ static void
mouse_sort_col(Gpm_Event *event, WPanel *panel) mouse_sort_col(Gpm_Event *event, WPanel *panel)
{ {
int i; int i;
const char *sort_name = NULL; const char *lc_sort_name = NULL;
panel_field_t *col_sort_format = NULL; panel_field_t *col_sort_format = NULL;
format_e *format; format_e *format;
gchar *title; gchar *title;
@ -2944,17 +2944,17 @@ mouse_sort_col(Gpm_Event *event, WPanel *panel)
i += format->field_len; i += format->field_len;
if (event->x < i + 1) { if (event->x < i + 1) {
/* found column */ /* found column */
sort_name = format->title; lc_sort_name = format->title;
break; break;
} }
} }
if (sort_name == NULL) if (lc_sort_name == NULL)
return; return;
for(i = 0; panel_fields[i].id != NULL; i++) { for(i = 0; panel_fields[i].id != NULL; i++) {
title = panel_get_title_without_hotkey(panel_fields[i].title_hotkey); title = panel_get_title_without_hotkey(panel_fields[i].title_hotkey);
if (!strcmp (sort_name, title) && panel_fields[i].sort_routine) { if (!strcmp (lc_sort_name, title) && panel_fields[i].sort_routine) {
col_sort_format = &panel_fields[i]; col_sort_format = &panel_fields[i];
g_free(title); g_free(title);
break; break;
@ -3309,10 +3309,10 @@ update_panels (int force_update, const char *current_file)
gsize gsize
panel_get_num_of_sortable_fields(void) panel_get_num_of_sortable_fields(void)
{ {
gsize ret = 0, index; gsize ret = 0, lc_index;
for(index=0; panel_fields[index].id != NULL; index ++) for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++)
if (panel_fields[index].is_user_choice) if (panel_fields[lc_index].is_user_choice)
ret++; ret++;
return ret; return ret;
} }
@ -3322,65 +3322,65 @@ const char **
panel_get_sortable_fields(gsize *array_size) panel_get_sortable_fields(gsize *array_size)
{ {
char **ret; char **ret;
gsize index, i; gsize lc_index, i;
index = panel_get_num_of_sortable_fields(); lc_index = panel_get_num_of_sortable_fields();
ret = g_new0 (char *, index + 1); ret = g_new0 (char *, lc_index + 1);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
if (array_size != NULL) if (array_size != NULL)
*array_size = index; *array_size = lc_index;
index=0; lc_index=0;
for(i=0; panel_fields[i].id != NULL; i ++) for(i=0; panel_fields[i].id != NULL; i ++)
if (panel_fields[i].is_user_choice) if (panel_fields[i].is_user_choice)
ret[index++] = g_strdup(_(panel_fields[i].title_hotkey)); ret[lc_index++] = g_strdup(_(panel_fields[i].title_hotkey));
return (const char**) ret; return (const char**) ret;
} }
const panel_field_t * const panel_field_t *
panel_get_field_by_id(const char *name) panel_get_field_by_id(const char *name)
{ {
gsize index; gsize lc_index;
for(index=0; panel_fields[index].id != NULL; index ++) for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++)
if ( if (
panel_fields[index].id != NULL && panel_fields[lc_index].id != NULL &&
strcmp(name, panel_fields[index].id) == 0 strcmp(name, panel_fields[lc_index].id) == 0
) )
return &panel_fields[index]; return &panel_fields[lc_index];
return NULL; return NULL;
} }
const panel_field_t * const panel_field_t *
panel_get_field_by_title_hotkey(const char *name) panel_get_field_by_title_hotkey(const char *name)
{ {
gsize index; gsize lc_index;
for(index=0; panel_fields[index].id != NULL; index ++) for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++)
if ( if (
panel_fields[index].title_hotkey != NULL && panel_fields[lc_index].title_hotkey != NULL &&
strcmp(name, _(panel_fields[index].title_hotkey)) == 0 strcmp(name, _(panel_fields[lc_index].title_hotkey)) == 0
) )
return &panel_fields[index]; return &panel_fields[lc_index];
return NULL; return NULL;
} }
const panel_field_t * const panel_field_t *
panel_get_field_by_title(const char *name) panel_get_field_by_title(const char *name)
{ {
gsize index; gsize lc_index;
gchar *title = NULL; gchar *title = NULL;
for(index=0; panel_fields[index].id != NULL; index ++) { for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++) {
title = panel_get_title_without_hotkey(panel_fields[index].title_hotkey); title = panel_get_title_without_hotkey(panel_fields[lc_index].title_hotkey);
if ( if (
panel_fields[index].title_hotkey != NULL && panel_fields[lc_index].title_hotkey != NULL &&
strcmp(name, title) == 0 strcmp(name, title) == 0
) { ) {
g_free(title); g_free(title);
return &panel_fields[index]; return &panel_fields[lc_index];
} }
} }
g_free(title); g_free(title);
@ -3390,10 +3390,10 @@ panel_get_field_by_title(const char *name)
gsize gsize
panel_get_num_of_user_possible_fields(void) panel_get_num_of_user_possible_fields(void)
{ {
gsize ret = 0, index; gsize ret = 0, lc_index;
for(index=0; panel_fields[index].id != NULL; index ++) for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++)
if (panel_fields[index].use_in_user_format) if (panel_fields[lc_index].use_in_user_format)
ret++; ret++;
return ret; return ret;
} }
@ -3402,22 +3402,22 @@ const char **
panel_get_user_possible_fields(gsize *array_size) panel_get_user_possible_fields(gsize *array_size)
{ {
char **ret; char **ret;
gsize index, i; gsize lc_index, i;
index = panel_get_num_of_user_possible_fields(); lc_index = panel_get_num_of_user_possible_fields();
ret = g_new0 (char *, index + 1); ret = g_new0 (char *, lc_index + 1);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
if (array_size != NULL) if (array_size != NULL)
*array_size = index; *array_size = lc_index;
index=0; lc_index=0;
for(i=0; panel_fields[i].id != NULL; i ++) for(i=0; panel_fields[i].id != NULL; i ++)
if (panel_fields[i].use_in_user_format) if (panel_fields[i].use_in_user_format)
ret[index++] = g_strdup(_(panel_fields[i].title_hotkey)); ret[lc_index++] = g_strdup(_(panel_fields[i].title_hotkey));
return (const char**) ret; return (const char**) ret;
} }

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

@ -140,7 +140,7 @@ mc_search__translate_replace_glob_to_regex (gchar *str)
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
void void
mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * mc_search, mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond) mc_search_cond_t * mc_search_cond)
{ {
GString *tmp = GString *tmp =
@ -148,33 +148,33 @@ mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * mc_sear
g_string_free (mc_search_cond->str, TRUE); g_string_free (mc_search_cond->str, TRUE);
if (mc_search->is_entire_line) { if (lc_mc_search->is_entire_line) {
g_string_prepend_c (tmp, '^'); g_string_prepend_c (tmp, '^');
g_string_append_c (tmp, '$'); g_string_append_c (tmp, '$');
} }
mc_search_cond->str = tmp; mc_search_cond->str = tmp;
mc_search__cond_struct_new_init_regex (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_regex (charset, lc_mc_search, mc_search_cond);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search__run_glob (mc_search_t * mc_search, const void *user_data, mc_search__run_glob (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len) gsize start_search, gsize end_search, gsize * found_len)
{ {
return mc_search__run_regex (mc_search, user_data, start_search, end_search, found_len); return mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
GString * GString *
mc_search_glob_prepare_replace_str (mc_search_t * mc_search, GString * replace_str) mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str)
{ {
GString *repl = mc_search__translate_replace_glob_to_regex(replace_str->str); GString *repl = mc_search__translate_replace_glob_to_regex(replace_str->str);
GString *res = mc_search_regex_prepare_replace_str (mc_search, repl); GString *res = mc_search_regex_prepare_replace_str (lc_mc_search, repl);
g_string_free (repl, TRUE); g_string_free (repl, TRUE);
return res; return res;
} }

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

@ -92,7 +92,7 @@ mc_search__hex_translate_to_regex (gchar * str, gsize * len)
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
void void
mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * mc_search, mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond) mc_search_cond_t * mc_search_cond)
{ {
GString *tmp = GString *tmp =
@ -101,25 +101,25 @@ mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * mc_searc
g_string_free (mc_search_cond->str, TRUE); g_string_free (mc_search_cond->str, TRUE);
mc_search_cond->str = tmp; mc_search_cond->str = tmp;
mc_search__cond_struct_new_init_regex (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_regex (charset, lc_mc_search, mc_search_cond);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search__run_hex (mc_search_t * mc_search, const void *user_data, mc_search__run_hex (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len) gsize start_search, gsize end_search, gsize * found_len)
{ {
return mc_search__run_regex (mc_search, user_data, start_search, end_search, found_len); return mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
GString * GString *
mc_search_hex_prepare_replace_str (mc_search_t * mc_search, GString * replace_str) mc_search_hex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str)
{ {
(void) mc_search; (void) lc_mc_search;
return g_string_new_len (replace_str->str, replace_str->len); return g_string_new_len (replace_str->str, replace_str->len);
} }

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

@ -123,11 +123,11 @@ mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
int int
mc_search__get_char (mc_search_t * mc_search, const void *user_data, gsize current_pos) mc_search__get_char (mc_search_t * lc_mc_search, const void *user_data, gsize current_pos)
{ {
char *data; char *data;
if (mc_search->search_fn) if (lc_mc_search->search_fn)
return (mc_search->search_fn) (user_data, current_pos); return (lc_mc_search->search_fn) (user_data, current_pos);
data = (char *) user_data; data = (char *) user_data;
return (int) (unsigned char) data[current_pos]; return (int) (unsigned char) data[current_pos];
@ -245,7 +245,7 @@ gchar **
mc_search_get_types_strings_array (size_t *num) mc_search_get_types_strings_array (size_t *num)
{ {
gchar **ret; gchar **ret;
int index; int lc_index;
size_t n; size_t n;
const mc_search_type_str_t *type_str; const mc_search_type_str_t *type_str;
@ -255,14 +255,14 @@ mc_search_get_types_strings_array (size_t *num)
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
for (index = 0, type_str = types_str; for (lc_index = 0, type_str = types_str;
type_str->str != NULL; type_str->str != NULL;
type_str++, index++) type_str++, lc_index++)
ret[index] = g_strdup (type_str->str); ret[lc_index] = g_strdup (type_str->str);
/* don't count last NULL item */ /* don't count last NULL item */
if (num != NULL) if (num != NULL)
*num = (size_t) index; *num = (size_t) lc_index;
return ret; return ret;
} }

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

@ -85,36 +85,36 @@ mc_search__normal_translate_to_regex (gchar * str, gsize * len)
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
void void
mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t * mc_search, mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond) mc_search_cond_t * mc_search_cond)
{ {
GString *tmp = GString *tmp =
mc_search__normal_translate_to_regex (mc_search_cond->str->str, &mc_search_cond->len); mc_search__normal_translate_to_regex (mc_search_cond->str->str, &mc_search_cond->len);
g_string_free (mc_search_cond->str, TRUE); g_string_free (mc_search_cond->str, TRUE);
if (mc_search->whole_words) { if (lc_mc_search->whole_words) {
g_string_prepend (tmp, "\\b"); g_string_prepend (tmp, "\\b");
g_string_append (tmp, "\\b"); g_string_append (tmp, "\\b");
} }
mc_search_cond->str = tmp; mc_search_cond->str = tmp;
mc_search__cond_struct_new_init_regex (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_regex (charset, lc_mc_search, mc_search_cond);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search__run_normal (mc_search_t * mc_search, const void *user_data, mc_search__run_normal (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len) gsize start_search, gsize end_search, gsize * found_len)
{ {
return mc_search__run_regex (mc_search, user_data, start_search, end_search, found_len); return mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
GString * GString *
mc_search_normal_prepare_replace_str (mc_search_t * mc_search, GString * replace_str) mc_search_normal_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str)
{ {
(void) mc_search; (void) lc_mc_search;
return g_string_new_len (replace_str->str, replace_str->len); return g_string_new_len (replace_str->str, replace_str->len);
} }

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

@ -230,31 +230,31 @@ mc_search__cond_struct_new_regex_ci_str (const char *charset, const char *str, g
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static mc_search__found_cond_t static mc_search__found_cond_t
mc_search__regex_found_cond_one (mc_search_t * mc_search, mc_search_regex_t * regex, mc_search__regex_found_cond_one (mc_search_t * lc_mc_search, mc_search_regex_t * regex,
GString * search_str) GString * search_str)
{ {
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
GError *error = NULL; GError *error = NULL;
if (!g_regex_match_full if (!g_regex_match_full
(regex, search_str->str, -1, 0, G_REGEX_MATCH_NEWLINE_ANY, &mc_search->regex_match_info, (regex, search_str->str, -1, 0, G_REGEX_MATCH_NEWLINE_ANY, &lc_mc_search->regex_match_info,
&error)) { &error)) {
g_match_info_free (mc_search->regex_match_info); g_match_info_free (lc_mc_search->regex_match_info);
mc_search->regex_match_info = NULL; lc_mc_search->regex_match_info = NULL;
if (error) { if (error) {
mc_search->error = MC_SEARCH_E_REGEX; lc_mc_search->error = MC_SEARCH_E_REGEX;
mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error ")); lc_mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error "));
g_error_free (error); g_error_free (error);
return COND__FOUND_ERROR; return COND__FOUND_ERROR;
} }
return COND__NOT_FOUND; return COND__NOT_FOUND;
} }
mc_search->num_rezults = g_match_info_get_match_count (mc_search->regex_match_info); lc_mc_search->num_rezults = g_match_info_get_match_count (lc_mc_search->regex_match_info);
#else /* SEARCH_TYPE_GLIB */ #else /* SEARCH_TYPE_GLIB */
mc_search->num_rezults = pcre_exec (regex, mc_search->regex_match_info, lc_mc_search->num_rezults = pcre_exec (regex, lc_mc_search->regex_match_info,
search_str->str, search_str->len - 1, 0, 0, mc_search->iovector, search_str->str, search_str->len - 1, 0, 0, lc_mc_search->iovector,
MC_SEARCH__NUM_REPLACE_ARGS); MC_SEARCH__NUM_REPLACE_ARGS);
if (mc_search->num_rezults < 0) { if (lc_mc_search->num_rezults < 0) {
return COND__NOT_FOUND; return COND__NOT_FOUND;
} }
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
@ -265,19 +265,19 @@ mc_search__regex_found_cond_one (mc_search_t * mc_search, mc_search_regex_t * re
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static mc_search__found_cond_t static mc_search__found_cond_t
mc_search__regex_found_cond (mc_search_t * mc_search, GString * search_str) mc_search__regex_found_cond (mc_search_t * lc_mc_search, GString * search_str)
{ {
gsize loop1; gsize loop1;
mc_search_cond_t *mc_search_cond; mc_search_cond_t *mc_search_cond;
mc_search__found_cond_t ret; mc_search__found_cond_t ret;
for (loop1 = 0; loop1 < mc_search->conditions->len; loop1++) { for (loop1 = 0; loop1 < lc_mc_search->conditions->len; loop1++) {
mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (mc_search->conditions, loop1); mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (lc_mc_search->conditions, loop1);
if (!mc_search_cond->regex_handle) if (!mc_search_cond->regex_handle)
continue; continue;
ret = mc_search__regex_found_cond_one (mc_search, mc_search_cond->regex_handle, search_str); ret = mc_search__regex_found_cond_one (lc_mc_search, mc_search_cond->regex_handle, search_str);
if (ret != COND__NOT_FOUND) if (ret != COND__NOT_FOUND)
return ret; return ret;
@ -325,21 +325,21 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static char * static char *
mc_search_regex__get_token_by_num (const mc_search_t * mc_search, gsize index) mc_search_regex__get_token_by_num (const mc_search_t * lc_mc_search, gsize lc_index)
{ {
int fnd_start = 0, fnd_end = 0; int fnd_start = 0, fnd_end = 0;
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
g_match_info_fetch_pos (mc_search->regex_match_info, index, &fnd_start, &fnd_end); g_match_info_fetch_pos (lc_mc_search->regex_match_info, lc_index, &fnd_start, &fnd_end);
#else /* SEARCH_TYPE_GLIB */ #else /* SEARCH_TYPE_GLIB */
fnd_start = mc_search->iovector[index * 2 + 0]; fnd_start = lc_mc_search->iovector[lc_index * 2 + 0];
fnd_end = mc_search->iovector[index * 2 + 1]; fnd_end = lc_mc_search->iovector[lc_index * 2 + 1];
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
if (fnd_end - fnd_start == 0) if (fnd_end - fnd_start == 0)
return NULL; return NULL;
return g_strndup (mc_search->regex_buffer->str + fnd_start, fnd_end - fnd_start); return g_strndup (lc_mc_search->regex_buffer->str + fnd_start, fnd_end - fnd_start);
} }
@ -472,7 +472,7 @@ mc_search_regex__process_append_str (GString * dest_str, const char *from, gsize
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
void void
mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_search, mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_search,
mc_search_cond_t * mc_search_cond) mc_search_cond_t * mc_search_cond)
{ {
GString *tmp = NULL; GString *tmp = NULL;
@ -483,7 +483,7 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea
int erroffset; int erroffset;
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
if (!mc_search->is_case_sentitive) { if (!lc_mc_search->is_case_sentitive) {
tmp = g_string_new_len (mc_search_cond->str->str, mc_search_cond->str->len); tmp = g_string_new_len (mc_search_cond->str->str, mc_search_cond->str->len);
g_string_free (mc_search_cond->str, TRUE); g_string_free (mc_search_cond->str, TRUE);
mc_search_cond->str = mc_search__cond_struct_new_regex_ci_str (charset, tmp->str, tmp->len); mc_search_cond->str = mc_search__cond_struct_new_regex_ci_str (charset, tmp->str, tmp->len);
@ -495,8 +495,8 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea
&error); &error);
if (error != NULL) { if (error != NULL) {
mc_search->error = MC_SEARCH_E_REGEX_COMPILE; lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE;
mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error ")); lc_mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error "));
g_error_free (error); g_error_free (error);
return; return;
} }
@ -504,15 +504,15 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea
mc_search_cond->regex_handle = mc_search_cond->regex_handle =
pcre_compile (mc_search_cond->str->str, PCRE_EXTRA, &error, &erroffset, NULL); pcre_compile (mc_search_cond->str->str, PCRE_EXTRA, &error, &erroffset, NULL);
if (mc_search_cond->regex_handle == NULL) { if (mc_search_cond->regex_handle == NULL) {
mc_search->error = MC_SEARCH_E_REGEX_COMPILE; lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE;
mc_search->error_str = g_strdup (error); lc_mc_search->error_str = g_strdup (error);
return; return;
} }
mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error); lc_mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error);
if (mc_search->regex_match_info == NULL) { if (lc_mc_search->regex_match_info == NULL) {
if (error) { if (error) {
mc_search->error = MC_SEARCH_E_REGEX_COMPILE; lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE;
mc_search->error_str = g_strdup (error); lc_mc_search->error_str = g_strdup (error);
g_free (mc_search_cond->regex_handle); g_free (mc_search_cond->regex_handle);
mc_search_cond->regex_handle = NULL; mc_search_cond->regex_handle = NULL;
return; return;
@ -524,7 +524,7 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search__run_regex (mc_search_t * mc_search, const void *user_data, mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len) gsize start_search, gsize end_search, gsize * found_len)
{ {
gsize current_pos, virtual_pos; gsize current_pos, virtual_pos;
@ -532,18 +532,18 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data,
gint start_pos; gint start_pos;
gint end_pos; gint end_pos;
if (mc_search->regex_buffer != NULL) if (lc_mc_search->regex_buffer != NULL)
g_string_free (mc_search->regex_buffer, TRUE); g_string_free (lc_mc_search->regex_buffer, TRUE);
mc_search->regex_buffer = g_string_new (""); lc_mc_search->regex_buffer = g_string_new ("");
virtual_pos = current_pos = start_search; virtual_pos = current_pos = start_search;
while (virtual_pos <= end_search) { while (virtual_pos <= end_search) {
g_string_set_size (mc_search->regex_buffer, 0); g_string_set_size (lc_mc_search->regex_buffer, 0);
mc_search->start_buffer = current_pos; lc_mc_search->start_buffer = current_pos;
while (1) { while (1) {
current_chr = mc_search__get_char (mc_search, user_data, current_pos); current_chr = mc_search__get_char (lc_mc_search, user_data, current_pos);
if (current_chr == MC_SEARCH_CB_ABORT) if (current_chr == MC_SEARCH_CB_ABORT)
break; break;
@ -554,7 +554,7 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data,
virtual_pos++; virtual_pos++;
g_string_append_c (mc_search->regex_buffer, (char) current_chr); g_string_append_c (lc_mc_search->regex_buffer, (char) current_chr);
if (current_chr == 0 || (char) current_chr == '\n') if (current_chr == 0 || (char) current_chr == '\n')
@ -564,54 +564,54 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data,
break; break;
} }
switch (mc_search__regex_found_cond (mc_search, mc_search->regex_buffer)) { switch (mc_search__regex_found_cond (lc_mc_search, lc_mc_search->regex_buffer)) {
case COND__FOUND_OK: case COND__FOUND_OK:
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
g_match_info_fetch_pos (mc_search->regex_match_info, 0, &start_pos, &end_pos); g_match_info_fetch_pos (lc_mc_search->regex_match_info, 0, &start_pos, &end_pos);
#else /* SEARCH_TYPE_GLIB */ #else /* SEARCH_TYPE_GLIB */
start_pos = mc_search->iovector[0]; start_pos = lc_mc_search->iovector[0];
end_pos = mc_search->iovector[1]; end_pos = lc_mc_search->iovector[1];
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
if (found_len) if (found_len)
*found_len = end_pos - start_pos; *found_len = end_pos - start_pos;
mc_search->normal_offset = mc_search->start_buffer + start_pos; lc_mc_search->normal_offset = lc_mc_search->start_buffer + start_pos;
return TRUE; return TRUE;
break; break;
case COND__NOT_ALL_FOUND: case COND__NOT_ALL_FOUND:
break; break;
default: default:
g_string_free (mc_search->regex_buffer, TRUE); g_string_free (lc_mc_search->regex_buffer, TRUE);
mc_search->regex_buffer = NULL; lc_mc_search->regex_buffer = NULL;
return FALSE; return FALSE;
break; break;
} }
if (mc_search->update_fn != NULL) { if (lc_mc_search->update_fn != NULL) {
if ((mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_SKIP) { if ((lc_mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_SKIP) {
g_string_free (mc_search->regex_buffer, TRUE); g_string_free (lc_mc_search->regex_buffer, TRUE);
mc_search->regex_buffer = NULL; lc_mc_search->regex_buffer = NULL;
mc_search->error = MC_SEARCH_E_NOTFOUND; lc_mc_search->error = MC_SEARCH_E_NOTFOUND;
mc_search->error_str = NULL; lc_mc_search->error_str = NULL;
return FALSE; return FALSE;
} }
} }
if (current_chr == MC_SEARCH_CB_ABORT) if (current_chr == MC_SEARCH_CB_ABORT)
break; break;
} }
g_string_free (mc_search->regex_buffer, TRUE); g_string_free (lc_mc_search->regex_buffer, TRUE);
mc_search->regex_buffer = NULL; lc_mc_search->regex_buffer = NULL;
mc_search->error = MC_SEARCH_E_NOTFOUND; lc_mc_search->error = MC_SEARCH_E_NOTFOUND;
mc_search->error_str = g_strdup (_(STR_E_NOTFOUND)); lc_mc_search->error_str = g_strdup (_(STR_E_NOTFOUND));
return FALSE; return FALSE;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
GString * GString *
mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_str) mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str)
{ {
GString *ret; GString *ret;
gchar *tmp_str; gchar *tmp_str;
int num_replace_tokens, index; int num_replace_tokens, lc_index;
gsize loop; gsize loop;
gsize len = 0; gsize len = 0;
gchar *prev_str; gchar *prev_str;
@ -620,22 +620,22 @@ mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_
num_replace_tokens = num_replace_tokens =
mc_search_regex__get_max_num_of_replace_tokens (replace_str->str, replace_str->len); mc_search_regex__get_max_num_of_replace_tokens (replace_str->str, replace_str->len);
if (mc_search->num_rezults < 0) if (lc_mc_search->num_rezults < 0)
return g_string_new_len (replace_str->str, replace_str->len); return g_string_new_len (replace_str->str, replace_str->len);
if (num_replace_tokens > mc_search->num_rezults - 1 if (num_replace_tokens > lc_mc_search->num_rezults - 1
|| num_replace_tokens > MC_SEARCH__NUM_REPLACE_ARGS) { || num_replace_tokens > MC_SEARCH__NUM_REPLACE_ARGS) {
mc_search->error = MC_SEARCH_E_REGEX_REPLACE; lc_mc_search->error = MC_SEARCH_E_REGEX_REPLACE;
mc_search->error_str = g_strdup (STR_E_RPL_NOT_EQ_TO_FOUND); lc_mc_search->error_str = g_strdup (STR_E_RPL_NOT_EQ_TO_FOUND);
return NULL; return NULL;
} }
ret = g_string_new (""); ret = g_string_new ("");
prev_str = replace_str->str; prev_str = replace_str->str;
for (loop = 0; loop < replace_str->len - 1; loop++) { for (loop = 0; loop < replace_str->len - 1; loop++) {
index = mc_search_regex__process_replace_str (replace_str, loop, &len, &replace_flags); lc_index = mc_search_regex__process_replace_str (replace_str, loop, &len, &replace_flags);
if (index == -1) { if (lc_index == -1) {
if (len != 0) { if (len != 0) {
mc_search_regex__process_append_str (ret, prev_str, mc_search_regex__process_append_str (ret, prev_str,
replace_str->str - prev_str + loop, replace_str->str - prev_str + loop,
@ -648,7 +648,7 @@ mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_
continue; continue;
} }
if (index == -2) { if (lc_index == -2) {
if (loop) if (loop)
mc_search_regex__process_append_str (ret, prev_str, mc_search_regex__process_append_str (ret, prev_str,
replace_str->str - prev_str + loop, replace_str->str - prev_str + loop,
@ -658,14 +658,14 @@ mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_
continue; continue;
} }
if (index > mc_search->num_rezults) { if (lc_index > lc_mc_search->num_rezults) {
g_string_free (ret, TRUE); g_string_free (ret, TRUE);
mc_search->error = MC_SEARCH_E_REGEX_REPLACE; lc_mc_search->error = MC_SEARCH_E_REGEX_REPLACE;
mc_search->error_str = g_strdup_printf (STR_E_RPL_INVALID_TOKEN, index); lc_mc_search->error_str = g_strdup_printf (STR_E_RPL_INVALID_TOKEN, lc_index);
return NULL; return NULL;
} }
tmp_str = mc_search_regex__get_token_by_num (mc_search, index); tmp_str = mc_search_regex__get_token_by_num (lc_mc_search, lc_index);
if (tmp_str == NULL) if (tmp_str == NULL)
continue; continue;

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

@ -55,7 +55,7 @@ static const mc_search_type_str_t mc_search__list_types[] = {
/*** file scope functions ************************************************************************/ /*** file scope functions ************************************************************************/
static mc_search_cond_t * static mc_search_cond_t *
mc_search__cond_struct_new (mc_search_t * mc_search, const char *str, mc_search__cond_struct_new (mc_search_t * lc_mc_search, const char *str,
gsize str_len, const char *charset) gsize str_len, const char *charset)
{ {
mc_search_cond_t *mc_search_cond; mc_search_cond_t *mc_search_cond;
@ -65,18 +65,18 @@ mc_search__cond_struct_new (mc_search_t * mc_search, const char *str,
mc_search_cond->len = str_len; mc_search_cond->len = str_len;
mc_search_cond->charset = g_strdup (charset); mc_search_cond->charset = g_strdup (charset);
switch (mc_search->search_type) { switch (lc_mc_search->search_type) {
case MC_SEARCH_T_GLOB: case MC_SEARCH_T_GLOB:
mc_search__cond_struct_new_init_glob (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_glob (charset, lc_mc_search, mc_search_cond);
break; break;
case MC_SEARCH_T_NORMAL: case MC_SEARCH_T_NORMAL:
mc_search__cond_struct_new_init_normal (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_normal (charset, lc_mc_search, mc_search_cond);
break; break;
case MC_SEARCH_T_REGEX: case MC_SEARCH_T_REGEX:
mc_search__cond_struct_new_init_regex (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_regex (charset, lc_mc_search, mc_search_cond);
break; break;
case MC_SEARCH_T_HEX: case MC_SEARCH_T_HEX:
mc_search__cond_struct_new_init_hex (charset, mc_search, mc_search_cond); mc_search__cond_struct_new_init_hex (charset, lc_mc_search, mc_search_cond);
break; break;
default: default:
break; break;
@ -114,11 +114,11 @@ static void
mc_search__conditions_free (GPtrArray * array) mc_search__conditions_free (GPtrArray * array)
{ {
gsize loop1; gsize loop1;
mc_search_cond_t *mc_search; mc_search_cond_t *lc_mc_search;
for (loop1 = 0; loop1 < array->len; loop1++) { for (loop1 = 0; loop1 < array->len; loop1++) {
mc_search = (mc_search_cond_t *) g_ptr_array_index (array, loop1); lc_mc_search = (mc_search_cond_t *) g_ptr_array_index (array, loop1);
mc_search__cond_struct_free (mc_search); mc_search__cond_struct_free (lc_mc_search);
} }
g_ptr_array_free (array, TRUE); g_ptr_array_free (array, TRUE);
} }
@ -132,7 +132,7 @@ mc_search__conditions_free (GPtrArray * array)
mc_search_t * mc_search_t *
mc_search_new (const gchar * original, gsize str_len) mc_search_new (const gchar * original, gsize str_len)
{ {
mc_search_t *mc_search; mc_search_t *lc_mc_search;
if (!original) if (!original)
return NULL; return NULL;
@ -142,128 +142,128 @@ mc_search_new (const gchar * original, gsize str_len)
return NULL; return NULL;
} }
mc_search = g_malloc0 (sizeof (mc_search_t)); lc_mc_search = g_malloc0 (sizeof (mc_search_t));
mc_search->original = g_strndup (original, str_len); lc_mc_search->original = g_strndup (original, str_len);
mc_search->original_len = str_len; lc_mc_search->original_len = str_len;
return mc_search; return lc_mc_search;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
mc_search_free (mc_search_t * mc_search) mc_search_free (mc_search_t * lc_mc_search)
{ {
if (!mc_search) if (!lc_mc_search)
return; return;
g_free (mc_search->original); g_free (lc_mc_search->original);
g_free (mc_search->error_str); g_free (lc_mc_search->error_str);
if (mc_search->conditions) if (lc_mc_search->conditions)
mc_search__conditions_free (mc_search->conditions); mc_search__conditions_free (lc_mc_search->conditions);
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
if (mc_search->regex_match_info) if (lc_mc_search->regex_match_info)
g_match_info_free (mc_search->regex_match_info); g_match_info_free (lc_mc_search->regex_match_info);
#else /* SEARCH_TYPE_GLIB */ #else /* SEARCH_TYPE_GLIB */
g_free (mc_search->regex_match_info); g_free (lc_mc_search->regex_match_info);
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
if (mc_search->regex_buffer != NULL) if (lc_mc_search->regex_buffer != NULL)
g_string_free (mc_search->regex_buffer, TRUE); g_string_free (lc_mc_search->regex_buffer, TRUE);
g_free (mc_search); g_free (lc_mc_search);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search_prepare (mc_search_t * mc_search) mc_search_prepare (mc_search_t * lc_mc_search)
{ {
GPtrArray *ret; GPtrArray *ret;
ret = g_ptr_array_new (); ret = g_ptr_array_new ();
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
if (mc_search->is_all_charsets) { if (lc_mc_search->is_all_charsets) {
gsize loop1, recoded_str_len; gsize loop1, recoded_str_len;
gchar *buffer; gchar *buffer;
for (loop1 = 0; loop1 < (gsize) n_codepages; loop1++) { for (loop1 = 0; loop1 < (gsize) n_codepages; loop1++) {
if (!g_ascii_strcasecmp (codepages[loop1].id, cp_source)) { if (!g_ascii_strcasecmp (codepages[loop1].id, cp_source)) {
g_ptr_array_add (ret, g_ptr_array_add (ret,
mc_search__cond_struct_new (mc_search, mc_search->original, mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original,
mc_search->original_len, cp_source)); lc_mc_search->original_len, cp_source));
continue; continue;
} }
buffer = buffer =
mc_search__recode_str (mc_search->original, mc_search->original_len, cp_source, mc_search__recode_str (lc_mc_search->original, lc_mc_search->original_len, cp_source,
codepages[loop1].id, &recoded_str_len); codepages[loop1].id, &recoded_str_len);
if (buffer == NULL) if (buffer == NULL)
continue; continue;
g_ptr_array_add (ret, g_ptr_array_add (ret,
mc_search__cond_struct_new (mc_search, buffer, mc_search__cond_struct_new (lc_mc_search, buffer,
recoded_str_len, codepages[loop1].id)); recoded_str_len, codepages[loop1].id));
g_free (buffer); g_free (buffer);
} }
} else { } else {
g_ptr_array_add (ret, g_ptr_array_add (ret,
(gpointer) mc_search__cond_struct_new (mc_search, mc_search->original, (gpointer) mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original,
mc_search->original_len, lc_mc_search->original_len,
cp_source)); cp_source));
} }
#else #else
g_ptr_array_add (ret, g_ptr_array_add (ret,
(gpointer) mc_search__cond_struct_new (mc_search, mc_search->original, (gpointer) mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original,
mc_search->original_len, lc_mc_search->original_len,
str_detect_termencoding ())); str_detect_termencoding ()));
#endif #endif
mc_search->conditions = ret; lc_mc_search->conditions = ret;
return (mc_search->error == MC_SEARCH_E_OK); return (lc_mc_search->error == MC_SEARCH_E_OK);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search_run (mc_search_t * mc_search, const void *user_data, mc_search_run (mc_search_t * lc_mc_search, const void *user_data,
gsize start_search, gsize end_search, gsize * found_len) gsize start_search, gsize end_search, gsize * found_len)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
if (!mc_search) if (!lc_mc_search)
return FALSE; return FALSE;
if (!mc_search_is_type_avail (mc_search->search_type)) { if (!mc_search_is_type_avail (lc_mc_search->search_type)) {
mc_search->error = MC_SEARCH_E_INPUT; lc_mc_search->error = MC_SEARCH_E_INPUT;
mc_search->error_str = g_strdup (_(STR_E_UNKNOWN_TYPE)); lc_mc_search->error_str = g_strdup (_(STR_E_UNKNOWN_TYPE));
return FALSE; return FALSE;
} }
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
if (mc_search->regex_match_info) { if (lc_mc_search->regex_match_info) {
g_match_info_free (mc_search->regex_match_info); g_match_info_free (lc_mc_search->regex_match_info);
mc_search->regex_match_info = NULL; lc_mc_search->regex_match_info = NULL;
} }
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
mc_search->error = MC_SEARCH_E_OK; lc_mc_search->error = MC_SEARCH_E_OK;
g_free (mc_search->error_str); g_free (lc_mc_search->error_str);
mc_search->error_str = NULL; lc_mc_search->error_str = NULL;
if ((mc_search->conditions == NULL) && !mc_search_prepare (mc_search)) if ((lc_mc_search->conditions == NULL) && !mc_search_prepare (lc_mc_search))
return FALSE; return FALSE;
switch (mc_search->search_type) { switch (lc_mc_search->search_type) {
case MC_SEARCH_T_NORMAL: case MC_SEARCH_T_NORMAL:
ret = mc_search__run_normal (mc_search, user_data, start_search, end_search, found_len); ret = mc_search__run_normal (lc_mc_search, user_data, start_search, end_search, found_len);
break; break;
case MC_SEARCH_T_REGEX: case MC_SEARCH_T_REGEX:
ret = mc_search__run_regex (mc_search, user_data, start_search, end_search, found_len); ret = mc_search__run_regex (lc_mc_search, user_data, start_search, end_search, found_len);
break; break;
case MC_SEARCH_T_GLOB: case MC_SEARCH_T_GLOB:
ret = mc_search__run_glob (mc_search, user_data, start_search, end_search, found_len); ret = mc_search__run_glob (lc_mc_search, user_data, start_search, end_search, found_len);
break; break;
case MC_SEARCH_T_HEX: case MC_SEARCH_T_HEX:
ret = mc_search__run_hex (mc_search, user_data, start_search, end_search, found_len); ret = mc_search__run_hex (lc_mc_search, user_data, start_search, end_search, found_len);
break; break;
default: default:
break; break;
@ -304,28 +304,28 @@ mc_search_types_list_get (size_t *num)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
GString * GString *
mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str) mc_search_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str)
{ {
GString *ret; GString *ret;
if (mc_search == NULL) if (lc_mc_search == NULL)
return g_string_new_len (replace_str->str, replace_str->len); return g_string_new_len (replace_str->str, replace_str->len);
if (replace_str == NULL || replace_str->str == NULL || replace_str->len == 0) if (replace_str == NULL || replace_str->str == NULL || replace_str->len == 0)
return g_string_new (""); return g_string_new ("");
switch (mc_search->search_type) { switch (lc_mc_search->search_type) {
case MC_SEARCH_T_REGEX: case MC_SEARCH_T_REGEX:
ret = mc_search_regex_prepare_replace_str (mc_search, replace_str); ret = mc_search_regex_prepare_replace_str (lc_mc_search, replace_str);
break; break;
case MC_SEARCH_T_GLOB: case MC_SEARCH_T_GLOB:
ret = mc_search_glob_prepare_replace_str (mc_search, replace_str); ret = mc_search_glob_prepare_replace_str (lc_mc_search, replace_str);
break; break;
case MC_SEARCH_T_NORMAL: case MC_SEARCH_T_NORMAL:
ret = mc_search_normal_prepare_replace_str (mc_search, replace_str); ret = mc_search_normal_prepare_replace_str (lc_mc_search, replace_str);
break; break;
case MC_SEARCH_T_HEX: case MC_SEARCH_T_HEX:
ret = mc_search_hex_prepare_replace_str (mc_search, replace_str); ret = mc_search_hex_prepare_replace_str (lc_mc_search, replace_str);
break; break;
default: default:
ret = g_string_new_len (replace_str->str, replace_str->len); ret = g_string_new_len (replace_str->str, replace_str->len);
@ -337,11 +337,11 @@ mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
char * char *
mc_search_prepare_replace_str2 (mc_search_t * mc_search, char *replace_str) mc_search_prepare_replace_str2 (mc_search_t * lc_mc_search, char *replace_str)
{ {
GString *ret; GString *ret;
GString *replace_str2 = g_string_new (replace_str); GString *replace_str2 = g_string_new (replace_str);
ret = mc_search_prepare_replace_str (mc_search, replace_str2); ret = mc_search_prepare_replace_str (lc_mc_search, replace_str2);
g_string_free (replace_str2, TRUE); g_string_free (replace_str2, TRUE);
if (ret) if (ret)
return g_string_free (ret, FALSE); return g_string_free (ret, FALSE);
@ -351,11 +351,11 @@ mc_search_prepare_replace_str2 (mc_search_t * mc_search, char *replace_str)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
gboolean gboolean
mc_search_is_fixed_search_str (mc_search_t * mc_search) mc_search_is_fixed_search_str (mc_search_t * lc_mc_search)
{ {
if (mc_search == NULL) if (lc_mc_search == NULL)
return FALSE; return FALSE;
switch (mc_search->search_type) { switch (lc_mc_search->search_type) {
case MC_SEARCH_T_REGEX: case MC_SEARCH_T_REGEX:
case MC_SEARCH_T_GLOB: case MC_SEARCH_T_GLOB:
return FALSE; return FALSE;
@ -389,21 +389,21 @@ mc_search (const gchar * pattern, const gchar * str, mc_search_type_t type)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
int int
mc_search_getstart_rezult_by_num (mc_search_t * mc_search, int index) mc_search_getstart_rezult_by_num (mc_search_t * lc_mc_search, int lc_index)
{ {
if (!mc_search) if (!lc_mc_search)
return 0; return 0;
if (mc_search->search_type == MC_SEARCH_T_NORMAL) if (lc_mc_search->search_type == MC_SEARCH_T_NORMAL)
return 0; return 0;
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
{ {
gint start_pos; gint start_pos;
gint end_pos; gint end_pos;
g_match_info_fetch_pos (mc_search->regex_match_info, index, &start_pos, &end_pos); g_match_info_fetch_pos (lc_mc_search->regex_match_info, lc_index, &start_pos, &end_pos);
return (int) start_pos; return (int) start_pos;
} }
#else /* SEARCH_TYPE_GLIB */ #else /* SEARCH_TYPE_GLIB */
return mc_search->iovector[index * 2]; return lc_mc_search->iovector[lc_index * 2];
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
} }
@ -411,21 +411,21 @@ mc_search_getstart_rezult_by_num (mc_search_t * mc_search, int index)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
int int
mc_search_getend_rezult_by_num (mc_search_t * mc_search, int index) mc_search_getend_rezult_by_num (mc_search_t * lc_mc_search, int lc_index)
{ {
if (!mc_search) if (!lc_mc_search)
return 0; return 0;
if (mc_search->search_type == MC_SEARCH_T_NORMAL) if (lc_mc_search->search_type == MC_SEARCH_T_NORMAL)
return 0; return 0;
#ifdef SEARCH_TYPE_GLIB #ifdef SEARCH_TYPE_GLIB
{ {
gint start_pos; gint start_pos;
gint end_pos; gint end_pos;
g_match_info_fetch_pos (mc_search->regex_match_info, index, &start_pos, &end_pos); g_match_info_fetch_pos (lc_mc_search->regex_match_info, lc_index, &start_pos, &end_pos);
return (int) end_pos; return (int) end_pos;
} }
#else /* SEARCH_TYPE_GLIB */ #else /* SEARCH_TYPE_GLIB */
return mc_search->iovector[index * 2 + 1]; return lc_mc_search->iovector[lc_index * 2 + 1];
#endif /* SEARCH_TYPE_GLIB */ #endif /* SEARCH_TYPE_GLIB */
} }

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

@ -560,7 +560,7 @@ load_setup_get_full_config_name(const char *subdir, const char *config_file_name
Also, need to rename stupid mc_home and mc_home_alt to mc_sysconfdir and mc_datadir; Also, need to rename stupid mc_home and mc_home_alt to mc_sysconfdir and mc_datadir;
home_mc => mc_user_homedir home_mc => mc_user_homedir
*/ */
char *basename, *ret; char *lc_basename, *ret;
if (config_file_name == NULL) if (config_file_name == NULL)
return NULL; return NULL;
@ -569,45 +569,45 @@ load_setup_get_full_config_name(const char *subdir, const char *config_file_name
return g_strdup(config_file_name); return g_strdup(config_file_name);
basename = g_path_get_basename(config_file_name); lc_basename = g_path_get_basename(config_file_name);
if (basename == NULL) if (lc_basename == NULL)
return NULL; return NULL;
if (subdir) if (subdir)
ret = g_build_filename (home_dir, MC_USERCONF_DIR, subdir, basename, NULL); ret = g_build_filename (home_dir, MC_USERCONF_DIR, subdir, lc_basename, NULL);
else else
ret = g_build_filename (home_dir, MC_USERCONF_DIR, basename, NULL); ret = g_build_filename (home_dir, MC_USERCONF_DIR, lc_basename, NULL);
if (exist_file(ret)) { if (exist_file(ret)) {
g_free(basename); g_free(lc_basename);
return ret; return ret;
} }
g_free(ret); g_free(ret);
if (subdir) if (subdir)
ret = g_build_filename (mc_home, subdir, basename, NULL); ret = g_build_filename (mc_home, subdir, lc_basename, NULL);
else else
ret = g_build_filename (mc_home, basename, NULL); ret = g_build_filename (mc_home, lc_basename, NULL);
if (exist_file(ret)) { if (exist_file(ret)) {
g_free(basename); g_free(lc_basename);
return ret; return ret;
} }
g_free(ret); g_free(ret);
if (subdir) if (subdir)
ret = g_build_filename (mc_home_alt, subdir, basename, NULL); ret = g_build_filename (mc_home_alt, subdir, lc_basename, NULL);
else else
ret = g_build_filename (mc_home_alt, basename, NULL); ret = g_build_filename (mc_home_alt, lc_basename, NULL);
if (exist_file(ret)) { if (exist_file(ret)) {
g_free(basename); g_free(lc_basename);
return ret; return ret;
} }
g_free(ret); g_free(ret);
g_free(basename); g_free(lc_basename);
return NULL; return NULL;
} }

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

@ -90,15 +90,15 @@ mc_skin_colors_old_t old_colors[] = {
static gboolean static gboolean
mc_skin_colors_old_transform (const char *old_color, const char **group, const char **key) mc_skin_colors_old_transform (const char *old_color, const char **group, const char **key)
{ {
int index; int lc_index;
if (old_color != NULL) if (old_color != NULL)
for (index = 0; old_colors[index].old_color; index++) { for (lc_index = 0; old_colors[lc_index].old_color; lc_index++) {
if (strcasecmp (old_color, old_colors[index].old_color) == 0) { if (strcasecmp (old_color, old_colors[lc_index].old_color) == 0) {
if (group != NULL) if (group != NULL)
*group = old_colors[index].group; *group = old_colors[lc_index].group;
if (key != NULL) if (key != NULL)
*key = old_colors[index].key; *key = old_colors[lc_index].key;
return TRUE; return TRUE;
} }
} }

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

@ -120,6 +120,7 @@ mc_skin_try_to_load_default (void)
gboolean gboolean
mc_skin_init (GError ** error) mc_skin_init (GError ** error)
{ {
gboolean is_good_init = TRUE;
mc_skin__default.name = mc_skin_get_default_name (); mc_skin__default.name = mc_skin_get_default_name ();
@ -127,8 +128,6 @@ mc_skin_init (GError ** error)
mc_skin_hash_destroy_key, mc_skin_hash_destroy_key,
mc_skin_hash_destroy_value); mc_skin_hash_destroy_value);
gboolean is_good_init = TRUE;
if (!mc_skin_ini_file_load (&mc_skin__default)) { if (!mc_skin_ini_file_load (&mc_skin__default)) {
*error = g_error_new (MC_ERROR, 0, *error = g_error_new (MC_ERROR, 0,
_("Unable to load '%s' skin.\nDefault skin has been loaded"), _("Unable to load '%s' skin.\nDefault skin has been loaded"),

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

@ -402,7 +402,7 @@ str_init_strings (const char *termenc)
} }
void void
str_uninit_strings () str_uninit_strings (void)
{ {
g_iconv_close (str_cnv_not_convert); g_iconv_close (str_cnv_not_convert);
g_free (codeset); g_free (codeset);

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

@ -133,9 +133,9 @@ struct str_class {
void (*release_key) (char *key, int case_sen); /*I*/ void (*release_key) (char *key, int case_sen); /*I*/
}; };
struct str_class str_utf8_init (); struct str_class str_utf8_init (void);
struct str_class str_8bit_init (); struct str_class str_8bit_init (void);
struct str_class str_ascii_init (); struct str_class str_ascii_init (void);
/* create convertor from "from_enc" to terminal encoding /* create convertor from "from_enc" to terminal encoding
* if "from_enc" is not supported return INVALID_CONV * if "from_enc" is not supported return INVALID_CONV
@ -200,7 +200,7 @@ void str_init_strings (const char *termenc);
/* free all str_buffer and all str_cnv_* /* free all str_buffer and all str_cnv_*
*/ */
void str_uninit_strings (); void str_uninit_strings (void);
/* try convert characters in ch to output using conv /* try convert characters in ch to output using conv
* ch_size is size of ch, can by (size_t)(-1) (-1 only for ASCII * ch_size is size of ch, can by (size_t)(-1) (-1 only for ASCII

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

@ -700,7 +700,7 @@ str_8bit_release_key (char *key, int case_sen)
} }
struct str_class struct str_class
str_8bit_init () str_8bit_init (void)
{ {
struct str_class result; struct str_class result;

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

@ -677,7 +677,7 @@ str_ascii_caseprefix (const char *text, const char *prefix)
struct str_class struct str_class
str_ascii_init () str_ascii_init (void)
{ {
struct str_class result; struct str_class result;

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

@ -1297,7 +1297,7 @@ str_utf8_release_key (char *key, int case_sen)
} }
struct str_class struct str_class
str_utf8_init () str_utf8_init (void)
{ {
struct str_class result; struct str_class result;

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

@ -206,7 +206,7 @@ tree_store_load_from(char *name)
while (fgets(buffer, MC_MAXPATHLEN, file)) { while (fgets(buffer, MC_MAXPATHLEN, file)) {
tree_entry *e; tree_entry *e;
int scanned; int scanned;
char *name; char *lc_name;
/* Skip invalid records */ /* Skip invalid records */
if ((buffer[0] != '0' && buffer[0] != '1')) if ((buffer[0] != '0' && buffer[0] != '1'))
@ -217,12 +217,12 @@ tree_store_load_from(char *name)
scanned = buffer[0] == '1'; scanned = buffer[0] == '1';
name = decode(buffer + 2); lc_name = decode(buffer + 2);
len = strlen(name); len = strlen(lc_name);
if (name[0] != PATH_SEP) { if (name[0] != PATH_SEP) {
/* Clear-text decompression */ /* Clear-text decompression */
char *s = strtok(name, " "); char *s = strtok(lc_name, " ");
if (s) { if (s) {
common = atoi(s); common = atoi(s);
@ -236,13 +236,13 @@ tree_store_load_from(char *name)
} }
} }
} else { } else {
if (vfs_file_is_local(name)) { if (vfs_file_is_local(lc_name)) {
e = tree_store_add_entry(name); e = tree_store_add_entry(lc_name);
e->scanned = scanned; e->scanned = scanned;
} }
strcpy(oldname, name); strcpy(oldname, lc_name);
} }
g_free(name); g_free(lc_name);
} }
fclose(file); fclose(file);
} }
@ -465,7 +465,6 @@ tree_store_add_entry(const char *name)
if (new->sublevel > 1) { if (new->sublevel > 1) {
/* Let's check if the parent directory is in the tree */ /* Let's check if the parent directory is in the tree */
char *parent = g_strdup(new->name); char *parent = g_strdup(new->name);
int i;
for (i = strlen(parent) - 1; i > 1; i--) { for (i = strlen(parent) - 1; i > 1; i--) {
if (parent[i] == PATH_SEP) { if (parent[i] == PATH_SEP) {

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

@ -1230,24 +1230,24 @@ check_movement_keys (int key, int page_size, void *data, move_fn backfn,
} }
static int static int
lookup_keyname (const char *keyname, int *index) lookup_keyname (const char *keyname, int *lc_index)
{ {
if (keyname[0] != '\0') { if (keyname[0] != '\0') {
int i; int i;
if (keyname[1] == '\0') { if (keyname[1] == '\0') {
*index = -1; *lc_index = -1;
return (int) keyname[0]; return (int) keyname[0];
} }
for (i = 0; key_name_conv_tab[i].code; i++) for (i = 0; key_name_conv_tab[i].code; i++)
if (str_casecmp (key_name_conv_tab[i].name, keyname) == 0) { if (str_casecmp (key_name_conv_tab[i].name, keyname) == 0) {
*index = i; *lc_index = i;
return key_name_conv_tab[i].code; return key_name_conv_tab[i].code;
} }
} }
*index = -1; *lc_index = -1;
return 0; return 0;
} }
@ -1255,10 +1255,10 @@ lookup_keyname (const char *keyname, int *index)
int int
lookup_key (const char *keyname, char **label) lookup_key (const char *keyname, char **label)
{ {
char **keys, **p; char **lc_keys, **p;
int k = -1; int k = -1;
int key = 0; int key = 0;
int index = -1; int lc_index = -1;
int use_meta = -1; int use_meta = -1;
int use_ctrl = -1; int use_ctrl = -1;
@ -1268,7 +1268,7 @@ lookup_key (const char *keyname, char **label)
return 0; return 0;
keyname = g_strstrip (g_strdup (keyname)); keyname = g_strstrip (g_strdup (keyname));
p = keys = g_strsplit_set (keyname, "-+ ", -1); p = lc_keys = g_strsplit_set (keyname, "-+ ", -1);
g_free ((char *) keyname); g_free ((char *) keyname);
while ((p != NULL) && (*p != NULL)) { while ((p != NULL) && (*p != NULL)) {
@ -1285,7 +1285,7 @@ lookup_key (const char *keyname, char **label)
use_shift = idx; use_shift = idx;
else { else {
k = key; k = key;
index = idx; lc_index = idx;
break; break;
} }
} }
@ -1293,7 +1293,7 @@ lookup_key (const char *keyname, char **label)
p++; p++;
} }
g_strfreev (keys); g_strfreev (lc_keys);
/* output */ /* output */
if (k <= 0) if (k <= 0)
@ -1319,16 +1319,16 @@ lookup_key (const char *keyname, char **label)
else { else {
g_string_append (s, key_name_conv_tab[use_shift].shortcut); g_string_append (s, key_name_conv_tab[use_shift].shortcut);
g_string_append_c (s, '-'); g_string_append_c (s, '-');
g_string_append (s, key_name_conv_tab[index].shortcut); g_string_append (s, key_name_conv_tab[lc_index].shortcut);
} }
} else if (k < 128) { } else if (k < 128) {
if ((k >= 'A') || (index < 0) if ((k >= 'A') || (lc_index < 0)
|| (key_name_conv_tab[index].shortcut == NULL)) || (key_name_conv_tab[lc_index].shortcut == NULL))
g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) k)); g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) k));
else else
g_string_append (s, key_name_conv_tab[index].shortcut); g_string_append (s, key_name_conv_tab[lc_index].shortcut);
} else if ((index != -1) && (key_name_conv_tab[index].shortcut != NULL)) } else if ((lc_index != -1) && (key_name_conv_tab[lc_index].shortcut != NULL))
g_string_append (s, key_name_conv_tab[index].shortcut); g_string_append (s, key_name_conv_tab[lc_index].shortcut);
else else
g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) key)); g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) key));

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

@ -175,7 +175,7 @@ strip_ext(char *ss)
} }
char * char *
expand_format (WEdit *edit_widget, char c, int quote) expand_format (WEdit *edit_widget, char c, int lc_quote)
{ {
WPanel *panel = NULL; WPanel *panel = NULL;
char *(*quote_func) (const char *, int); char *(*quote_func) (const char *, int);
@ -201,7 +201,7 @@ expand_format (WEdit *edit_widget, char c, int quote)
fname = str_unconst (edit_get_file_name (edit_widget)); fname = str_unconst (edit_get_file_name (edit_widget));
#endif #endif
if (quote) if (lc_quote)
quote_func = name_quote; quote_func = name_quote;
else else
quote_func = fake_name_quote; quote_func = fake_name_quote;
@ -604,7 +604,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
int expand_prefix_found = 0; int expand_prefix_found = 0;
char *parameter = 0; char *parameter = 0;
int do_quote = 0; int do_quote = 0;
char prompt [80]; char lc_prompt [80];
int col; int col;
char *file_name; char *file_name;
int run_view = 0; int run_view = 0;
@ -642,7 +642,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
if (*commands == '}'){ if (*commands == '}'){
char *tmp; char *tmp;
*parameter = 0; *parameter = 0;
parameter = input_dialog (_(" Parameter "), prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, ""); parameter = input_dialog (_(" Parameter "), lc_prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, "");
if (!parameter || !*parameter){ if (!parameter || !*parameter){
/* User canceled */ /* User canceled */
fclose (cmd_file); fclose (cmd_file);
@ -658,7 +658,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
g_free (parameter); g_free (parameter);
parameter = 0; parameter = 0;
} else { } else {
if (parameter < &prompt [sizeof (prompt) - 1]) { if (parameter < &lc_prompt [sizeof (lc_prompt) - 1]) {
*parameter++ = *commands; *parameter++ = *commands;
} }
} }
@ -670,7 +670,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
commands++; commands++;
} }
if (*commands == '{') if (*commands == '{')
parameter = prompt; parameter = lc_prompt;
else{ else{
char *text = expand_format (edit_widget, *commands, do_quote); char *text = expand_format (edit_widget, *commands, do_quote);
fputs (text, cmd_file); fputs (text, cmd_file);

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

@ -1243,7 +1243,7 @@ concat_dir_and_file (const char *dir, const char *file)
GList * GList *
list_append_unique (GList *list, char *text) list_append_unique (GList *list, char *text)
{ {
GList *link, *newlink, *tmp; GList *lc_link, *newlink, *tmp;
/* /*
* Go to the last position and traverse the list backwards * Go to the last position and traverse the list backwards
@ -1252,16 +1252,16 @@ list_append_unique (GList *list, char *text)
*/ */
list = g_list_append (list, text); list = g_list_append (list, text);
list = g_list_last (list); list = g_list_last (list);
link = g_list_previous (list); lc_link = g_list_previous (list);
while (link) { while (lc_link) {
newlink = g_list_previous (link); newlink = g_list_previous (lc_link);
if (!strcmp ((char *) link->data, text)) { if (!strcmp ((char *) lc_link->data, text)) {
g_free (link->data); g_free (lc_link->data);
tmp = g_list_remove_link (list, link); tmp = g_list_remove_link (list, lc_link);
g_list_free_1 (link); g_list_free_1 (lc_link);
} }
link = newlink; lc_link = newlink;
} }
return list; return list;

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

@ -67,6 +67,36 @@
/*** file scope functions ************************************************************************/ /*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* Find and return the index of the last cache entry that is
* smaller than ''coord'', according to the criterion ''sort_by''. */
static guint
mcview_ccache_find (mcview_t * view, const struct coord_cache_entry *cache,
const struct coord_cache_entry *coord, enum ccache_type sort_by)
{
guint base, i, limit;
limit = view->coord_cache->len;
assert (limit != 0);
base = 0;
while (limit > 1) {
i = base + limit / 2;
if (mcview_coord_cache_entry_less (coord, &cache[i], sort_by, view->text_nroff_mode)) {
/* continue the search in the lower half of the cache */
} else {
/* continue the search in the upper half of the cache */
base = i;
}
limit = (limit + 1) / 2;
}
return base;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -161,33 +191,6 @@ mcview_ccache_dump (mcview_t * view)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/* Find and return the index of the last cache entry that is
* smaller than ''coord'', according to the criterion ''sort_by''. */
guint
mcview_ccache_find (mcview_t * view, const struct coord_cache_entry *cache,
const struct coord_cache_entry *coord, enum ccache_type sort_by)
{
guint base, i, limit;
limit = view->coord_cache->len;
assert (limit != 0);
base = 0;
while (limit > 1) {
i = base + limit / 2;
if (mcview_coord_cache_entry_less (coord, &cache[i], sort_by, view->text_nroff_mode)) {
/* continue the search in the lower half of the cache */
} else {
/* continue the search in the upper half of the cache */
base = i;
}
limit = (limit + 1) / 2;
}
return base;
}
/* --------------------------------------------------------------------------------------------- */
/* Look up the missing components of ''coord'', which are given by /* Look up the missing components of ''coord'', which are given by
* ''lookup_what''. The function returns the smallest value that * ''lookup_what''. The function returns the smallest value that

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

@ -168,10 +168,14 @@ mcview_growbuf_read_until (mcview_t * view, off_t ofs)
gboolean gboolean
mcview_get_byte_growing_buffer (mcview_t * view, off_t byte_index, int *retval) mcview_get_byte_growing_buffer (mcview_t * view, off_t byte_index, int *retval)
{ {
off_t pageno;
off_t pageindex;
if (retval) if (retval)
*retval = -1; *retval = -1;
off_t pageno = byte_index / VIEW_PAGE_SIZE;
off_t pageindex = byte_index % VIEW_PAGE_SIZE; pageno = byte_index / VIEW_PAGE_SIZE;
pageindex = byte_index % VIEW_PAGE_SIZE;
assert (view->growbuf_in_use); assert (view->growbuf_in_use);

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

@ -262,7 +262,7 @@ int
mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line) mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line)
{ {
gboolean succeeded; gboolean succeeded;
mcview_t *mcview_t; mcview_t *lc_mcview;
WButtonBar *bar; WButtonBar *bar;
Dlg_head *view_dlg; Dlg_head *view_dlg;
@ -271,18 +271,18 @@ mcview_viewer (const char *command, const char *file, int *move_dir_p, int start
create_dlg (0, 0, LINES, COLS, NULL, mcview_dialog_callback, create_dlg (0, 0, LINES, COLS, NULL, mcview_dialog_callback,
"[Internal File Viewer]", NULL, DLG_WANT_TAB); "[Internal File Viewer]", NULL, DLG_WANT_TAB);
mcview_t = mcview_new (0, 0, COLS, LINES - 1, 0); lc_mcview = mcview_new (0, 0, COLS, LINES - 1, 0);
bar = buttonbar_new (1); bar = buttonbar_new (1);
add_widget (view_dlg, bar); add_widget (view_dlg, bar);
add_widget (view_dlg, mcview_t); add_widget (view_dlg, lc_mcview);
succeeded = mcview_load (mcview_t, command, file, start_line); succeeded = mcview_load (lc_mcview, command, file, start_line);
if (succeeded) { if (succeeded) {
run_dlg (view_dlg); run_dlg (view_dlg);
if (move_dir_p) if (move_dir_p)
*move_dir_p = mcview_t->move_dir; *move_dir_p = lc_mcview->move_dir;
} else { } else {
if (move_dir_p) if (move_dir_p)
*move_dir_p = 0; *move_dir_p = 0;

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

@ -222,14 +222,14 @@ mcview__get_nroff_real_len (mcview_t * view, off_t start, off_t length)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
mcview_nroff_t * mcview_nroff_t *
mcview_nroff_seq_new_num (mcview_t * view, off_t index) mcview_nroff_seq_new_num (mcview_t * view, off_t lc_index)
{ {
mcview_nroff_t *nroff; mcview_nroff_t *nroff;
nroff = g_malloc0 (sizeof (mcview_nroff_t)); nroff = g_malloc0 (sizeof (mcview_nroff_t));
if (nroff == NULL) if (nroff == NULL)
return NULL; return NULL;
nroff->index = index; nroff->index = lc_index;
nroff->view = view; nroff->view = view;
mcview_nroff_seq_info (nroff); mcview_nroff_seq_info (nroff);
return nroff; return nroff;

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

@ -113,15 +113,15 @@ mcview_find (mcview_t * view, gsize search_start, gsize * len)
int int
mcview_search_cmd_callback (const void *user_data, gsize char_offset) mcview_search_cmd_callback (const void *user_data, gsize char_offset)
{ {
int byte; int lc_byte;
mcview_t *view = (mcview_t *) user_data; mcview_t *view = (mcview_t *) user_data;
/* view_read_continue (view, &view->search_onechar_info); *//* AB:FIXME */ /* view_read_continue (view, &view->search_onechar_info); *//* AB:FIXME */
if (!view->text_nroff_mode) { if (!view->text_nroff_mode) {
if (! mcview_get_byte (view, char_offset, &byte)) if (! mcview_get_byte (view, char_offset, &lc_byte))
return MC_SEARCH_CB_ABORT; return MC_SEARCH_CB_ABORT;
return byte; return lc_byte;
} }
if (view->search_numNeedSkipChar) { if (view->search_numNeedSkipChar) {
@ -129,9 +129,9 @@ mcview_search_cmd_callback (const void *user_data, gsize char_offset)
return MC_SEARCH_CB_SKIP; return MC_SEARCH_CB_SKIP;
} }
byte = view->search_nroff_seq->current_char; lc_byte = view->search_nroff_seq->current_char;
if (byte == -1) if (lc_byte == -1)
return MC_SEARCH_CB_ABORT; return MC_SEARCH_CB_ABORT;
mcview_nroff_seq_next (view->search_nroff_seq); mcview_nroff_seq_next (view->search_nroff_seq);
@ -139,7 +139,7 @@ mcview_search_cmd_callback (const void *user_data, gsize char_offset)
if (view->search_nroff_seq->type != NROFF_TYPE_NONE) if (view->search_nroff_seq->type != NROFF_TYPE_NONE)
view->search_numNeedSkipChar = 2; view->search_numNeedSkipChar = 2;
return byte; return lc_byte;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

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

@ -370,7 +370,7 @@ radio_callback (Widget *w, widget_msg_t msg, int parm)
switch (msg) { switch (msg) {
case WIDGET_HOTKEY: case WIDGET_HOTKEY:
{ {
int i, lp = g_ascii_tolower ((gchar)parm); int lp = g_ascii_tolower ((gchar)parm);
for (i = 0; i < r->count; i++) { for (i = 0; i < r->count; i++) {
if (r->texts[i].hotkey != NULL) { if (r->texts[i].hotkey != NULL) {
@ -2794,11 +2794,11 @@ buttonbar_new (int visible)
} }
static void static void
set_label_text (WButtonBar * bb, int index, const char *text) set_label_text (WButtonBar * bb, int lc_index, const char *text)
{ {
g_free (bb->labels[index - 1].text); g_free (bb->labels[lc_index - 1].text);
bb->labels[index - 1].text = g_strdup (text); bb->labels[lc_index - 1].text = g_strdup (text);
} }
/* Find ButtonBar widget in the dialog */ /* Find ButtonBar widget in the dialog */

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

@ -615,7 +615,7 @@ extfs_get_archive_name (struct archive *archive)
/* Don't pass localname as NULL */ /* Don't pass localname as NULL */
static int static int
extfs_cmd (const char *extfs_cmd, struct archive *archive, extfs_cmd (const char *str_extfs_cmd, struct archive *archive,
struct entry *entry, const char *localname) struct entry *entry, const char *localname)
{ {
char *file; char *file;
@ -634,7 +634,7 @@ extfs_cmd (const char *extfs_cmd, struct archive *archive,
mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR); mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype],
extfs_cmd, archive_name, " ", quoted_file, " ", str_extfs_cmd, archive_name, " ", quoted_file, " ",
quoted_localname, (char *) NULL); quoted_localname, (char *) NULL);
g_free (quoted_file); g_free (quoted_file);
g_free (quoted_localname); g_free (quoted_localname);

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

@ -239,7 +239,7 @@ void
vfs_expire (int now) vfs_expire (int now)
{ {
static int locked = 0; static int locked = 0;
struct timeval time; struct timeval lc_time;
struct vfs_stamping *stamp, *st; struct vfs_stamping *stamp, *st;
/* Avoid recursive invocation, e.g. when one of the free functions /* Avoid recursive invocation, e.g. when one of the free functions
@ -248,11 +248,11 @@ vfs_expire (int now)
return; return;
locked = 1; locked = 1;
gettimeofday (&time, NULL); gettimeofday (&lc_time, NULL);
time.tv_sec -= vfs_timeout; lc_time.tv_sec -= vfs_timeout;
for (stamp = stamps; stamp != NULL;) { for (stamp = stamps; stamp != NULL;) {
if (now || (timeoutcmp (&stamp->time, &time))) { if (now || (timeoutcmp (&stamp->time, &lc_time))) {
st = stamp->next; st = stamp->next;
if (stamp->v->free) if (stamp->v->free)
(*stamp->v->free) (stamp->id); (*stamp->v->free) (stamp->id);

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

@ -693,17 +693,17 @@ mcfs_loaddir (opendir_info *mcfs_info)
{ {
int status, error; int status, error;
mcfs_connection *mc = mcfs_info->conn; mcfs_connection *mc = mcfs_info->conn;
int link = mc->sock; int lc_link = mc->sock;
int first = 1; int first = 1;
rpc_send (link, RPC_INT, MC_READDIR, RPC_INT, mcfs_info->handle, rpc_send (lc_link, RPC_INT, MC_READDIR, RPC_INT, mcfs_info->handle,
RPC_END); RPC_END);
for (;;) { for (;;) {
int entry_len; int entry_len;
dir_entry *new_entry; dir_entry *new_entry;
if (!rpc_get (link, RPC_INT, &entry_len, RPC_END)) if (!rpc_get (lc_link, RPC_INT, &entry_len, RPC_END))
return 0; return 0;
if (entry_len == 0) if (entry_len == 0)
@ -723,11 +723,11 @@ mcfs_loaddir (opendir_info *mcfs_info)
} }
if (!rpc_get if (!rpc_get
(link, RPC_BLOCK, entry_len, new_entry->text, RPC_END)) (lc_link, RPC_BLOCK, entry_len, new_entry->text, RPC_END))
return 0; return 0;
/* Then we get the status from the lstat */ /* Then we get the status from the lstat */
if (!rpc_get (link, RPC_INT, &status, RPC_INT, &error, RPC_END)) if (!rpc_get (lc_link, RPC_INT, &status, RPC_INT, &error, RPC_END))
return 0; return 0;
if (mcfs_is_error (status, error)) if (mcfs_is_error (status, error))
@ -1253,11 +1253,4 @@ tcp_invalidate_socket (int sock)
{ {
mcfs_invalidate_socket (sock); mcfs_invalidate_socket (sock);
} }
#else
void mcfs__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* ENABLE_VFS_MCFS */ #endif /* ENABLE_VFS_MCFS */

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

@ -210,11 +210,4 @@ rpc_get (int sock, ...)
} }
} }
} }
#else
void mcfsutil__unused(void)
{
/*
CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"
*/
}
#endif /* ENABLE_VFS_MCFS */ #endif /* ENABLE_VFS_MCFS */

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

@ -182,7 +182,7 @@ smbfs_auth_cmp_host (gconstpointer _a, gconstpointer _b)
static void static void
smbfs_auth_add (const char *host, const char *share, const char *domain, smbfs_auth_add (const char *host, const char *share, const char *domain,
const char *user, const char *password) const char *user, const char *param_password)
{ {
struct smb_authinfo *auth = g_new (struct smb_authinfo, 1); struct smb_authinfo *auth = g_new (struct smb_authinfo, 1);
@ -194,7 +194,7 @@ smbfs_auth_add (const char *host, const char *share, const char *domain,
auth->share = g_strdup (share); auth->share = g_strdup (share);
auth->domain = g_strdup (domain); auth->domain = g_strdup (domain);
auth->user = g_strdup (user); auth->user = g_strdup (user);
auth->password = g_strdup (password); auth->password = g_strdup (param_password);
auth_list = g_slist_prepend (auth_list, auth); auth_list = g_slist_prepend (auth_list, auth);
} }

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

@ -234,7 +234,7 @@ vfs_findgid (const char *gname)
* We also protect stupid scripts agains dangerous names. * We also protect stupid scripts agains dangerous names.
*/ */
int int
vfs_mkstemps (char **pname, const char *prefix, const char *basename) vfs_mkstemps (char **pname, const char *prefix, const char *param_basename)
{ {
const char *p; const char *p;
char *suffix, *q; char *suffix, *q;
@ -242,9 +242,9 @@ vfs_mkstemps (char **pname, const char *prefix, const char *basename)
int fd; int fd;
/* Strip directories */ /* Strip directories */
p = strrchr (basename, PATH_SEP); p = strrchr (param_basename, PATH_SEP);
if (!p) if (!p)
p = basename; p = param_basename;
else else
p++; p++;
@ -761,12 +761,12 @@ vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
s->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR); s->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR);
p += 9; p += 9;
} else { } else {
size_t skipped; size_t lc_skipped;
mode_t perms; mode_t perms;
if (!vfs_parse_fileperms (p, &skipped, &perms)) if (!vfs_parse_fileperms (p, &lc_skipped, &perms))
goto error; goto error;
p += skipped; p += lc_skipped;
s->st_mode |= perms; s->st_mode |= perms;
} }
@ -889,11 +889,11 @@ vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
} }
if (t) { if (t) {
int p = strlen (t); int p2 = strlen (t);
if ((--p > 0) && (t[p] == '\r' || t[p] == '\n')) if ((--p2 > 0) && (t[p2] == '\r' || t[p2] == '\n'))
t[p] = 0; t[p2] = 0;
if ((--p > 0) && (t[p] == '\r' || t[p] == '\n')) if ((--p2 > 0) && (t[p2] == '\r' || t[p2] == '\n'))
t[p] = 0; t[p2] = 0;
} }
g_free (p_copy); g_free (p_copy);