Re: [PATCH 05/10] disk-utils: change cramsort signature to match what scandir expects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 08, 2009 at 01:40:10PM +0200, Guillem Jover wrote:
> The scandir compar argument is supposed to get passed ‘const void *’
> pointers. We get a warning otherwise.
> 
> Signed-off-by: Guillem Jover <guillem@xxxxxxxxxxx>
> ---
>  disk-utils/mkfs.cramfs.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
> index 4741440..7a1601a 100644
> --- a/disk-utils/mkfs.cramfs.c
> +++ b/disk-utils/mkfs.cramfs.c
> @@ -285,9 +285,10 @@ static void eliminate_doubles(struct entry *root, struct entry *orig, loff_t *fs
>   * We define our own sorting function instead of using alphasort which
>   * uses strcoll and changes ordering based on locale information.
>   */
> -static int cramsort (const struct dirent **a, const struct dirent **b)
> +static int cramsort (const void *a, const void *b)
>  {
> -	return strcmp((*a)->d_name, (*b)->d_name);
> +	return strcmp((*(const struct dirent **)a)->d_name,
> +	              (*(const struct dirent **)b)->d_name);
>  }

 it looks like revert to

        commit 6f68ab6af00b109e40d74d0d4c34170963210d95
        Author: Karel Zak <kzak@xxxxxxxxxx>
        Date:   Tue Sep 29 13:54:58 2009 +0200

        mkfs.cramfs: fix gcc warning (incompatible pointer type)

        mkfs.cramfs.c: In function ‘parse_directory’:
        mkfs.cramfs.c:310: warning: passing argument 4 of ‘scandir’ from incompatible pointer type

        Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>


 I see 

       int scandir(const char *dirp, struct dirent ***namelist,
              int (*filter)(const struct dirent *),
              int (*compar)(const struct dirent **, const struct dirent **));

 in "man scandir" and /usr/include/dirent.h (glibc-2.10.1).

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux