libarchive: Avoid using name 'u_long'
The system headers on some platforms define a 'u_long' type so we cannot use the name. Spell out 'unsigned long' instead.
This commit is contained in:
parent
e2b02823e7
commit
5a58efaac3
|
@ -103,15 +103,15 @@ static const char tooManyFields[] = "too many fields for format";
|
|||
|
||||
/* exported */
|
||||
dev_t
|
||||
pack_native(int n, u_long numbers[], const char **error)
|
||||
pack_native(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = apd_makedev(numbers[0], numbers[1]);
|
||||
if ((u_long)major(dev) != numbers[0])
|
||||
if ((unsigned long)major(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
else if ((u_long)minor(dev) != numbers[1])
|
||||
else if ((unsigned long)minor(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -120,15 +120,15 @@ pack_native(int n, u_long numbers[], const char **error)
|
|||
|
||||
|
||||
static dev_t
|
||||
pack_netbsd(int n, u_long numbers[], const char **error)
|
||||
pack_netbsd(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_netbsd(numbers[0], numbers[1]);
|
||||
if ((u_long)major_netbsd(dev) != numbers[0])
|
||||
if ((unsigned long)major_netbsd(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
else if ((u_long)minor_netbsd(dev) != numbers[1])
|
||||
else if ((unsigned long)minor_netbsd(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -142,15 +142,15 @@ pack_netbsd(int n, u_long numbers[], const char **error)
|
|||
(((y) << 0) & 0xffff00ff)))
|
||||
|
||||
static dev_t
|
||||
pack_freebsd(int n, u_long numbers[], const char **error)
|
||||
pack_freebsd(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_freebsd(numbers[0], numbers[1]);
|
||||
if ((u_long)major_freebsd(dev) != numbers[0])
|
||||
if ((unsigned long)major_freebsd(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)minor_freebsd(dev) != numbers[1])
|
||||
if ((unsigned long)minor_freebsd(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -164,15 +164,15 @@ pack_freebsd(int n, u_long numbers[], const char **error)
|
|||
(((y) << 0) & 0x000000ff)))
|
||||
|
||||
static dev_t
|
||||
pack_8_8(int n, u_long numbers[], const char **error)
|
||||
pack_8_8(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_8_8(numbers[0], numbers[1]);
|
||||
if ((u_long)major_8_8(dev) != numbers[0])
|
||||
if ((unsigned long)major_8_8(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)minor_8_8(dev) != numbers[1])
|
||||
if ((unsigned long)minor_8_8(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -186,15 +186,15 @@ pack_8_8(int n, u_long numbers[], const char **error)
|
|||
(((y) << 0) & 0x000fffff)))
|
||||
|
||||
static dev_t
|
||||
pack_12_20(int n, u_long numbers[], const char **error)
|
||||
pack_12_20(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_12_20(numbers[0], numbers[1]);
|
||||
if ((u_long)major_12_20(dev) != numbers[0])
|
||||
if ((unsigned long)major_12_20(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)minor_12_20(dev) != numbers[1])
|
||||
if ((unsigned long)minor_12_20(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -208,15 +208,15 @@ pack_12_20(int n, u_long numbers[], const char **error)
|
|||
(((y) << 0) & 0x0003ffff)))
|
||||
|
||||
static dev_t
|
||||
pack_14_18(int n, u_long numbers[], const char **error)
|
||||
pack_14_18(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_14_18(numbers[0], numbers[1]);
|
||||
if ((u_long)major_14_18(dev) != numbers[0])
|
||||
if ((unsigned long)major_14_18(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)minor_14_18(dev) != numbers[1])
|
||||
if ((unsigned long)minor_14_18(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -230,15 +230,15 @@ pack_14_18(int n, u_long numbers[], const char **error)
|
|||
(((y) << 0) & 0x00ffffff)))
|
||||
|
||||
static dev_t
|
||||
pack_8_24(int n, u_long numbers[], const char **error)
|
||||
pack_8_24(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_8_24(numbers[0], numbers[1]);
|
||||
if ((u_long)major_8_24(dev) != numbers[0])
|
||||
if ((unsigned long)major_8_24(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)minor_8_24(dev) != numbers[1])
|
||||
if ((unsigned long)minor_8_24(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
@ -254,23 +254,23 @@ pack_8_24(int n, u_long numbers[], const char **error)
|
|||
(((z) << 0) & 0x000000ff)))
|
||||
|
||||
static dev_t
|
||||
pack_bsdos(int n, u_long numbers[], const char **error)
|
||||
pack_bsdos(int n, unsigned long numbers[], const char **error)
|
||||
{
|
||||
dev_t dev = 0;
|
||||
|
||||
if (n == 2) {
|
||||
dev = makedev_12_20(numbers[0], numbers[1]);
|
||||
if ((u_long)major_12_20(dev) != numbers[0])
|
||||
if ((unsigned long)major_12_20(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)minor_12_20(dev) != numbers[1])
|
||||
if ((unsigned long)minor_12_20(dev) != numbers[1])
|
||||
*error = iMinorError;
|
||||
} else if (n == 3) {
|
||||
dev = makedev_12_12_8(numbers[0], numbers[1], numbers[2]);
|
||||
if ((u_long)major_12_12_8(dev) != numbers[0])
|
||||
if ((unsigned long)major_12_12_8(dev) != numbers[0])
|
||||
*error = iMajorError;
|
||||
if ((u_long)unit_12_12_8(dev) != numbers[1])
|
||||
if ((unsigned long)unit_12_12_8(dev) != numbers[1])
|
||||
*error = "invalid unit number";
|
||||
if ((u_long)subunit_12_12_8(dev) != numbers[2])
|
||||
if ((unsigned long)subunit_12_12_8(dev) != numbers[2])
|
||||
*error = "invalid subunit number";
|
||||
} else
|
||||
*error = tooManyFields;
|
||||
|
|
|
@ -34,8 +34,7 @@
|
|||
#ifndef _PACK_DEV_H
|
||||
#define _PACK_DEV_H
|
||||
|
||||
typedef dev_t pack_t(int, u_long [], const char **);
|
||||
typedef unsigned long u_long;
|
||||
typedef dev_t pack_t(int, unsigned long [], const char **);
|
||||
|
||||
pack_t *pack_find(const char *);
|
||||
pack_t pack_native;
|
||||
|
|
Loading…
Reference in New Issue