Browse Source

Avoid compiler warnings.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Slava Zanko 14 years ago
parent
commit
c57566af00
4 changed files with 25 additions and 25 deletions
  1. 3 3
      lib/lock.c
  2. 7 7
      lib/vfs/mc-vfs/ftpfs.c
  3. 14 14
      src/complete.c
  4. 1 1
      src/find.c

+ 3 - 3
lib/lock.c

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

+ 7 - 7
lib/vfs/mc-vfs/ftpfs.c

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

+ 14 - 14
src/complete.c

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

+ 1 - 1
src/find.c

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