aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-02-01 01:42:13 +0000
committerYang Tse <yangsita@gmail.com>2007-02-01 01:42:13 +0000
commit54db98c220255737456b1311cb9534c9e95215c6 (patch)
treea9ee1b3e102a5d9c099068a220412e5989f520d8 /lib
parent5565f45f5e5213df213336f99d19a471c1ac2632 (diff)
compiler warning fix
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c2
-rw-r--r--lib/mprintf.c10
-rw-r--r--lib/url.c18
3 files changed, 20 insertions, 10 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 2ae973790..00aca12ee 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3208,7 +3208,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
state(conn, newstate);
/* keep track of our current transfer type */
- ftpc->transfertype = want;
+ ftpc->transfertype = (char)want;
return CURLE_OK;
}
diff --git a/lib/mprintf.c b/lib/mprintf.c
index 610395318..3224521b0 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -694,7 +694,7 @@ static int dprintf_formatf(
else
prec = -1;
- alt = (p->flags & FLAGS_ALT)?TRUE:FALSE;
+ alt = (char)((p->flags & FLAGS_ALT)?TRUE:FALSE);
switch (p->type) {
case FORMAT_INT:
@@ -734,14 +734,14 @@ static int dprintf_formatf(
#ifdef ENABLE_64BIT
if(p->flags & FLAGS_LONGLONG) {
/* long long */
- is_neg = p->data.lnum < 0;
+ is_neg = (char)(p->data.lnum < 0);
num = is_neg ? (- p->data.lnum) : p->data.lnum;
}
else
#endif
{
signed_num = (long) num;
- is_neg = signed_num < 0;
+ is_neg = (char)(signed_num < 0);
num = is_neg ? (- signed_num) : signed_num;
}
goto number;
@@ -944,9 +944,9 @@ static int dprintf_formatf(
*fptr++ = 'l';
if (p->flags & FLAGS_FLOATE)
- *fptr++ = p->flags&FLAGS_UPPER ? 'E':'e';
+ *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'E':'e');
else if (p->flags & FLAGS_FLOATG)
- *fptr++ = p->flags & FLAGS_UPPER ? 'G' : 'g';
+ *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'G' : 'g');
else
*fptr++ = 'f';
diff --git a/lib/url.c b/lib/url.c
index 63c93f1b1..916d2a63c 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -375,19 +375,29 @@ CURLcode Curl_close(struct SessionHandle *data)
/* create a connection cache of a private or multi type */
struct conncache *Curl_mk_connc(int type,
- int amount) /* set -1 to use default */
+ long amount) /* set -1 to use default */
{
/* It is subject for debate how many default connections to have for a multi
connection cache... */
- int default_amount = amount == -1?
- ((type == CONNCACHE_PRIVATE)?5:10):amount;
+
struct conncache *c;
+ long default_amount;
+
+ if (type == CONNCACHE_PRIVATE) {
+ default_amount = (amount < 0) ? 5 : amount;
+ }
+ else {
+ default_amount = (amount < 0) ? 10 : amount;
+ }
c= calloc(sizeof(struct conncache), 1);
if(!c)
return NULL;
- c->connects = calloc(sizeof(struct connectdata *), default_amount);
+ if ((size_t)(default_amount) > ((size_t)-1) / sizeof(struct connectdata *))
+ default_amount = ((size_t)-1) / sizeof(struct connectdata *);
+
+ c->connects = calloc(sizeof(struct connectdata *), (size_t)default_amount);
if(!c->connects) {
free(c);
return NULL;