diff options
author | kientzle <kientzle@FreeBSD.org> | 2007-04-15 00:53:38 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2007-04-15 00:53:38 +0000 |
commit | cc44f89006ca6ae738f04f8efb58efbbd52a7268 (patch) | |
tree | 77e2b47f8d4f88350fd88646e5a721011efe04d4 /lib/libarchive/archive_read_support_format_ar.c | |
parent | 034ed0ce440f90570c5fb879ba9edb6725caaf1c (diff) | |
download | FreeBSD-src-cc44f89006ca6ae738f04f8efb58efbbd52a7268.zip FreeBSD-src-cc44f89006ca6ae738f04f8efb58efbbd52a7268.tar.gz |
Consolidate numeric limit macros in one place; include them
only on platforms that need them. FreeBSD doesn't.
Diffstat (limited to 'lib/libarchive/archive_read_support_format_ar.c')
-rw-r--r-- | lib/libarchive/archive_read_support_format_ar.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/libarchive/archive_read_support_format_ar.c b/lib/libarchive/archive_read_support_format_ar.c index b5979b2..44f9ca6 100644 --- a/lib/libarchive/archive_read_support_format_ar.c +++ b/lib/libarchive/archive_read_support_format_ar.c @@ -556,13 +556,12 @@ bad_string_table: static uint64_t ar_atol8(const char *p, unsigned char_cnt) { - static const uint64_t max_uint64 = ~(uint64_t)0; uint64_t l, limit, last_digit_limit; unsigned int digit, base; base = 8; - limit = max_uint64 / base; - last_digit_limit = max_uint64 % base; + limit = UINT64_MAX / base; + last_digit_limit = UINT64_MAX % base; while ((*p == ' ' || *p == '\t') && char_cnt-- > 0) p++; @@ -571,7 +570,7 @@ ar_atol8(const char *p, unsigned char_cnt) digit = *p - '0'; while (*p >= '0' && digit < base && char_cnt-- > 0) { if (l>limit || (l == limit && digit > last_digit_limit)) { - l = max_uint64; /* Truncate on overflow. */ + l = UINT64_MAX; /* Truncate on overflow. */ break; } l = (l * base) + digit; @@ -583,13 +582,12 @@ ar_atol8(const char *p, unsigned char_cnt) static uint64_t ar_atol10(const char *p, unsigned char_cnt) { - static const uint64_t max_uint64 = ~(uint64_t)0; uint64_t l, limit, last_digit_limit; unsigned int base, digit; base = 10; - limit = max_uint64 / base; - last_digit_limit = max_uint64 % base; + limit = UINT64_MAX / base; + last_digit_limit = UINT64_MAX % base; while ((*p == ' ' || *p == '\t') && char_cnt-- > 0) p++; @@ -597,7 +595,7 @@ ar_atol10(const char *p, unsigned char_cnt) digit = *p - '0'; while (*p >= '0' && digit < base && char_cnt-- > 0) { if (l > limit || (l == limit && digit > last_digit_limit)) { - l = max_uint64; /* Truncate on overflow. */ + l = UINT64_MAX; /* Truncate on overflow. */ break; } l = (l * base) + digit; |