summaryrefslogtreecommitdiff
path: root/lib/base64.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-20 11:58:26 +0000
committerYang Tse <yangsita@gmail.com>2010-02-20 11:58:26 +0000
commita6fb6b70c7d08b9243aecff1fa059758ddf39e52 (patch)
tree5d8490f23833f8ef81fe2e7e15d86d9e6063f39b /lib/base64.c
parent2179ef9fa914c916b3f6e35519091d3e72b75d2c (diff)
downloadcurl-a6fb6b70c7d08b9243aecff1fa059758ddf39e52.tar.gz
fix compiler warning
Diffstat (limited to 'lib/base64.c')
-rw-r--r--lib/base64.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/base64.c b/lib/base64.c
index 26d89231e..cb67e5ad7 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -54,22 +54,28 @@ static const char table64[]=
static void decodeQuantum(unsigned char *dest, const char *src)
{
- unsigned int x = 0;
+ unsigned long x = 0;
int i;
char *found;
+ union {
+ unsigned long uns;
+ long sig;
+ } offset;
for(i = 0; i < 4; i++) {
- if((found = strchr(table64, src[i])) != NULL)
- x = (x << 6) + (unsigned int)(found - table64);
+ if((found = strchr(table64, src[i])) != NULL) {
+ offset.sig = found - table64;
+ x = (x << 6) + offset.uns;
+ }
else if(src[i] == '=')
x = (x << 6);
}
- dest[2] = (unsigned char)(x & 255);
+ dest[2] = (unsigned char)(x & 0xFFUL);
x >>= 8;
- dest[1] = (unsigned char)(x & 255);
+ dest[1] = (unsigned char)(x & 0xFFUL);
x >>= 8;
- dest[0] = (unsigned char)(x & 255);
+ dest[0] = (unsigned char)(x & 0xFFUL);
}
/*