diff --git a/edit/edit.c b/edit/edit.c index 50b3455c2..009018119 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -803,6 +803,7 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename, edit->utf8 = 0; edit->converter = str_cnv_from_term; #ifdef HAVE_CHARSET + { const char *cp_id = NULL; cp_id = get_codepage_id (source_codepage >= 0 ? source_codepage : display_codepage); @@ -818,6 +819,7 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename, } if (cp_id != NULL) edit->utf8 = str_isutf8 (cp_id); + } #endif edit->loading_done = 1; @@ -1186,7 +1188,7 @@ edit_insert (WEdit *edit, int c) edit->curs1++; } -void +static void edit_insert_over (WEdit * edit) { int i; diff --git a/src/achown.c b/src/achown.c index 3d2420da9..36cb4d2c4 100644 --- a/src/achown.c +++ b/src/achown.c @@ -629,36 +629,36 @@ static char *next_file (void) static void apply_advanced_chowns (struct stat *sf) { - char *fname; + char *lc_fname; gid_t a_gid = sf->st_gid; 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; - 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 "), - fname, unix_error_string (errno)); + lc_fname, unix_error_string (errno)); /* 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) 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 { - fname = next_file (); + lc_fname = next_file (); - if (mc_stat (fname, sf) != 0) + if (mc_stat (lc_fname, sf) != 0) break; 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 "), - fname, unix_error_string (errno)); + lc_fname, unix_error_string (errno)); /* 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) 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); } while (current_panel->marked); diff --git a/src/background.c b/src/background.c index 6dff3211c..c34a95ba3 100644 --- a/src/background.c +++ b/src/background.c @@ -88,7 +88,7 @@ register_task_running (FileOpContext *ctx, pid_t pid, int fd, int to_child, add_select_channel (fd, background_attention, ctx); } -int +static int destroy_task_and_return_fd (pid_t pid) { TaskList *p = task_list; diff --git a/src/boxes.c b/src/boxes.c index 83e450046..b1ab84607 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -975,7 +975,7 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain, static int dialog_x = 44; enum { b0 = 3, dialog_y = 12}; 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 int ilen = 30, istart = 14; static int b2 = 30; @@ -990,12 +990,12 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain, 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; while (i--) { - l1 = str_term_width1 (labs [i] = _(labs [i])); + l1 = str_term_width1 (lc_labs [i] = _(lc_labs [i])); if (l1 > maxlen) maxlen = l1; } @@ -1048,9 +1048,9 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain, in_password->is_password = 1; add_widget (auth_dlg, in_password); - add_widget (auth_dlg, label_new (7, 3, labs[2])); - add_widget (auth_dlg, label_new (5, 3, labs[1])); - add_widget (auth_dlg, label_new (3, 3, labs[0])); + add_widget (auth_dlg, label_new (7, 3, lc_labs[2])); + add_widget (auth_dlg, label_new (5, 3, lc_labs[1])); + add_widget (auth_dlg, label_new (3, 3, lc_labs[0])); run_dlg (auth_dlg); diff --git a/src/command.c b/src/command.c index 0225b28af..d95f06982 100644 --- a/src/command.c +++ b/src/command.c @@ -118,7 +118,7 @@ examine_cd (const char *_path) /* CDPATH handling */ if (*q != PATH_SEP && !result) { char * const cdpath = g_strdup (getenv ("CDPATH")); - char *p = cdpath; + p = cdpath; if (p == NULL) c = 0; else @@ -173,7 +173,7 @@ void do_cd_command (char * orig_cmd) sync_tree (home_dir); } else if (strcmp (cmd+3, "..") == 0){ char *dir = current_panel->cwd; - int len = strlen (dir); + len = strlen (dir); while (len && dir [--len] != PATH_SEP); dir [len] = 0; if (len) @@ -201,9 +201,9 @@ void do_cd_command (char * orig_cmd) /* Handle Enter on the command line */ static cb_ret_t -enter (WInput *cmdline) +enter (WInput *lc_cmdline) { - char *cmd = cmdline->buffer; + char *cmd = lc_cmdline->buffer; if (!command_prompt) return MSG_HANDLED; @@ -217,7 +217,7 @@ enter (WInput *cmdline) if (strncmp (cmd, "cd ", 3) == 0 || strcmp (cmd, "cd") == 0) { do_cd_command (cmd); - new_input (cmdline); + new_input (lc_cmdline); return MSG_HANDLED; } else { char *command, *s; @@ -261,7 +261,7 @@ enter (WInput *cmdline) } command[j] = 0; } - new_input (cmdline); + new_input (lc_cmdline); shell_execute (command, 0); g_free (command); diff --git a/src/complete.c b/src/complete.c index f5d780896..15ac7ed1a 100644 --- a/src/complete.c +++ b/src/complete.c @@ -811,14 +811,14 @@ try_complete (char *text, int *start, int *end, INPUT_COMPLETE_FLAGS flags) SHOW_C_CTX("try_complete:filename_subst_1"); matches = completion_matches (word, filename_completion_function, flags); 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)); if (!strncmp (p, "cd", 2)) for (p += 2; *p && p < q && (*p == ' ' || *p == '\t'); str_next_char (&p)); if (p == q){ char * const cdpath_ref = g_strdup (getenv ("CDPATH")); char *cdpath = cdpath_ref; - char c, *s, *r; + char c, *s; if (cdpath == NULL) c = 0; @@ -1054,8 +1054,8 @@ complete_engine (WInput *in, int what_to_do) if (in->completions){ if (what_to_do & DO_INSERTION || ((what_to_do & DO_QUERY) && !in->completions[1])) { - char * complete = in->completions [0]; - if (insert_text (in, complete, strlen (complete))){ + char * lc_complete = in->completions [0]; + if (insert_text (in, lc_complete, strlen (lc_complete))){ if (in->completions [1]) tty_beep (); else diff --git a/src/cons.saver.c b/src/cons.saver.c index 68ff8c95f..348285a3f 100644 --- a/src/cons.saver.c +++ b/src/cons.saver.c @@ -70,16 +70,16 @@ static void send_contents (char *buffer, unsigned int columns, unsigned int rows) { 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 short bytes; - index = 2 * rows * columns; + lc_index = 2 * rows * columns; for (lastline = rows; lastline > 0; lastline--) for (x = 0; x < columns; x++) { - index -= 2; - if (buffer [index] != ' ') + lc_index -= 2; + if (buffer [lc_index] != ' ') goto out; } out: @@ -94,20 +94,20 @@ out: if (end_line > lastline) end_line = lastline; - index = (end_line - begin_line) * columns; - bytes = index; - if (index != bytes) + lc_index = (end_line - begin_line) * columns; + bytes = lc_index; + if (lc_index != bytes) bytes = 0; write (1, &bytes, 2); if (! bytes) return; p = outbuf; - for (index = 2 * begin_line * columns; - index < 2 * end_line * columns; - index += 2) + for (lc_index = 2 * begin_line * columns; + lc_index < 2 * end_line * columns; + lc_index += 2) { - *p++ = buffer [index]; + *p++ = buffer [lc_index]; if (p == outbuf + sizeof (outbuf)) { write (1, outbuf, sizeof (outbuf)); diff --git a/src/dir.c b/src/dir.c index b4b448fa4..40980f8fd 100644 --- a/src/dir.c +++ b/src/dir.c @@ -257,10 +257,10 @@ clean_dir (dir_list *list, int count) } 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? */ - if (index == list->size) { + if (lc_index == list->size) { list->list = g_realloc (list->list, sizeof (file_entry) * (list->size + RESIZE_STEPS)); if (!list->list) @@ -268,14 +268,14 @@ add_dotdot_to_list (dir_list *list, int index) list->size += RESIZE_STEPS; } - memset (&(list->list) [index], 0, sizeof(file_entry)); - (list->list) [index].fnamelen = 2; - (list->list) [index].fname = g_strdup (".."); - (list->list) [index].f.link_to_dir = 0; - (list->list) [index].f.stale_link = 0; - (list->list) [index].f.dir_size_computed = 0; - (list->list) [index].f.marked = 0; - (list->list) [index].st.st_mode = 040755; + memset (&(list->list) [lc_index], 0, sizeof(file_entry)); + (list->list) [lc_index].fnamelen = 2; + (list->list) [lc_index].fname = g_strdup (".."); + (list->list) [lc_index].f.link_to_dir = 0; + (list->list) [lc_index].f.stale_link = 0; + (list->list) [lc_index].f.dir_size_computed = 0; + (list->list) [lc_index].f.marked = 0; + (list->list) [lc_index].st.st_mode = 040755; return 1; } @@ -382,8 +382,8 @@ handle_path (dir_list *list, const char *path, } int -do_load_dir (const char *path, dir_list *list, sortfn *sort, int reverse, - int case_sensitive, int exec_ff, const char *filter) +do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse, + int lc_case_sensitive, int exec_ff, const char *filter) { DIR *dirp; struct dirent *dp; @@ -431,7 +431,7 @@ do_load_dir (const char *path, dir_list *list, sortfn *sort, int reverse, } 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); @@ -490,7 +490,7 @@ alloc_dir_copy (int size) /* If filter is null, then it is a match */ int 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; struct dirent *dp; @@ -591,7 +591,7 @@ do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count, tree_store_end_check (); g_hash_table_destroy (marked_files); 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); return next_free; diff --git a/src/execute.c b/src/execute.c index 2dc41116e..b59109b01 100644 --- a/src/execute.c +++ b/src/execute.c @@ -112,7 +112,7 @@ do_possible_cd (const char *new_dir) #endif /* HAVE_SUBSHELL_SUPPORT */ 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 char *new_dir = NULL; @@ -146,7 +146,7 @@ do_execute (const char *shell, const char *command, int flags) #endif /* !USE_VFS */ } else #endif /* HAVE_SUBSHELL_SUPPORT */ - my_system (flags, shell, command); + my_system (flags, lc_shell, command); if (!(flags & EXECUTE_INTERNAL)) { if ((pause_after_run == pause_always diff --git a/src/ext.c b/src/ext.c index 9c46ad9f6..779e5a280 100644 --- a/src/ext.c +++ b/src/ext.c @@ -64,7 +64,7 @@ flush_extension_file (void) typedef char *(*quote_func_t) (const char *name, int quote_percent); 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) { char *fn; @@ -74,7 +74,7 @@ exec_extension (const char *filename, const char *data, int *move_dir, char *cmd = NULL; int expand_prefix_found = 0; int parameter_found = 0; - char prompt[80]; + char lc_prompt[80]; int run_view = 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; @@ -89,7 +89,7 @@ exec_extension (const char *filename, const char *data, int *move_dir, quote_func_t quote_func = name_quote; 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 */ 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"); fputs ("#! /bin/sh\n", cmd_file); - prompt[0] = 0; - for (; *data && *data != '\n'; data++) { + lc_prompt[0] = 0; + for (; *lc_data && *lc_data != '\n'; lc_data++) { if (parameter_found) { - if (*data == '}') { + if (*lc_data == '}') { char *parameter; parameter_found = 0; - parameter = input_dialog (_(" Parameter "), prompt, MC_HISTORY_EXT_PARAMETER, ""); + parameter = input_dialog (_(" Parameter "), lc_prompt, MC_HISTORY_EXT_PARAMETER, ""); if (!parameter) { /* User canceled */ fclose (cmd_file); @@ -136,38 +136,38 @@ exec_extension (const char *filename, const char *data, int *move_dir, written_nonspace = 1; g_free (parameter); } else { - size_t len = strlen (prompt); + size_t len = strlen (lc_prompt); - if (len < sizeof (prompt) - 1) { - prompt[len] = *data; - prompt[len + 1] = 0; + if (len < sizeof (lc_prompt) - 1) { + lc_prompt[len] = *lc_data; + lc_prompt[len + 1] = 0; } } } else if (expand_prefix_found) { expand_prefix_found = 0; - if (*data == '{') + if (*lc_data == '{') parameter_found = 1; else { - int i = check_format_view (data); + int i = check_format_view (lc_data); char *v; if (i) { - data += i - 1; + lc_data += i - 1; run_view = 1; - } else if ((i = check_format_cd (data)) > 0) { + } else if ((i = check_format_cd (lc_data)) > 0) { is_cd = 1; quote_func = fake_name_quote; do_local_copy = 0; p = buffer; - data += i - 1; - } else if ((i = check_format_var (data, &v)) > 0 && v) { + lc_data += i - 1; + } else if ((i = check_format_var (lc_data, &v)) > 0 && v) { fputs (v, cmd_file); g_free (v); - data += i; + lc_data += i; } else { char *text; - if (*data == 'f') { + if (*lc_data == 'f') { if (do_local_copy) { localcopy = mc_getlocalcopy (filename); if (localcopy == NULL) { @@ -185,7 +185,7 @@ exec_extension (const char *filename, const char *data, int *move_dir, g_free (fn); } } else { - text = expand_format (NULL, *data, !is_cd); + text = expand_format (NULL, *lc_data, !is_cd); } if (!is_cd) fputs (text, cmd_file); @@ -198,15 +198,15 @@ exec_extension (const char *filename, const char *data, int *move_dir, } } } else { - if (*data == '%') + if (*lc_data == '%') expand_prefix_found = 1; else { - if (*data != ' ' && *data != '\t') + if (*lc_data != ' ' && *lc_data != '\t') written_nonspace = 1; if (is_cd) - *(p++) = *data; + *(p++) = *lc_data; else - fputc (*data, cmd_file); + fputc (*lc_data, cmd_file); } } } /* for */ diff --git a/src/file.c b/src/file.c index b9649f483..7e1f61ebe 100644 --- a/src/file.c +++ b/src/file.c @@ -175,15 +175,15 @@ transform_source (FileOpContext *ctx, const char *source) } static void -free_linklist (struct link **linklist) +free_linklist (struct link **lc_linklist) { struct link *lp, *lp2; - for (lp = *linklist; lp != NULL; lp = lp2) { + for (lp = *lc_linklist; lp != NULL; lp = lp2) { lp2 = lp->next; g_free (lp); } - *linklist = NULL; + *lc_linklist = NULL; } static int @@ -1788,8 +1788,11 @@ panel_operate_generate_prompt (const WPanel *panel, const int operation, } #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; + + (void) mode; ctx->pid = 0; unregister_task_with_pid(pid); diff --git a/src/filegui.c b/src/filegui.c index 6c2a3b229..73f9a3393 100644 --- a/src/filegui.c +++ b/src/filegui.c @@ -1034,11 +1034,11 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, ctx->umask_kill = 0777777; ctx->preserve_uidgid = (geteuid () == 0) ? 1 : 0; } else { - int i; + int i2; ctx->preserve = ctx->preserve_uidgid = 0; - i = umask (0); - umask (i); - ctx->umask_kill = i ^ 0777777; + i2 = umask (0); + umask (i2); + ctx->umask_kill = i2 ^ 0777777; } if (!dest_dir || !*dest_dir) { diff --git a/src/find.c b/src/find.c index 6f51676f5..c187f41e9 100644 --- a/src/find.c +++ b/src/find.c @@ -200,7 +200,7 @@ get_list_info (char **file, char **dir) } /* check regular expression */ -gboolean +static gboolean find_check_regexp (const char *r) { 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; entry = entry->next, i++) { - const char *filename = NULL; + const char *lc_filename = NULL; if (!entry->text || !entry->data) continue; if (content_pattern != NULL) - filename = strchr (entry->text + 4, ':') + 1; + lc_filename = strchr (entry->text + 4, ':') + 1; else - filename = entry->text + 4; + lc_filename = entry->text + 4; - name = make_fullname (entry->data, filename); + name = make_fullname (entry->data, lc_filename); status = handle_path (list, name, &st, next_free, &link_to_dir, &stale_link); diff --git a/src/help.c b/src/help.c index 326cbbf53..b4ff2784c 100644 --- a/src/help.c +++ b/src/help.c @@ -243,16 +243,16 @@ static void move_to_bottom (void) 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]; const char *p; int i = 0; - if (!selected_item) + if (!lc_selected_item) 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){ link_name [0] = '['; diff --git a/src/hotlist.c b/src/hotlist.c index 122327d0c..26ebfbd22 100644 --- a/src/hotlist.c +++ b/src/hotlist.c @@ -1038,16 +1038,16 @@ static void add_new_group_cmd (void) void add2hotlist_cmd (void) { - char *prompt, *label; + char *lc_prompt, *label; const char *cp = _("Label for \"%s\":"); int l = str_term_width1 (cp); char *label_string = g_strdup (current_panel->cwd); strip_password (label_string, 1); - 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); - g_free (prompt); + lc_prompt = g_strdup_printf (cp, path_trunc (current_panel->cwd, COLS-2*UX-(l+8))); + label = input_dialog (_(" Add to hotlist "), lc_prompt, MC_HISTORY_HOTLIST_ADD, label_string); + g_free (lc_prompt); if (!label || !*label) { g_free (label_string); diff --git a/src/keybind.c b/src/keybind.c index 5edfdc3f9..c898e8c06 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -782,7 +782,7 @@ lookup_action (const char *keyname) return 0; } -void +static void keymap_add (GArray *keymap, int key, int cmd, const char *caption) { if (key != 0 && cmd != 0) { diff --git a/src/layout.c b/src/layout.c index a770c9913..60b7c5fd8 100644 --- a/src/layout.c +++ b/src/layout.c @@ -607,12 +607,12 @@ mc_refresh (void) } static void -panel_do_cols (int index) +panel_do_cols (int lc_index) { - if (get_display_type (index) == view_listing) - set_panel_formats ((WPanel *) panels [index].widget); + if (get_display_type (lc_index) == view_listing) + set_panel_formats ((WPanel *) panels [lc_index].widget); 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 * -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) @@ -1125,30 +1125,30 @@ int get_other_type (void) /* Save current list_view widget directory into panel */ void -save_panel_dir (int index) +save_panel_dir (int lc_index) { - int type = get_display_type (index); - Widget *widget = get_panel_widget (index); + int type = get_display_type (lc_index); + Widget *widget = get_panel_widget (lc_index); if ((type == view_listing) && (widget != NULL)) { WPanel *w = (WPanel *) widget; 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 */ - 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 */ 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; - 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 && - get_display_type(index) != view_listing); - const char *p_name = get_nth_panel_name (index); + get_display_type(lc_index) != view_listing); + const char *p_name = get_nth_panel_name (lc_index); if (last_was_panel) new_widget = (Widget *) panel_new_with_dir (p_name, saved_dir); diff --git a/src/listmode.c b/src/listmode.c index bf1620f71..02de81308 100644 --- a/src/listmode.c +++ b/src/listmode.c @@ -300,12 +300,4 @@ listmode_edit (char *oldlistformat) listmode_done (listmode_dlg); return newformat; } -#else -void listmode__unused(void) -{ -/* - CFLAGS="-ansi -pedantic -Wall -Wextra -Werror" -*/ -} - #endif /* LISTMODE_EDITOR */ diff --git a/src/man2hlp.c b/src/man2hlp.c index 928e07ab2..aa95df6cc 100644 --- a/src/man2hlp.c +++ b/src/man2hlp.c @@ -187,7 +187,7 @@ static int string_len (const char *buffer) { 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 c; /* Current character */ int len = 0; /* Result: the length of the string */ @@ -195,9 +195,9 @@ string_len (const char *buffer) while (*(buffer)) { c = *buffer++; 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) - link_flag = 0; /* Link target name ends */ + lc_link_flag = 0; /* Link target name ends */ else if (c == CHAR_NODE_END) { /* Node anchor name starts */ anchor_flag = 1; @@ -214,7 +214,7 @@ string_len (const char *buffer) } backslash_flag = 0; /* Increase length if not inside anchor name or link target name */ - if (!anchor_flag && !link_flag) + if (!anchor_flag && !lc_link_flag) len++; if (anchor_flag && c == ']') { /* Node anchor name ends */ @@ -671,7 +671,7 @@ main (int argc, char **argv) FILE *f_man; /* Manual file */ FILE *f_tmpl; /* Template file */ char buffer[BUFFER_SIZE]; /* Full input line */ - char *node = NULL; + char *lc_node = NULL; char *outfile_buffer; /* Large buffer to keep the output file */ long cont_start; /* Start of [Contents] */ long file_end; /* Length of the output file */ @@ -754,21 +754,21 @@ main (int argc, char **argv) /* Repeat for each input line */ /* Read a line */ while (fgets (buffer, BUFFER_SIZE, f_tmpl)) { - if (node) { + if (lc_node) { if (*buffer && *buffer != '\n') { cnode->lname = strdup (buffer); - node = strchr (cnode->lname, '\n'); - if (node) - *node = 0; + lc_node = strchr (cnode->lname, '\n'); + if (lc_node) + *lc_node = 0; } - node = NULL; + lc_node = NULL; } else { - node = strchr (buffer, CHAR_NODE_END); - if (node && (node[1] == '[')) { - char *p = strchr (node, ']'); + lc_node = strchr (buffer, CHAR_NODE_END); + if (lc_node && (lc_node[1] == '[')) { + char *p = strchr (lc_node, ']'); if (p) { - if (strncmp (node + 1, "[main]", 6) == 0) { - node = NULL; + if (strncmp (lc_node + 1, "[main]", 6) == 0) { + lc_node = NULL; } else { if (!cnode) { cnode = &nodes; @@ -776,16 +776,16 @@ main (int argc, char **argv) cnode->next = malloc (sizeof (nodes)); cnode = cnode->next; } - cnode->node = strdup (node + 2); - cnode->node[p - node - 2] = 0; + cnode->node = strdup (lc_node + 2); + cnode->node[p - lc_node - 2] = 0; cnode->lname = NULL; cnode->next = NULL; cnode->heading_level = 0; } } else - node = NULL; + lc_node = NULL; } else - node = NULL; + lc_node = NULL; } fputs (buffer, f_out); } @@ -829,12 +829,12 @@ main (int argc, char **argv) } for (cnode = &nodes; cnode && cnode->node;) { - char *node = cnode->node; 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, - "", cnode->lname ? cnode->lname : node, node); + "", cnode->lname ? cnode->lname : lc_node, lc_node); fprintf (f_out, "\n"); free (cnode->node); diff --git a/src/screen.c b/src/screen.c index 6c8306a1e..2a75d71ac 100644 --- a/src/screen.c +++ b/src/screen.c @@ -770,12 +770,12 @@ display_mini_info (WPanel *panel) set_colors (panel); 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; - link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname); - len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1); - g_free (link); + lc_link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname); + len = mc_readlink (lc_link, link_target, MC_MAXPATHLEN - 1); + g_free (lc_link); if (len > 0){ link_target[len] = 0; tty_print_string ("-> "); @@ -2470,13 +2470,13 @@ static gsize panel_get_format_field_count(WPanel *panel) { format_e *format; - gsize index; + gsize lc_index; for ( - index=0, format = panel->format; + lc_index=0, format = panel->format; 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) { format_e *format; - gsize index; + gsize lc_index; for ( - index=1, format = panel->format; + lc_index=1, format = panel->format; ! ( format == NULL || strcmp(format->title, name) == 0 ); - format = format->next, index++ + format = format->next, lc_index++ ); if (format == NULL) - index = 0; + lc_index = 0; - return index; + return lc_index; } -format_e * -panel_get_format_field_by_index(WPanel *panel, gsize index) +static format_e * +panel_get_format_field_by_index(WPanel *panel, gsize lc_index) { format_e *format; for ( format = panel->format; - ! ( format == NULL || index == 0 ); - format = format->next, index-- + ! ( format == NULL || lc_index == 0 ); + format = format->next, lc_index-- ); return format; } 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; 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) return NULL; pfield = panel_get_field_by_title(format->title); @@ -2531,19 +2531,19 @@ panel_get_sortable_field_by_format(WPanel *panel, gsize index) static void panel_toggle_sort_order_prev(WPanel *panel) { - gsize index, i; + gsize lc_index, i; gchar *title; const panel_field_t *pfield = NULL; 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); - if (index > 1){ + if (lc_index > 1){ /* search for prev sortable column in panel format */ for ( - i = index-1 ; + i = lc_index-1 ; i != 0 && (pfield = panel_get_sortable_field_by_format(panel, i-1)) == NULL ; i-- ); @@ -2567,19 +2567,19 @@ panel_toggle_sort_order_prev(WPanel *panel) static void panel_toggle_sort_order_next(WPanel *panel) { - gsize index, i; + gsize lc_index, i; const panel_field_t *pfield = NULL; gsize format_field_count = panel_get_format_field_count(panel); gchar *title; 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); - if (index != 0 && index != format_field_count){ + if (lc_index != 0 && lc_index != format_field_count){ /* search for prev sortable column in panel format */ for ( - i = index; + i = lc_index; i != format_field_count && (pfield = panel_get_sortable_field_by_format(panel, i)) == NULL ; i++ ); @@ -2885,10 +2885,10 @@ panel_callback (Widget *w, widget_msg_t msg, int parm) } 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) { - panel->dir.list[index].f.marked = val; + if (panel->dir.list[lc_index].f.marked != val) { + panel->dir.list[lc_index].f.marked = val; panel->dirty = 1; } } @@ -2935,7 +2935,7 @@ static void mouse_sort_col(Gpm_Event *event, WPanel *panel) { int i; - const char *sort_name = NULL; + const char *lc_sort_name = NULL; panel_field_t *col_sort_format = NULL; format_e *format; gchar *title; @@ -2944,17 +2944,17 @@ mouse_sort_col(Gpm_Event *event, WPanel *panel) i += format->field_len; if (event->x < i + 1) { /* found column */ - sort_name = format->title; + lc_sort_name = format->title; break; } } - if (sort_name == NULL) + if (lc_sort_name == NULL) return; for(i = 0; panel_fields[i].id != NULL; i++) { 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]; g_free(title); break; @@ -3309,10 +3309,10 @@ update_panels (int force_update, const char *current_file) gsize 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 ++) - if (panel_fields[index].is_user_choice) + for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++) + if (panel_fields[lc_index].is_user_choice) ret++; return ret; } @@ -3322,65 +3322,65 @@ const char ** panel_get_sortable_fields(gsize *array_size) { 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) return 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 ++) 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; } const panel_field_t * panel_get_field_by_id(const char *name) { - gsize index; - for(index=0; panel_fields[index].id != NULL; index ++) + gsize lc_index; + for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++) if ( - panel_fields[index].id != NULL && - strcmp(name, panel_fields[index].id) == 0 + panel_fields[lc_index].id != NULL && + strcmp(name, panel_fields[lc_index].id) == 0 ) - return &panel_fields[index]; + return &panel_fields[lc_index]; return NULL; } const panel_field_t * panel_get_field_by_title_hotkey(const char *name) { - gsize index; - for(index=0; panel_fields[index].id != NULL; index ++) + gsize lc_index; + for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++) if ( - panel_fields[index].title_hotkey != NULL && - strcmp(name, _(panel_fields[index].title_hotkey)) == 0 + panel_fields[lc_index].title_hotkey != NULL && + strcmp(name, _(panel_fields[lc_index].title_hotkey)) == 0 ) - return &panel_fields[index]; + return &panel_fields[lc_index]; return NULL; } const panel_field_t * panel_get_field_by_title(const char *name) { - gsize index; + gsize lc_index; gchar *title = NULL; - for(index=0; panel_fields[index].id != NULL; index ++) { - title = panel_get_title_without_hotkey(panel_fields[index].title_hotkey); + for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++) { + title = panel_get_title_without_hotkey(panel_fields[lc_index].title_hotkey); if ( - panel_fields[index].title_hotkey != NULL && + panel_fields[lc_index].title_hotkey != NULL && strcmp(name, title) == 0 ) { g_free(title); - return &panel_fields[index]; + return &panel_fields[lc_index]; } } g_free(title); @@ -3390,10 +3390,10 @@ panel_get_field_by_title(const char *name) gsize 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 ++) - if (panel_fields[index].use_in_user_format) + for(lc_index=0; panel_fields[lc_index].id != NULL; lc_index ++) + if (panel_fields[lc_index].use_in_user_format) ret++; return ret; } @@ -3402,22 +3402,22 @@ const char ** panel_get_user_possible_fields(gsize *array_size) { 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) return 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 ++) 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; } diff --git a/src/search/glob.c b/src/search/glob.c index 08caab4dd..18ed32226 100644 --- a/src/search/glob.c +++ b/src/search/glob.c @@ -140,7 +140,7 @@ mc_search__translate_replace_glob_to_regex (gchar *str) /*** public functions ****************************************************************************/ 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) { 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); - if (mc_search->is_entire_line) { + if (lc_mc_search->is_entire_line) { g_string_prepend_c (tmp, '^'); g_string_append_c (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 -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) { - 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 * -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 *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); return res; } diff --git a/src/search/hex.c b/src/search/hex.c index b7eeebf43..7675d0be1 100644 --- a/src/search/hex.c +++ b/src/search/hex.c @@ -92,7 +92,7 @@ mc_search__hex_translate_to_regex (gchar * str, gsize * len) /*** public functions ****************************************************************************/ 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) { 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); 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 -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) { - 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 * -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); } diff --git a/src/search/lib.c b/src/search/lib.c index b9c21a27d..ffb89d0ad 100644 --- a/src/search/lib.c +++ b/src/search/lib.c @@ -123,11 +123,11 @@ mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len, /* --------------------------------------------------------------------------------------------- */ 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; - if (mc_search->search_fn) - return (mc_search->search_fn) (user_data, current_pos); + if (lc_mc_search->search_fn) + return (lc_mc_search->search_fn) (user_data, current_pos); data = (char *) user_data; return (int) (unsigned char) data[current_pos]; @@ -245,7 +245,7 @@ gchar ** mc_search_get_types_strings_array (size_t *num) { gchar **ret; - int index; + int lc_index; size_t n; const mc_search_type_str_t *type_str; @@ -255,14 +255,14 @@ mc_search_get_types_strings_array (size_t *num) if (ret == NULL) return NULL; - for (index = 0, type_str = types_str; + for (lc_index = 0, type_str = types_str; type_str->str != NULL; - type_str++, index++) - ret[index] = g_strdup (type_str->str); + type_str++, lc_index++) + ret[lc_index] = g_strdup (type_str->str); /* don't count last NULL item */ if (num != NULL) - *num = (size_t) index; + *num = (size_t) lc_index; return ret; } diff --git a/src/search/normal.c b/src/search/normal.c index a19dfa4ee..fb31f7159 100644 --- a/src/search/normal.c +++ b/src/search/normal.c @@ -85,36 +85,36 @@ mc_search__normal_translate_to_regex (gchar * str, gsize * len) /*** public functions ****************************************************************************/ 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) { GString *tmp = mc_search__normal_translate_to_regex (mc_search_cond->str->str, &mc_search_cond->len); 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_append (tmp, "\\b"); } 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 -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) { - 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 * -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); } diff --git a/src/search/regex.c b/src/search/regex.c index 91613e028..8c5d5d7ca 100644 --- a/src/search/regex.c +++ b/src/search/regex.c @@ -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 -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) { #ifdef SEARCH_TYPE_GLIB GError *error = NULL; 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)) { - g_match_info_free (mc_search->regex_match_info); - mc_search->regex_match_info = NULL; + g_match_info_free (lc_mc_search->regex_match_info); + lc_mc_search->regex_match_info = NULL; if (error) { - mc_search->error = MC_SEARCH_E_REGEX; - mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error ")); + lc_mc_search->error = MC_SEARCH_E_REGEX; + lc_mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error ")); g_error_free (error); return COND__FOUND_ERROR; } 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 */ - mc_search->num_rezults = pcre_exec (regex, mc_search->regex_match_info, - search_str->str, search_str->len - 1, 0, 0, mc_search->iovector, + lc_mc_search->num_rezults = pcre_exec (regex, lc_mc_search->regex_match_info, + search_str->str, search_str->len - 1, 0, 0, lc_mc_search->iovector, MC_SEARCH__NUM_REPLACE_ARGS); - if (mc_search->num_rezults < 0) { + if (lc_mc_search->num_rezults < 0) { return COND__NOT_FOUND; } #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 -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; mc_search_cond_t *mc_search_cond; mc_search__found_cond_t ret; - for (loop1 = 0; loop1 < mc_search->conditions->len; loop1++) { - mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (mc_search->conditions, loop1); + for (loop1 = 0; loop1 < lc_mc_search->conditions->len; loop1++) { + mc_search_cond = (mc_search_cond_t *) g_ptr_array_index (lc_mc_search->conditions, loop1); if (!mc_search_cond->regex_handle) 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) return ret; @@ -325,21 +325,21 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len) /* --------------------------------------------------------------------------------------------- */ 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; #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 */ - fnd_start = mc_search->iovector[index * 2 + 0]; - fnd_end = mc_search->iovector[index * 2 + 1]; + fnd_start = lc_mc_search->iovector[lc_index * 2 + 0]; + fnd_end = lc_mc_search->iovector[lc_index * 2 + 1]; #endif /* SEARCH_TYPE_GLIB */ if (fnd_end - fnd_start == 0) 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 ****************************************************************************/ 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) { GString *tmp = NULL; @@ -483,7 +483,7 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea int erroffset; #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); 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); @@ -495,8 +495,8 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea &error); if (error != NULL) { - mc_search->error = MC_SEARCH_E_REGEX_COMPILE; - mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error ")); + lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE; + lc_mc_search->error_str = str_conv_gerror_message (error, _(" Regular expression error ")); g_error_free (error); 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 = pcre_compile (mc_search_cond->str->str, PCRE_EXTRA, &error, &erroffset, NULL); if (mc_search_cond->regex_handle == NULL) { - mc_search->error = MC_SEARCH_E_REGEX_COMPILE; - mc_search->error_str = g_strdup (error); + lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE; + lc_mc_search->error_str = g_strdup (error); return; } - mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error); - if (mc_search->regex_match_info == NULL) { + lc_mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error); + if (lc_mc_search->regex_match_info == NULL) { if (error) { - mc_search->error = MC_SEARCH_E_REGEX_COMPILE; - mc_search->error_str = g_strdup (error); + lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE; + lc_mc_search->error_str = g_strdup (error); g_free (mc_search_cond->regex_handle); mc_search_cond->regex_handle = NULL; return; @@ -524,7 +524,7 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * mc_sea /* --------------------------------------------------------------------------------------------- */ 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 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 end_pos; - if (mc_search->regex_buffer != NULL) - g_string_free (mc_search->regex_buffer, TRUE); + if (lc_mc_search->regex_buffer != NULL) + 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; while (virtual_pos <= end_search) { - g_string_set_size (mc_search->regex_buffer, 0); - mc_search->start_buffer = current_pos; + g_string_set_size (lc_mc_search->regex_buffer, 0); + lc_mc_search->start_buffer = current_pos; 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) break; @@ -554,7 +554,7 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data, 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') @@ -564,54 +564,54 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data, 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: #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 */ - start_pos = mc_search->iovector[0]; - end_pos = mc_search->iovector[1]; + start_pos = lc_mc_search->iovector[0]; + end_pos = lc_mc_search->iovector[1]; #endif /* SEARCH_TYPE_GLIB */ if (found_len) *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; break; case COND__NOT_ALL_FOUND: break; default: - g_string_free (mc_search->regex_buffer, TRUE); - mc_search->regex_buffer = NULL; + g_string_free (lc_mc_search->regex_buffer, TRUE); + lc_mc_search->regex_buffer = NULL; return FALSE; break; } - if (mc_search->update_fn != NULL) { - if ((mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_SKIP) { - g_string_free (mc_search->regex_buffer, TRUE); - mc_search->regex_buffer = NULL; - mc_search->error = MC_SEARCH_E_NOTFOUND; - mc_search->error_str = NULL; + if (lc_mc_search->update_fn != NULL) { + if ((lc_mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_SKIP) { + g_string_free (lc_mc_search->regex_buffer, TRUE); + lc_mc_search->regex_buffer = NULL; + lc_mc_search->error = MC_SEARCH_E_NOTFOUND; + lc_mc_search->error_str = NULL; return FALSE; } } if (current_chr == MC_SEARCH_CB_ABORT) break; } - g_string_free (mc_search->regex_buffer, TRUE); - mc_search->regex_buffer = NULL; - mc_search->error = MC_SEARCH_E_NOTFOUND; - mc_search->error_str = g_strdup (_(STR_E_NOTFOUND)); + g_string_free (lc_mc_search->regex_buffer, TRUE); + lc_mc_search->regex_buffer = NULL; + lc_mc_search->error = MC_SEARCH_E_NOTFOUND; + lc_mc_search->error_str = g_strdup (_(STR_E_NOTFOUND)); return FALSE; } /* --------------------------------------------------------------------------------------------- */ 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; gchar *tmp_str; - int num_replace_tokens, index; + int num_replace_tokens, lc_index; gsize loop; gsize len = 0; gchar *prev_str; @@ -620,22 +620,22 @@ mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_ num_replace_tokens = 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); - 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) { - 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 = MC_SEARCH_E_REGEX_REPLACE; + lc_mc_search->error_str = g_strdup (STR_E_RPL_NOT_EQ_TO_FOUND); return NULL; } ret = g_string_new (""); prev_str = replace_str->str; 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) { mc_search_regex__process_append_str (ret, prev_str, replace_str->str - prev_str + loop, @@ -648,7 +648,7 @@ mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_ continue; } - if (index == -2) { + if (lc_index == -2) { if (loop) mc_search_regex__process_append_str (ret, prev_str, replace_str->str - prev_str + loop, @@ -658,14 +658,14 @@ mc_search_regex_prepare_replace_str (mc_search_t * mc_search, GString * replace_ continue; } - if (index > mc_search->num_rezults) { + if (lc_index > lc_mc_search->num_rezults) { g_string_free (ret, TRUE); - 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 = MC_SEARCH_E_REGEX_REPLACE; + lc_mc_search->error_str = g_strdup_printf (STR_E_RPL_INVALID_TOKEN, lc_index); 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) continue; diff --git a/src/search/search.c b/src/search/search.c index 1e9df0681..fbfc5af94 100644 --- a/src/search/search.c +++ b/src/search/search.c @@ -55,7 +55,7 @@ static const mc_search_type_str_t mc_search__list_types[] = { /*** file scope functions ************************************************************************/ 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) { 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->charset = g_strdup (charset); - switch (mc_search->search_type) { + switch (lc_mc_search->search_type) { 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; 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; 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; 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; default: break; @@ -114,11 +114,11 @@ static void mc_search__conditions_free (GPtrArray * array) { gsize loop1; - mc_search_cond_t *mc_search; + mc_search_cond_t *lc_mc_search; for (loop1 = 0; loop1 < array->len; loop1++) { - mc_search = (mc_search_cond_t *) g_ptr_array_index (array, loop1); - mc_search__cond_struct_free (mc_search); + lc_mc_search = (mc_search_cond_t *) g_ptr_array_index (array, loop1); + mc_search__cond_struct_free (lc_mc_search); } g_ptr_array_free (array, TRUE); } @@ -132,7 +132,7 @@ mc_search__conditions_free (GPtrArray * array) mc_search_t * mc_search_new (const gchar * original, gsize str_len) { - mc_search_t *mc_search; + mc_search_t *lc_mc_search; if (!original) return NULL; @@ -142,128 +142,128 @@ mc_search_new (const gchar * original, gsize str_len) return NULL; } - mc_search = g_malloc0 (sizeof (mc_search_t)); - mc_search->original = g_strndup (original, str_len); - mc_search->original_len = str_len; - return mc_search; + lc_mc_search = g_malloc0 (sizeof (mc_search_t)); + lc_mc_search->original = g_strndup (original, str_len); + lc_mc_search->original_len = str_len; + return lc_mc_search; } /* --------------------------------------------------------------------------------------------- */ 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; - g_free (mc_search->original); - g_free (mc_search->error_str); + g_free (lc_mc_search->original); + g_free (lc_mc_search->error_str); - if (mc_search->conditions) - mc_search__conditions_free (mc_search->conditions); + if (lc_mc_search->conditions) + mc_search__conditions_free (lc_mc_search->conditions); #ifdef SEARCH_TYPE_GLIB - if (mc_search->regex_match_info) - g_match_info_free (mc_search->regex_match_info); + if (lc_mc_search->regex_match_info) + g_match_info_free (lc_mc_search->regex_match_info); #else /* SEARCH_TYPE_GLIB */ - g_free (mc_search->regex_match_info); + g_free (lc_mc_search->regex_match_info); #endif /* SEARCH_TYPE_GLIB */ - if (mc_search->regex_buffer != NULL) - g_string_free (mc_search->regex_buffer, TRUE); + if (lc_mc_search->regex_buffer != NULL) + g_string_free (lc_mc_search->regex_buffer, TRUE); - g_free (mc_search); + g_free (lc_mc_search); } /* --------------------------------------------------------------------------------------------- */ gboolean -mc_search_prepare (mc_search_t * mc_search) +mc_search_prepare (mc_search_t * lc_mc_search) { GPtrArray *ret; ret = g_ptr_array_new (); #ifdef HAVE_CHARSET - if (mc_search->is_all_charsets) { + if (lc_mc_search->is_all_charsets) { gsize loop1, recoded_str_len; gchar *buffer; for (loop1 = 0; loop1 < (gsize) n_codepages; loop1++) { if (!g_ascii_strcasecmp (codepages[loop1].id, cp_source)) { g_ptr_array_add (ret, - mc_search__cond_struct_new (mc_search, mc_search->original, - mc_search->original_len, cp_source)); + mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original, + lc_mc_search->original_len, cp_source)); continue; } 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); if (buffer == NULL) continue; 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)); g_free (buffer); } } else { g_ptr_array_add (ret, - (gpointer) mc_search__cond_struct_new (mc_search, mc_search->original, - mc_search->original_len, + (gpointer) mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original, + lc_mc_search->original_len, cp_source)); } #else g_ptr_array_add (ret, - (gpointer) mc_search__cond_struct_new (mc_search, mc_search->original, - mc_search->original_len, + (gpointer) mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original, + lc_mc_search->original_len, str_detect_termencoding ())); #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 -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) { gboolean ret = FALSE; - if (!mc_search) + if (!lc_mc_search) return FALSE; - if (!mc_search_is_type_avail (mc_search->search_type)) { - mc_search->error = MC_SEARCH_E_INPUT; - mc_search->error_str = g_strdup (_(STR_E_UNKNOWN_TYPE)); + if (!mc_search_is_type_avail (lc_mc_search->search_type)) { + lc_mc_search->error = MC_SEARCH_E_INPUT; + lc_mc_search->error_str = g_strdup (_(STR_E_UNKNOWN_TYPE)); return FALSE; } #ifdef SEARCH_TYPE_GLIB - if (mc_search->regex_match_info) { - g_match_info_free (mc_search->regex_match_info); - mc_search->regex_match_info = NULL; + if (lc_mc_search->regex_match_info) { + g_match_info_free (lc_mc_search->regex_match_info); + lc_mc_search->regex_match_info = NULL; } #endif /* SEARCH_TYPE_GLIB */ - mc_search->error = MC_SEARCH_E_OK; - g_free (mc_search->error_str); - mc_search->error_str = NULL; + lc_mc_search->error = MC_SEARCH_E_OK; + g_free (lc_mc_search->error_str); + 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; - switch (mc_search->search_type) { + switch (lc_mc_search->search_type) { 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; 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; 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; 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; default: break; @@ -304,28 +304,28 @@ mc_search_types_list_get (size_t *num) /* --------------------------------------------------------------------------------------------- */ 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; - if (mc_search == NULL) + if (lc_mc_search == NULL) return g_string_new_len (replace_str->str, replace_str->len); if (replace_str == NULL || replace_str->str == NULL || replace_str->len == 0) return g_string_new (""); - switch (mc_search->search_type) { + switch (lc_mc_search->search_type) { 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; 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; 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; 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; default: 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 * -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 *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); if (ret) return g_string_free (ret, FALSE); @@ -351,11 +351,11 @@ mc_search_prepare_replace_str2 (mc_search_t * mc_search, char *replace_str) /* --------------------------------------------------------------------------------------------- */ 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; - switch (mc_search->search_type) { + switch (lc_mc_search->search_type) { case MC_SEARCH_T_REGEX: case MC_SEARCH_T_GLOB: return FALSE; @@ -389,21 +389,21 @@ mc_search (const gchar * pattern, const gchar * str, mc_search_type_t type) /* --------------------------------------------------------------------------------------------- */ 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; - if (mc_search->search_type == MC_SEARCH_T_NORMAL) + if (lc_mc_search->search_type == MC_SEARCH_T_NORMAL) return 0; #ifdef SEARCH_TYPE_GLIB { gint start_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; } #else /* SEARCH_TYPE_GLIB */ - return mc_search->iovector[index * 2]; + return lc_mc_search->iovector[lc_index * 2]; #endif /* SEARCH_TYPE_GLIB */ } @@ -411,21 +411,21 @@ mc_search_getstart_rezult_by_num (mc_search_t * mc_search, int index) /* --------------------------------------------------------------------------------------------- */ 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; - if (mc_search->search_type == MC_SEARCH_T_NORMAL) + if (lc_mc_search->search_type == MC_SEARCH_T_NORMAL) return 0; #ifdef SEARCH_TYPE_GLIB { gint start_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; } #else /* SEARCH_TYPE_GLIB */ - return mc_search->iovector[index * 2 + 1]; + return lc_mc_search->iovector[lc_index * 2 + 1]; #endif /* SEARCH_TYPE_GLIB */ } diff --git a/src/setup.c b/src/setup.c index adea57c39..ef45ff57d 100644 --- a/src/setup.c +++ b/src/setup.c @@ -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; home_mc => mc_user_homedir */ - char *basename, *ret; + char *lc_basename, *ret; if (config_file_name == 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); - basename = g_path_get_basename(config_file_name); - if (basename == NULL) + lc_basename = g_path_get_basename(config_file_name); + if (lc_basename == NULL) return NULL; 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 - 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)) { - g_free(basename); + g_free(lc_basename); return ret; } g_free(ret); if (subdir) - ret = g_build_filename (mc_home, subdir, basename, NULL); + ret = g_build_filename (mc_home, subdir, lc_basename, NULL); else - ret = g_build_filename (mc_home, basename, NULL); + ret = g_build_filename (mc_home, lc_basename, NULL); if (exist_file(ret)) { - g_free(basename); + g_free(lc_basename); return ret; } g_free(ret); if (subdir) - ret = g_build_filename (mc_home_alt, subdir, basename, NULL); + ret = g_build_filename (mc_home_alt, subdir, lc_basename, NULL); else - ret = g_build_filename (mc_home_alt, basename, NULL); + ret = g_build_filename (mc_home_alt, lc_basename, NULL); if (exist_file(ret)) { - g_free(basename); + g_free(lc_basename); return ret; } g_free(ret); - g_free(basename); + g_free(lc_basename); return NULL; } diff --git a/src/skin/colors-old.c b/src/skin/colors-old.c index 8bcceebff..165bfe045 100644 --- a/src/skin/colors-old.c +++ b/src/skin/colors-old.c @@ -90,15 +90,15 @@ mc_skin_colors_old_t old_colors[] = { static gboolean mc_skin_colors_old_transform (const char *old_color, const char **group, const char **key) { - int index; + int lc_index; if (old_color != NULL) - for (index = 0; old_colors[index].old_color; index++) { - if (strcasecmp (old_color, old_colors[index].old_color) == 0) { + for (lc_index = 0; old_colors[lc_index].old_color; lc_index++) { + if (strcasecmp (old_color, old_colors[lc_index].old_color) == 0) { if (group != NULL) - *group = old_colors[index].group; + *group = old_colors[lc_index].group; if (key != NULL) - *key = old_colors[index].key; + *key = old_colors[lc_index].key; return TRUE; } } diff --git a/src/skin/common.c b/src/skin/common.c index 8cb05b4a3..6d3496f81 100644 --- a/src/skin/common.c +++ b/src/skin/common.c @@ -120,6 +120,7 @@ mc_skin_try_to_load_default (void) gboolean mc_skin_init (GError ** error) { + gboolean is_good_init = TRUE; 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_value); - gboolean is_good_init = TRUE; - if (!mc_skin_ini_file_load (&mc_skin__default)) { *error = g_error_new (MC_ERROR, 0, _("Unable to load '%s' skin.\nDefault skin has been loaded"), diff --git a/src/strutil.c b/src/strutil.c index 51d92edbb..02a9ca0cc 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -402,7 +402,7 @@ str_init_strings (const char *termenc) } void -str_uninit_strings () +str_uninit_strings (void) { g_iconv_close (str_cnv_not_convert); g_free (codeset); diff --git a/src/strutil.h b/src/strutil.h index 02ba4ef63..e379b553f 100644 --- a/src/strutil.h +++ b/src/strutil.h @@ -133,9 +133,9 @@ struct str_class { void (*release_key) (char *key, int case_sen); /*I*/ }; -struct str_class str_utf8_init (); -struct str_class str_8bit_init (); -struct str_class str_ascii_init (); +struct str_class str_utf8_init (void); +struct str_class str_8bit_init (void); +struct str_class str_ascii_init (void); /* create convertor from "from_enc" to terminal encoding * 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_* */ -void str_uninit_strings (); +void str_uninit_strings (void); /* try convert characters in ch to output using conv * ch_size is size of ch, can by (size_t)(-1) (-1 only for ASCII diff --git a/src/strutil8bit.c b/src/strutil8bit.c index 188e95e58..83f5d20d4 100644 --- a/src/strutil8bit.c +++ b/src/strutil8bit.c @@ -700,7 +700,7 @@ str_8bit_release_key (char *key, int case_sen) } struct str_class -str_8bit_init () +str_8bit_init (void) { struct str_class result; diff --git a/src/strutilascii.c b/src/strutilascii.c index 304b0e9b6..ec6af9ec7 100644 --- a/src/strutilascii.c +++ b/src/strutilascii.c @@ -677,7 +677,7 @@ str_ascii_caseprefix (const char *text, const char *prefix) struct str_class -str_ascii_init () +str_ascii_init (void) { struct str_class result; diff --git a/src/strutilutf8.c b/src/strutilutf8.c index 187b60681..99c9e7a3d 100644 --- a/src/strutilutf8.c +++ b/src/strutilutf8.c @@ -1297,7 +1297,7 @@ str_utf8_release_key (char *key, int case_sen) } struct str_class -str_utf8_init () +str_utf8_init (void) { struct str_class result; diff --git a/src/treestore.c b/src/treestore.c index 61126dc89..5db3dc1f0 100644 --- a/src/treestore.c +++ b/src/treestore.c @@ -206,7 +206,7 @@ tree_store_load_from(char *name) while (fgets(buffer, MC_MAXPATHLEN, file)) { tree_entry *e; int scanned; - char *name; + char *lc_name; /* Skip invalid records */ if ((buffer[0] != '0' && buffer[0] != '1')) @@ -217,12 +217,12 @@ tree_store_load_from(char *name) 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) { /* Clear-text decompression */ - char *s = strtok(name, " "); + char *s = strtok(lc_name, " "); if (s) { common = atoi(s); @@ -236,13 +236,13 @@ tree_store_load_from(char *name) } } } else { - if (vfs_file_is_local(name)) { - e = tree_store_add_entry(name); + if (vfs_file_is_local(lc_name)) { + e = tree_store_add_entry(lc_name); e->scanned = scanned; } - strcpy(oldname, name); + strcpy(oldname, lc_name); } - g_free(name); + g_free(lc_name); } fclose(file); } @@ -465,7 +465,6 @@ tree_store_add_entry(const char *name) if (new->sublevel > 1) { /* Let's check if the parent directory is in the tree */ char *parent = g_strdup(new->name); - int i; for (i = strlen(parent) - 1; i > 1; i--) { if (parent[i] == PATH_SEP) { diff --git a/src/tty/key.c b/src/tty/key.c index 3c44438b6..744de63be 100644 --- a/src/tty/key.c +++ b/src/tty/key.c @@ -1230,24 +1230,24 @@ check_movement_keys (int key, int page_size, void *data, move_fn backfn, } static int -lookup_keyname (const char *keyname, int *index) +lookup_keyname (const char *keyname, int *lc_index) { if (keyname[0] != '\0') { int i; if (keyname[1] == '\0') { - *index = -1; + *lc_index = -1; return (int) keyname[0]; } for (i = 0; key_name_conv_tab[i].code; i++) if (str_casecmp (key_name_conv_tab[i].name, keyname) == 0) { - *index = i; + *lc_index = i; return key_name_conv_tab[i].code; } } - *index = -1; + *lc_index = -1; return 0; } @@ -1255,10 +1255,10 @@ lookup_keyname (const char *keyname, int *index) int lookup_key (const char *keyname, char **label) { - char **keys, **p; + char **lc_keys, **p; int k = -1; int key = 0; - int index = -1; + int lc_index = -1; int use_meta = -1; int use_ctrl = -1; @@ -1268,7 +1268,7 @@ lookup_key (const char *keyname, char **label) return 0; 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); while ((p != NULL) && (*p != NULL)) { @@ -1285,7 +1285,7 @@ lookup_key (const char *keyname, char **label) use_shift = idx; else { k = key; - index = idx; + lc_index = idx; break; } } @@ -1293,7 +1293,7 @@ lookup_key (const char *keyname, char **label) p++; } - g_strfreev (keys); + g_strfreev (lc_keys); /* output */ if (k <= 0) @@ -1319,16 +1319,16 @@ lookup_key (const char *keyname, char **label) else { g_string_append (s, key_name_conv_tab[use_shift].shortcut); 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) { - if ((k >= 'A') || (index < 0) - || (key_name_conv_tab[index].shortcut == NULL)) + if ((k >= 'A') || (lc_index < 0) + || (key_name_conv_tab[lc_index].shortcut == NULL)) g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) k)); else - g_string_append (s, key_name_conv_tab[index].shortcut); - } else if ((index != -1) && (key_name_conv_tab[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 if ((lc_index != -1) && (key_name_conv_tab[lc_index].shortcut != NULL)) + g_string_append (s, key_name_conv_tab[lc_index].shortcut); else g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) key)); diff --git a/src/user.c b/src/user.c index f47036348..795035852 100644 --- a/src/user.c +++ b/src/user.c @@ -175,7 +175,7 @@ strip_ext(char *ss) } char * -expand_format (WEdit *edit_widget, char c, int quote) +expand_format (WEdit *edit_widget, char c, int lc_quote) { WPanel *panel = NULL; 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)); #endif - if (quote) + if (lc_quote) quote_func = name_quote; else quote_func = fake_name_quote; @@ -604,7 +604,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands) int expand_prefix_found = 0; char *parameter = 0; int do_quote = 0; - char prompt [80]; + char lc_prompt [80]; int col; char *file_name; int run_view = 0; @@ -642,7 +642,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands) if (*commands == '}'){ char *tmp; *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){ /* User canceled */ fclose (cmd_file); @@ -658,7 +658,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands) g_free (parameter); parameter = 0; } else { - if (parameter < &prompt [sizeof (prompt) - 1]) { + if (parameter < &lc_prompt [sizeof (lc_prompt) - 1]) { *parameter++ = *commands; } } @@ -670,7 +670,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands) commands++; } if (*commands == '{') - parameter = prompt; + parameter = lc_prompt; else{ char *text = expand_format (edit_widget, *commands, do_quote); fputs (text, cmd_file); diff --git a/src/util.c b/src/util.c index f1fa9b770..44e21d9ea 100644 --- a/src/util.c +++ b/src/util.c @@ -1243,7 +1243,7 @@ concat_dir_and_file (const char *dir, const char *file) GList * 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 @@ -1252,16 +1252,16 @@ list_append_unique (GList *list, char *text) */ list = g_list_append (list, text); list = g_list_last (list); - link = g_list_previous (list); + lc_link = g_list_previous (list); - while (link) { - newlink = g_list_previous (link); - if (!strcmp ((char *) link->data, text)) { - g_free (link->data); - tmp = g_list_remove_link (list, link); - g_list_free_1 (link); + while (lc_link) { + newlink = g_list_previous (lc_link); + if (!strcmp ((char *) lc_link->data, text)) { + g_free (lc_link->data); + tmp = g_list_remove_link (list, lc_link); + g_list_free_1 (lc_link); } - link = newlink; + lc_link = newlink; } return list; diff --git a/src/viewer/coord_cache.c b/src/viewer/coord_cache.c index 936ce4ee0..bbd0c80d9 100644 --- a/src/viewer/coord_cache.c +++ b/src/viewer/coord_cache.c @@ -67,6 +67,36 @@ /*** 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 ****************************************************************************/ /* --------------------------------------------------------------------------------------------- */ @@ -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 * ''lookup_what''. The function returns the smallest value that diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c index c4f1d1f82..f701ef474 100644 --- a/src/viewer/growbuf.c +++ b/src/viewer/growbuf.c @@ -168,10 +168,14 @@ mcview_growbuf_read_until (mcview_t * view, off_t ofs) gboolean mcview_get_byte_growing_buffer (mcview_t * view, off_t byte_index, int *retval) { + off_t pageno; + off_t pageindex; + if (retval) *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); diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c index c5f30b7ae..ac489a6d6 100644 --- a/src/viewer/mcviewer.c +++ b/src/viewer/mcviewer.c @@ -262,7 +262,7 @@ int mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line) { gboolean succeeded; - mcview_t *mcview_t; + mcview_t *lc_mcview; WButtonBar *bar; 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, "[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); 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) { run_dlg (view_dlg); if (move_dir_p) - *move_dir_p = mcview_t->move_dir; + *move_dir_p = lc_mcview->move_dir; } else { if (move_dir_p) *move_dir_p = 0; diff --git a/src/viewer/nroff.c b/src/viewer/nroff.c index a23a05efc..8ca5399f0 100644 --- a/src/viewer/nroff.c +++ b/src/viewer/nroff.c @@ -222,14 +222,14 @@ mcview__get_nroff_real_len (mcview_t * view, off_t start, off_t length) /* --------------------------------------------------------------------------------------------- */ 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; nroff = g_malloc0 (sizeof (mcview_nroff_t)); if (nroff == NULL) return NULL; - nroff->index = index; + nroff->index = lc_index; nroff->view = view; mcview_nroff_seq_info (nroff); return nroff; diff --git a/src/viewer/search.c b/src/viewer/search.c index 6129d3d4d..5054492f3 100644 --- a/src/viewer/search.c +++ b/src/viewer/search.c @@ -113,15 +113,15 @@ mcview_find (mcview_t * view, gsize search_start, gsize * len) int mcview_search_cmd_callback (const void *user_data, gsize char_offset) { - int byte; + int lc_byte; mcview_t *view = (mcview_t *) user_data; /* view_read_continue (view, &view->search_onechar_info); *//* AB:FIXME */ 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 byte; + return lc_byte; } if (view->search_numNeedSkipChar) { @@ -129,9 +129,9 @@ mcview_search_cmd_callback (const void *user_data, gsize char_offset) 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; 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) view->search_numNeedSkipChar = 2; - return byte; + return lc_byte; } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/widget.c b/src/widget.c index 78b49d9ca..16f4ec875 100644 --- a/src/widget.c +++ b/src/widget.c @@ -370,7 +370,7 @@ radio_callback (Widget *w, widget_msg_t msg, int parm) switch (msg) { 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++) { if (r->texts[i].hotkey != NULL) { @@ -2794,11 +2794,11 @@ buttonbar_new (int visible) } 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 */ diff --git a/vfs/extfs.c b/vfs/extfs.c index 726c8383c..7178b2373 100644 --- a/vfs/extfs.c +++ b/vfs/extfs.c @@ -615,7 +615,7 @@ extfs_get_archive_name (struct archive *archive) /* Don't pass localname as NULL */ 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) { 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); 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); g_free (quoted_file); g_free (quoted_localname); diff --git a/vfs/gc.c b/vfs/gc.c index 0d6346b55..802dffce4 100644 --- a/vfs/gc.c +++ b/vfs/gc.c @@ -239,7 +239,7 @@ void vfs_expire (int now) { static int locked = 0; - struct timeval time; + struct timeval lc_time; struct vfs_stamping *stamp, *st; /* Avoid recursive invocation, e.g. when one of the free functions @@ -248,11 +248,11 @@ vfs_expire (int now) return; locked = 1; - gettimeofday (&time, NULL); - time.tv_sec -= vfs_timeout; + gettimeofday (&lc_time, NULL); + lc_time.tv_sec -= vfs_timeout; for (stamp = stamps; stamp != NULL;) { - if (now || (timeoutcmp (&stamp->time, &time))) { + if (now || (timeoutcmp (&stamp->time, &lc_time))) { st = stamp->next; if (stamp->v->free) (*stamp->v->free) (stamp->id); diff --git a/vfs/mcfs.c b/vfs/mcfs.c index 654ddf90b..9903e57ca 100644 --- a/vfs/mcfs.c +++ b/vfs/mcfs.c @@ -693,17 +693,17 @@ mcfs_loaddir (opendir_info *mcfs_info) { int status, error; mcfs_connection *mc = mcfs_info->conn; - int link = mc->sock; + int lc_link = mc->sock; 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); for (;;) { int entry_len; 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; if (entry_len == 0) @@ -723,11 +723,11 @@ mcfs_loaddir (opendir_info *mcfs_info) } 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; /* 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; if (mcfs_is_error (status, error)) @@ -1253,11 +1253,4 @@ tcp_invalidate_socket (int sock) { mcfs_invalidate_socket (sock); } -#else -void mcfs__unused(void) -{ -/* - CFLAGS="-ansi -pedantic -Wall -Wextra -Werror" -*/ -} #endif /* ENABLE_VFS_MCFS */ diff --git a/vfs/mcfsutil.c b/vfs/mcfsutil.c index f390e4345..d3c2e0450 100644 --- a/vfs/mcfsutil.c +++ b/vfs/mcfsutil.c @@ -210,11 +210,4 @@ rpc_get (int sock, ...) } } } -#else -void mcfsutil__unused(void) -{ -/* - CFLAGS="-ansi -pedantic -Wall -Wextra -Werror" -*/ -} #endif /* ENABLE_VFS_MCFS */ diff --git a/vfs/smbfs.c b/vfs/smbfs.c index 87f7cebf6..a64405de7 100644 --- a/vfs/smbfs.c +++ b/vfs/smbfs.c @@ -182,7 +182,7 @@ smbfs_auth_cmp_host (gconstpointer _a, gconstpointer _b) static void 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); @@ -194,7 +194,7 @@ smbfs_auth_add (const char *host, const char *share, const char *domain, auth->share = g_strdup (share); auth->domain = g_strdup (domain); auth->user = g_strdup (user); - auth->password = g_strdup (password); + auth->password = g_strdup (param_password); auth_list = g_slist_prepend (auth_list, auth); } diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c index c4fbca667..7abc068ac 100644 --- a/vfs/utilvfs.c +++ b/vfs/utilvfs.c @@ -234,7 +234,7 @@ vfs_findgid (const char *gname) * We also protect stupid scripts agains dangerous names. */ 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; char *suffix, *q; @@ -242,9 +242,9 @@ vfs_mkstemps (char **pname, const char *prefix, const char *basename) int fd; /* Strip directories */ - p = strrchr (basename, PATH_SEP); + p = strrchr (param_basename, PATH_SEP); if (!p) - p = basename; + p = param_basename; else 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); p += 9; } else { - size_t skipped; + size_t lc_skipped; mode_t perms; - if (!vfs_parse_fileperms (p, &skipped, &perms)) + if (!vfs_parse_fileperms (p, &lc_skipped, &perms)) goto error; - p += skipped; + p += lc_skipped; s->st_mode |= perms; } @@ -889,11 +889,11 @@ vfs_parse_ls_lga (const char *p, struct stat *s, char **filename, } if (t) { - int p = strlen (t); - if ((--p > 0) && (t[p] == '\r' || t[p] == '\n')) - t[p] = 0; - if ((--p > 0) && (t[p] == '\r' || t[p] == '\n')) - t[p] = 0; + int p2 = strlen (t); + if ((--p2 > 0) && (t[p2] == '\r' || t[p2] == '\n')) + t[p2] = 0; + if ((--p2 > 0) && (t[p2] == '\r' || t[p2] == '\n')) + t[p2] = 0; } g_free (p_copy);