aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2006-07-19 21:14:02 +0000
committerYang Tse <yangsita@gmail.com>2006-07-19 21:14:02 +0000
commitd157c292693972658d138475276dca85df77539b (patch)
treed51651e65fe7145775ae0562c5a25cbdbce9dc8d /lib
parent4d2e81661bbea7164209b5aac28c4f3d3f5dae8c (diff)
Fix compiler warnings
Diffstat (limited to 'lib')
-rw-r--r--lib/base64.c10
-rw-r--r--lib/http_ntlm.c16
-rw-r--r--lib/ssluse.c2
-rw-r--r--lib/telnet.c4
-rw-r--r--lib/tftp.c14
-rw-r--r--lib/url.c10
6 files changed, 29 insertions, 27 deletions
diff --git a/lib/base64.c b/lib/base64.c
index 627fa9840..c9e8a382c 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -177,10 +177,12 @@ size_t Curl_base64_encode(const char *inp, size_t insize, char **outptr)
ibuf[i] = 0;
}
- obuf [0] = (ibuf [0] & 0xFC) >> 2;
- obuf [1] = ((ibuf [0] & 0x03) << 4) | ((ibuf [1] & 0xF0) >> 4);
- obuf [2] = ((ibuf [1] & 0x0F) << 2) | ((ibuf [2] & 0xC0) >> 6);
- obuf [3] = ibuf [2] & 0x3F;
+ obuf[0] = (unsigned char) ((ibuf[0] & 0xFC) >> 2);
+ obuf[1] = (unsigned char) (((ibuf[0] & 0x03) << 4) | \
+ ((ibuf[1] & 0xF0) >> 4));
+ obuf[2] = (unsigned char) (((ibuf[1] & 0x0F) << 2) | \
+ ((ibuf[2] & 0xC0) >> 6));
+ obuf[3] = (unsigned char) (ibuf[2] & 0x3F);
switch(inputparts) {
case 1: /* only one byte read */
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index 01f049f24..24b89dded 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -304,13 +304,13 @@ static void setup_des_key(unsigned char *key_56,
DES_cblock key;
key[0] = key_56[0];
- key[1] = ((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1);
- key[2] = ((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2);
- key[3] = ((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3);
- key[4] = ((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4);
- key[5] = ((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5);
- key[6] = ((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6);
- key[7] = (key_56[6] << 1) & 0xFF;
+ key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1));
+ key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2));
+ key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3));
+ key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4));
+ key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5));
+ key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6));
+ key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF);
DES_set_odd_parity(&key);
DES_set_key(&key, ks);
@@ -357,7 +357,7 @@ static void mk_lm_hash(char *password, unsigned char *lmbuffer /* 21 bytes */)
len = 14;
for (i=0; i<len; i++)
- pw[i] = toupper(password[i]);
+ pw[i] = (unsigned char)toupper(password[i]);
for (; i<14; i++)
pw[i] = 0;
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 284406084..90b8afe20 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -1806,7 +1806,7 @@ size_t Curl_ossl_version(char *buffer, size_t size)
}
else {
if(ssleay_value&0xff0) {
- sub[0]=(char)((ssleay_value>>4)&0xff) + 'a' -1;
+ sub[0]=(char)(((ssleay_value>>4)&0xff) + 'a' -1);
}
else
sub[0]='\0';
diff --git a/lib/telnet.c b/lib/telnet.c
index 29e053e15..5f94807df 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -295,8 +295,8 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option)
struct SessionHandle *data = conn->data;
buf[0] = CURL_IAC;
- buf[1] = cmd;
- buf[2] = option;
+ buf[1] = (unsigned char)cmd;
+ buf[2] = (unsigned char)option;
bytes_written = swrite(conn->sock[FIRSTSOCKET], buf, 3);
if(bytes_written < 0) {
diff --git a/lib/tftp.c b/lib/tftp.c
index 7a347b5c3..38adc0c75 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -228,25 +228,25 @@ void tftp_set_timeouts(tftp_state_data_t *state)
static void setpacketevent(tftp_packet_t *packet, unsigned short num)
{
- packet->data[0] = (num >> 8);
- packet->data[1] = (num & 0xff);
+ packet->data[0] = (unsigned char)(num >> 8);
+ packet->data[1] = (unsigned char)(num & 0xff);
}
static void setpacketblock(tftp_packet_t *packet, unsigned short num)
{
- packet->data[2] = (num >> 8);
- packet->data[3] = (num & 0xff);
+ packet->data[2] = (unsigned char)(num >> 8);
+ packet->data[3] = (unsigned char)(num & 0xff);
}
static unsigned short getrpacketevent(tftp_packet_t *packet)
{
- return (packet->data[0] << 8) | packet->data[1];
+ return (unsigned short)((packet->data[0] << 8) | packet->data[1]);
}
static unsigned short getrpacketblock(tftp_packet_t *packet)
{
- return (packet->data[2] << 8) | packet->data[3];
+ return (unsigned short)((packet->data[2] << 8) | packet->data[3]);
}
static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
@@ -355,7 +355,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
}
}
/* This is the expected block. Reset counters and ACK it. */
- state->block = rblock;
+ state->block = (unsigned short)rblock;
state->retries = 0;
setpacketevent(&state->spacket, TFTP_EVENT_ACK);
setpacketblock(&state->spacket, state->block);
diff --git a/lib/url.c b/lib/url.c
index 7c0ebc7e6..85fef52c0 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2927,7 +2927,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
/* Now, build <protocol>_proxy and check for such a one to use */
while(*protop)
- *envp++ = tolower((int)*protop++);
+ *envp++ = (char)tolower((int)*protop++);
/* append _proxy */
strcpy(envp, "_proxy");
@@ -2950,7 +2950,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(!prox && !strequal("http_proxy", proxy_env)) {
/* There was no lowercase variable, try the uppercase version: */
for(envp = proxy_env; *envp; envp++)
- *envp = toupper((int)*envp);
+ *envp = (char)toupper((int)*envp);
prox=curl_getenv(proxy_env);
}
@@ -3080,7 +3080,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
}
conn->port = port;
- conn->remote_port = port;
+ conn->remote_port = (unsigned short)port;
conn->protocol |= PROT_FTP;
if(data->change.proxy &&
@@ -3120,7 +3120,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(type) {
char command;
*type=0; /* it was in the middle of the hostname */
- command = toupper((int)type[6]);
+ command = (char)toupper((int)type[6]);
switch(command) {
case 'A': /* ASCII mode */
data->set.ftp_ascii = 1;
@@ -3222,7 +3222,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(type) {
char command;
*type=0; /* it was in the middle of the hostname */
- command = toupper((int)type[6]);
+ command = (char)toupper((int)type[6]);
switch(command) {
case 'A': /* ASCII mode */
case 'N': /* NETASCII mode */