aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llbase32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/llbase32.cpp')
-rw-r--r--linden/indra/llcommon/llbase32.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/linden/indra/llcommon/llbase32.cpp b/linden/indra/llcommon/llbase32.cpp
index 79f560f..5e6ced9 100644
--- a/linden/indra/llcommon/llbase32.cpp
+++ b/linden/indra/llcommon/llbase32.cpp
@@ -22,7 +22,8 @@
22 * There are special exceptions to the terms and conditions of the GPL as 22 * There are special exceptions to the terms and conditions of the GPL as
23 * it is applied to this Source Code. View the full text of the exception 23 * it is applied to this Source Code. View the full text of the exception
24 * in the file doc/FLOSS-exception.txt in this software distribution, or 24 * in the file doc/FLOSS-exception.txt in this software distribution, or
25 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 25 * online at
26 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
26 * 27 *
27 * By copying, modifying or distributing this software, you acknowledge 28 * By copying, modifying or distributing this software, you acknowledge
28 * that you have read and understood your obligations described above, 29 * that you have read and understood your obligations described above,
@@ -145,8 +146,6 @@ base32_encode(char *dst, size_t size, const void *data, size_t len)
145 146
146/* *TODO: Implement base32 encode. 147/* *TODO: Implement base32 encode.
147 148
148#define ARRAY_LEN(a) (sizeof (a) / sizeof((a)[0]))
149
150static inline int 149static inline int
151ascii_toupper(int c) 150ascii_toupper(int c)
152{ 151{
@@ -172,7 +171,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len)
172 unsigned max_pad = 3; 171 unsigned max_pad = 3;
173 172
174 if (0 == base32_map[0]) { 173 if (0 == base32_map[0]) {
175 for (i = 0; i < ARRAY_LEN(base32_map); i++) { 174 for (i = 0; i < LL_ARRAY_SIZE(base32_map); i++) {
176 const char *x; 175 const char *x;
177 176
178 x = memchr(base32_alphabet, ascii_toupper(i), sizeof base32_alphabet); 177 x = memchr(base32_alphabet, ascii_toupper(i), sizeof base32_alphabet);
@@ -196,7 +195,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len)
196 } 195 }
197 } 196 }
198 197
199 j = i % ARRAY_LEN(s); 198 j = i % LL_ARRAY_SIZE(s);
200 s[j] = c; 199 s[j] = c;
201 200
202 if (7 == j) { 201 if (7 == j) {
@@ -208,7 +207,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len)
208 b[3] = ((s[4] & 1) << 7) | ((s[5] & 0x1f) << 2) | ((s[6] >> 3) & 0x03); 207 b[3] = ((s[4] & 1) << 7) | ((s[5] & 0x1f) << 2) | ((s[6] >> 3) & 0x03);
209 b[4] = ((s[6] & 0x07) << 5) | (s[7] & 0x1f); 208 b[4] = ((s[6] & 0x07) << 5) | (s[7] & 0x1f);
210 209
211 for (j = 0; j < ARRAY_LEN(b); j++) { 210 for (j = 0; j < LL_ARRAY_SIZE(b); j++) {
212 if (q != end) 211 if (q != end)
213 *q = b[j]; 212 *q = b[j];
214 q++; 213 q++;