summaryrefslogtreecommitdiff
path: root/ares_init.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_init.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_init.c')
-rw-r--r--ares_init.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ares_init.c b/ares_init.c
index e37ac7b..b5b841f 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -1349,7 +1349,7 @@ static void randomize_key(unsigned char* key,int key_data_len)
if ( !randomized ) {
for (;counter<key_data_len;counter++)
- key[counter]=rand() % 256;
+ key[counter]=(unsigned char)(rand() % 256);
}
}
@@ -1369,18 +1369,18 @@ static int init_id_key(rc4_key* key,int key_data_len)
state = &key->state[0];
for(counter = 0; counter < 256; counter++)
/* unnecessary AND but it keeps some compilers happier */
- state[counter] = counter & 0xff;
+ state[counter] = (unsigned char)(counter & 0xff);
key->x = 0;
key->y = 0;
index1 = 0;
index2 = 0;
for(counter = 0; counter < 256; counter++)
{
- index2 = (key_data_ptr[index1] + state[counter] +
- index2) % 256;
+ index2 = (unsigned char)((key_data_ptr[index1] + state[counter] +
+ index2) % 256);
ARES_SWAP_BYTE(&state[counter], &state[index2]);
- index1 = (index1 + 1) % key_data_len;
+ index1 = (unsigned char)((index1 + 1) % key_data_len);
}
free(key_data_ptr);
return ARES_SUCCESS;