diff options
author | Yang Tse <yangsita@gmail.com> | 2010-02-21 19:59:09 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-02-21 19:59:09 +0000 |
commit | 10affed097df354f1b9db8602cd7257f76d10654 (patch) | |
tree | 4768a11da103dd44055cfdc3d6bbd0818694b180 /lib/base64.c | |
parent | 25a49ccd2137c8e26f70c12d18e597f4c7677015 (diff) | |
download | curl-10affed097df354f1b9db8602cd7257f76d10654.tar.gz |
fix compiler warning
Diffstat (limited to 'lib/base64.c')
-rw-r--r-- | lib/base64.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/base64.c b/lib/base64.c index d0f32f84a..dea74de9e 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -54,28 +54,27 @@ static const char table64[]= static void decodeQuantum(unsigned char *dest, const char *src) { - size_t x = 0; - int i; - char *found; - union { - ssize_t sig; - size_t uns; - } offset; - - for(i = 0; i < 4; i++) { - if((found = strchr(table64, src[i])) != NULL) { - offset.sig = found - table64; - x = (x << 6) + offset.uns; + const char *s, *p; + unsigned long i, v, x = 0; + + for(i = 0, s = src; i < 4; i++, s++) { + v = 0; + p = table64; + while(*p && (*p != *s)) { + v++; + p++; } - else if(src[i] == '=') + if(*p == *s) + x = (x << 6) + v; + else if(*s == '=') x = (x << 6); } - dest[2] = (unsigned char)(x & (size_t)0xFFUL); + dest[2] = (unsigned char)(x & 0xFFUL); x >>= 8; - dest[1] = (unsigned char)(x & (size_t)0xFFUL); + dest[1] = (unsigned char)(x & 0xFFUL); x >>= 8; - dest[0] = (unsigned char)(x & (size_t)0xFFUL); + dest[0] = (unsigned char)(x & 0xFFUL); } /* |