diff options
author | Yang Tse <yangsita@gmail.com> | 2007-10-18 01:01:20 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2007-10-18 01:01:20 +0000 |
commit | 8cfb0e26bb9e88027b27b8b5947b9d5a3aa5e116 (patch) | |
tree | f654a0c471b7861b3e99d2615a977d7f4542b9f2 /ares/ares_query.c | |
parent | 0164f0cf81413948c756e3a7f7003ec5b1094149 (diff) |
Fix compiler warning: conversion from "int" to "unsigned char"
may lose significant bits
Diffstat (limited to 'ares/ares_query.c')
-rw-r--r-- | ares/ares_query.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ares/ares_query.c b/ares/ares_query.c index c7c31edd9..3959c0e3f 100644 --- a/ares/ares_query.c +++ b/ares/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; |