fix compiler warning

This commit is contained in:
Yang Tse 2010-02-24 00:03:06 +00:00
parent aa0f8593b9
commit 5695c4db86
4 changed files with 12 additions and 9 deletions

View File

@ -35,6 +35,7 @@
/* urldata.h and easyif.h are included for Curl_convert_... prototypes */ /* urldata.h and easyif.h are included for Curl_convert_... prototypes */
#include "urldata.h" #include "urldata.h"
#include "easyif.h" #include "easyif.h"
#include "warnless.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@ -152,7 +153,7 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
char *ns = malloc(alloc); char *ns = malloc(alloc);
unsigned char in; unsigned char in;
int strindex=0; int strindex=0;
long hex; unsigned long hex;
#ifndef CURL_DOES_CONVERSIONS #ifndef CURL_DOES_CONVERSIONS
/* avoid compiler warnings */ /* avoid compiler warnings */
@ -171,9 +172,9 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
hexstr[1] = string[2]; hexstr[1] = string[2];
hexstr[2] = 0; hexstr[2] = 0;
hex = strtol(hexstr, &ptr, 16); hex = strtoul(hexstr, &ptr, 16);
in = (unsigned char)hex; /* this long is never bigger than 255 anyway */ in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */
#ifdef CURL_DOES_CONVERSIONS #ifdef CURL_DOES_CONVERSIONS
/* escape sequences are always in ASCII so convert them on non-ASCII hosts */ /* escape sequences are always in ASCII so convert them on non-ASCII hosts */

View File

@ -91,6 +91,7 @@
#include "url.h" #include "url.h"
#include "rawstr.h" #include "rawstr.h"
#include "speedcheck.h" #include "speedcheck.h"
#include "warnless.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@ -759,9 +760,9 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
/* parse the port */ /* parse the port */
if( ip_end != NULL ) { if( ip_end != NULL ) {
if((port_start = strchr(ip_end, ':')) != NULL) { if((port_start = strchr(ip_end, ':')) != NULL) {
port_min = (unsigned short)strtol(port_start+1, NULL, 10); port_min = curlx_ultous(strtoul(port_start+1, NULL, 10));
if((port_sep = strchr(port_start, '-')) != NULL) { if((port_sep = strchr(port_start, '-')) != NULL) {
port_max = (unsigned short)strtol(port_sep + 1, NULL, 10); port_max = curlx_ultous(strtoul(port_sep + 1, NULL, 10));
} }
else else
port_max = port_min; port_max = port_min;

View File

@ -1212,7 +1212,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* Now set the new attributes... */ /* Now set the new attributes... */
if(curl_strnequal(sshc->quote_item->data, "chgrp", 5)) { if(curl_strnequal(sshc->quote_item->data, "chgrp", 5)) {
sshc->quote_attrs.gid = strtol(sshc->quote_path1, NULL, 10); sshc->quote_attrs.gid = strtoul(sshc->quote_path1, NULL, 10);
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID; sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0])) { if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0])) {
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
@ -1226,7 +1226,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
} }
} }
else if(curl_strnequal(sshc->quote_item->data, "chmod", 5)) { else if(curl_strnequal(sshc->quote_item->data, "chmod", 5)) {
sshc->quote_attrs.permissions = strtol(sshc->quote_path1, NULL, 8); sshc->quote_attrs.permissions = strtoul(sshc->quote_path1, NULL, 8);
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS; sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS;
/* permissions are octal */ /* permissions are octal */
if(sshc->quote_attrs.permissions == 0 && if(sshc->quote_attrs.permissions == 0 &&
@ -1242,7 +1242,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
} }
} }
else if(curl_strnequal(sshc->quote_item->data, "chown", 5)) { else if(curl_strnequal(sshc->quote_item->data, "chown", 5)) {
sshc->quote_attrs.uid = strtol(sshc->quote_path1, NULL, 10); sshc->quote_attrs.uid = strtoul(sshc->quote_path1, NULL, 10);
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID; sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0])) { if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0])) {
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);

View File

@ -120,6 +120,7 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
#include "easyif.h" #include "easyif.h"
#include "speedcheck.h" #include "speedcheck.h"
#include "rawstr.h" #include "rawstr.h"
#include "warnless.h"
/* And now for the protocols */ /* And now for the protocols */
#include "ftp.h" #include "ftp.h"
@ -4267,7 +4268,7 @@ static CURLcode parse_remote_port(struct SessionHandle *data,
} }
*portptr = '\0'; /* cut off the name there */ *portptr = '\0'; /* cut off the name there */
conn->remote_port = (unsigned short)port; conn->remote_port = curlx_ultous(port);
} }
} }
return CURLE_OK; return CURLE_OK;