summaryrefslogtreecommitdiff
path: root/ares_query.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-10-18 01:01:20 +0000
committerYang Tse <yangsita@gmail.com>2007-10-18 01:01:20 +0000
commit57abe9d22d7513aea247d4944db2e55110f67613 (patch)
treee0f86ab888ad1a1f8a5ce5a81427cd948d16044d /ares_query.c
parent2c8db1aec8dc18a2449f875d3a9b31bef3c0368c (diff)
downloadc-ares-57abe9d22d7513aea247d4944db2e55110f67613.tar.gz
c-ares-57abe9d22d7513aea247d4944db2e55110f67613.tar.bz2
c-ares-57abe9d22d7513aea247d4944db2e55110f67613.zip
Fix compiler warning: conversion from "int" to "unsigned char"
may lose significant bits
Diffstat (limited to 'ares_query.c')
-rw-r--r--ares_query.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ares_query.c b/ares_query.c
index c7c31ed..3959c0e 100644
--- a/ares_query.c
+++ b/ares_query.c
@@ -53,13 +53,13 @@ void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
state = &key->state[0];
for(counter = 0; counter < buffer_len; counter ++)
{
- x = (x + 1) % 256;
- y = (state[x] + y) % 256;
- ARES_SWAP_BYTE(&state[x], &state[y]);
+ x = (unsigned char)((x + 1) % 256);
+ y = (unsigned char)((state[x] + y) % 256);
+ ARES_SWAP_BYTE(&state[x], &state[y]);
- xorIndex = (state[x] + state[y]) % 256;
+ xorIndex = (unsigned char)((state[x] + state[y]) % 256);
- buffer_ptr[counter] ^= state[xorIndex];
+ buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]);
}
key->x = x;
key->y = y;