From 55bb14eb8d1f6d353eb9943b83c672acc35e7a07 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 3 Apr 2001 07:52:56 +0000 Subject: [PATCH] attempt-more-portable-64bit-type-support-for-namei-fileserver-20010403 be at least as portable as existing code --- src/util/afsutil.h | 8 +++++++- src/util/flipbase64.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/util/afsutil.h b/src/util/afsutil.h index dcc58a81a..4256620b5 100644 --- a/src/util/afsutil.h +++ b/src/util/afsutil.h @@ -112,9 +112,15 @@ int base32_to_int(char *s); * early in name. */ typedef char lb64_string_t[12]; +#ifdef AFS_64BIT_ENV +#define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (afs_int64)(A)) char *int64_to_flipbase64(b64_string_t s, afs_int64 a); +afs_int64 flipbase64_to_int64(char *s); +#else +#define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (u_int64_t)(A)) +char *int64_to_flipbase64(b64_string_t s, u_int64_t a); int64_t flipbase64_to_int64(char *s); -#define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (afs_int64)(A)) +#endif #endif /* This message preserves our ability to license AFS to the U.S. Government diff --git a/src/util/flipbase64.c b/src/util/flipbase64.c index 69ed97b22..20c3c0963 100644 --- a/src/util/flipbase64.c +++ b/src/util/flipbase64.c @@ -27,10 +27,18 @@ static char c_xlate[80] = * The supplied string 's' must be at least 12 bytes long. * lb64_string in stds.h provides a typedef to get the length. */ +#ifdef AFS_64BIT_ENV char *int64_to_flipbase64(lb64_string_t s, afs_int64 a) +#else +char *int64_to_flipbase64(lb64_string_t s, u_int64_t a) +#endif { int i, j; +#ifdef AFS_64BIT_ENV afs_int64 n; +#else + u_int64_t n; +#endif i = 0; if (a==0) @@ -46,10 +54,19 @@ char *int64_to_flipbase64(lb64_string_t s, afs_int64 a) /* Mapping: +=0, ==1, 0-9 = 2-11, A-Z = 12-37, a-z = 38-63 */ +#ifdef AFS_64BIT_ENV +afs_int64 flipbase64_to_int64(char *s) +#else int64_t flipbase64_to_int64(char *s) +#endif { +#ifdef AFS_64BIT_ENV afs_int64 n = 0; afs_int64 result = 0; +#else + int64_t n = 0; + int64_t result = 0; +#endif int shift; for (shift = 0; *s; s++, shift += 6) { -- 2.39.5