Browse Source

Cleanup of code for compile with new warnings options for compilator

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Slava Zanko 15 years ago
parent
commit
51f10b3038
10 changed files with 84 additions and 82 deletions
  1. 3 1
      edit/edit.c
  2. 12 12
      src/achown.c
  3. 1 1
      src/background.c
  4. 6 6
      src/boxes.c
  5. 6 6
      src/command.c
  6. 4 4
      src/complete.c
  7. 11 11
      src/cons.saver.c
  8. 15 15
      src/dir.c
  9. 2 2
      src/execute.c
  10. 24 24
      src/ext.c

+ 3 - 1
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;

+ 12 - 12
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);

+ 1 - 1
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;

+ 6 - 6
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);
 

+ 6 - 6
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);
 

+ 4 - 4
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

+ 11 - 11
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));

+ 15 - 15
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;

+ 2 - 2
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

+ 24 - 24
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 */

Some files were not shown because too many files changed in this diff