summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRose <83477269+AtariDreams@users.noreply.github.com>2022-10-28 12:32:09 -0400
committerJay Satiro <raysatiro@yahoo.com>2022-11-08 03:11:01 -0500
commitf151ec6c1053826bdcc740d97257d877b759e777 (patch)
tree6da9daa805268783d6b3fb75dde3cb5007ab4fb9
parent14061f784c47069d20d17dd9d6c6cf4613efeca5 (diff)
downloadcurl-f151ec6c1053826bdcc740d97257d877b759e777.tar.gz
lib: fix some type mismatches and remove unneeded typecasts
Many of these castings are unneeded if we change the variables to work better with each other. Ref: https://github.com/curl/curl/pull/9823 Closes https://github.com/curl/curl/pull/9835
-rw-r--r--lib/connect.c17
-rw-r--r--lib/cookie.c5
-rw-r--r--lib/curl_fnmatch.c7
-rw-r--r--lib/escape.c2
-rw-r--r--lib/file.c4
-rw-r--r--lib/formdata.c14
-rw-r--r--lib/ftp.c13
-rw-r--r--lib/ftplistparser.c4
-rw-r--r--lib/http.c4
-rw-r--r--lib/ldap.c8
-rw-r--r--lib/mime.c2
-rw-r--r--lib/setopt.c2
-rw-r--r--lib/socks.c4
-rw-r--r--lib/telnet.c2
-rw-r--r--lib/vauth/digest.c2
-rw-r--r--lib/vtls/gskit.c2
-rw-r--r--lib/vtls/openssl.c6
-rw-r--r--packages/OS400/ccsidcurl.c4
-rw-r--r--packages/OS400/os400sys.c6
-rw-r--r--packages/vms/curl_crtl_init.c8
-rw-r--r--packages/vms/report_openssl_version.c12
-rw-r--r--tests/libtest/lib1542.c2
-rw-r--r--tests/libtest/lib1568.c2
23 files changed, 66 insertions, 66 deletions
diff --git a/lib/connect.c b/lib/connect.c
index ac007c61b..0d2414edc 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -398,18 +398,23 @@ static CURLcode bindlocal(struct Curl_easy *data,
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
char *scope_ptr = strchr(myhost, '%');
if(scope_ptr)
- *(scope_ptr++) = 0;
+ *(scope_ptr++) = '\0';
#endif
if(Curl_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0) {
si6->sin6_family = AF_INET6;
si6->sin6_port = htons(port);
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
- if(scope_ptr)
+ if(scope_ptr) {
/* The "myhost" string either comes from Curl_if2ip or from
Curl_printable_address. The latter returns only numeric scope
IDs and the former returns none at all. So the scope ID, if
present, is known to be numeric */
- si6->sin6_scope_id = atoi(scope_ptr);
+ unsigned long scope_id = strtoul(scope_ptr, NULL, 10);
+ if(scope_id > UINT_MAX)
+ return CURLE_UNSUPPORTED_PROTOCOL;
+
+ si6->sin6_scope_id = (unsigned int)scope_id;
+ }
#endif
}
sizeof_sa = sizeof(struct sockaddr_in6);
@@ -866,7 +871,7 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
int error = 0;
struct curltime now;
int rc = 0;
- unsigned int i;
+ int i;
DEBUGASSERT(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET);
@@ -1207,7 +1212,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
return result;
/* store remote address and port used in this connection attempt */
- if(!Curl_addr2string((struct sockaddr*)&addr.sa_addr, addr.addrlen,
+ if(!Curl_addr2string(&addr.sa_addr, addr.addrlen,
ipaddress, &port)) {
/* malformed address or bug in inet_ntop, try next address */
failf(data, "sa_addr inet_ntop() failed with errno %d: %s",
@@ -1262,7 +1267,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
#endif
) {
result = bindlocal(data, sockfd, addr.family,
- Curl_ipv6_scope((struct sockaddr*)&addr.sa_addr));
+ Curl_ipv6_scope(&addr.sa_addr));
if(result) {
Curl_closesocket(data, conn, sockfd); /* close socket and bail out */
if(result == CURLE_UNSUPPORTED_PROTOCOL) {
diff --git a/lib/cookie.c b/lib/cookie.c
index f3f3e4cf7..4d81344ba 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -300,12 +300,11 @@ static char *sanitize_cookie_path(const char *cookie_path)
/* some stupid site sends path attribute with '"'. */
len = strlen(new_path);
if(new_path[0] == '\"') {
- memmove((void *)new_path, (const void *)(new_path + 1), len);
+ memmove(new_path, new_path + 1, len);
len--;
}
if(len && (new_path[len - 1] == '\"')) {
- new_path[len - 1] = 0x0;
- len--;
+ new_path[--len] = 0x0;
}
/* RFC6265 5.2.4 The Path Attribute */
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index 0dd1eb5ef..b8a85a96e 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -76,9 +76,9 @@ static int parsekeyword(unsigned char **pattern, unsigned char *charset)
parsekey_state state = CURLFNM_PKW_INIT;
#define KEYLEN 10
char keyword[KEYLEN] = { 0 };
- int found = FALSE;
int i;
unsigned char *p = *pattern;
+ bool found = FALSE;
for(i = 0; !found; i++) {
char c = *p++;
if(i >= KEYLEN)
@@ -368,14 +368,13 @@ int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
*/
int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
{
- int rc;
(void)ptr; /* the argument is specified by the curl_fnmatch_callback
prototype, but not used by Curl_fnmatch() */
if(!pattern || !string) {
return CURL_FNMATCH_FAIL;
}
- rc = fnmatch(pattern, string, 0);
- switch(rc) {
+
+ switch(fnmatch(pattern, string, 0)) {
case 0:
return CURL_FNMATCH_MATCH;
case FNM_NOMATCH:
diff --git a/lib/escape.c b/lib/escape.c
index da7e5524f..ed59838bd 100644
--- a/lib/escape.c
+++ b/lib/escape.c
@@ -202,7 +202,7 @@ char *curl_easy_unescape(struct Curl_easy *data, const char *string,
char *str = NULL;
(void)data;
if(length >= 0) {
- size_t inputlen = length;
+ size_t inputlen = (size_t)length;
size_t outputlen;
CURLcode res = Curl_urldecode(string, inputlen, &str, &outputlen,
REJECT_NADA);
diff --git a/lib/file.c b/lib/file.c
index 4ed707883..892d25199 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -329,7 +329,7 @@ static CURLcode file_upload(struct Curl_easy *data)
while(!result) {
size_t nread;
- size_t nwrite;
+ ssize_t nwrite;
size_t readcount;
result = Curl_fillreadbuffer(data, data->set.buffer_size, &readcount);
if(result)
@@ -358,7 +358,7 @@ static CURLcode file_upload(struct Curl_easy *data)
/* write the data to the target */
nwrite = write(fd, buf2, nread);
- if(nwrite != nread) {
+ if((size_t)nwrite != nread) {
result = CURLE_SEND_ERROR;
break;
}
diff --git a/lib/formdata.c b/lib/formdata.c
index c84426375..058e06f1f 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -135,15 +135,13 @@ static struct FormInfo *AddFormInfo(char *value,
{
struct FormInfo *form_info;
form_info = calloc(1, sizeof(struct FormInfo));
- if(form_info) {
- if(value)
- form_info->value = value;
- if(contenttype)
- form_info->contenttype = contenttype;
- form_info->flags = HTTPPOST_FILENAME;
- }
- else
+ if(!form_info)
return NULL;
+ if(value)
+ form_info->value = value;
+ if(contenttype)
+ form_info->contenttype = contenttype;
+ form_info->flags = HTTPPOST_FILENAME;
if(parent_form_info) {
/* now, point our 'more' to the original 'more' */
diff --git a/lib/ftp.c b/lib/ftp.c
index 7d91caad8..4d3bcc387 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1174,7 +1174,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
/* get the name again after the bind() so that we can extract the
port number it uses now */
sslen = sizeof(ss);
- if(getsockname(portsock, (struct sockaddr *)sa, &sslen)) {
+ if(getsockname(portsock, sa, &sslen)) {
failf(data, "getsockname() failed: %s",
Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
Curl_closesocket(data, conn, portsock);
@@ -1950,7 +1950,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
*/
const char * const host_name = conn->bits.socksproxy ?
conn->socks_proxy.host.name : conn->http_proxy.host.name;
- rc = Curl_resolv(data, host_name, (int)conn->port, FALSE, &addr);
+ rc = Curl_resolv(data, host_name, conn->port, FALSE, &addr);
if(rc == CURLRESOLV_PENDING)
/* BLOCKING, ignores the return code but 'addr' will be NULL in
case of failure */
@@ -4167,7 +4167,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
/* get path before last slash, except for / */
size_t dirlen = slashPos - rawPath;
if(dirlen == 0)
- dirlen++;
+ dirlen = 1;
ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));
if(!ftpc->dirs) {
@@ -4194,13 +4194,14 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
/* current position: begin of next path component */
const char *curPos = rawPath;
- int dirAlloc = 0; /* number of entries allocated for the 'dirs' array */
+ /* number of entries allocated for the 'dirs' array */
+ size_t dirAlloc = 0;
const char *str = rawPath;
for(; *str != 0; ++str)
if (*str == '/')
++dirAlloc;
- if(dirAlloc > 0) {
+ if(dirAlloc) {
ftpc->dirs = calloc(dirAlloc, sizeof(ftpc->dirs[0]));
if(!ftpc->dirs) {
free(rawPath);
@@ -4230,7 +4231,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
curPos = slashPos + 1;
}
}
- DEBUGASSERT(ftpc->dirdepth <= dirAlloc);
+ DEBUGASSERT((size_t)ftpc->dirdepth <= dirAlloc);
fileName = curPos; /* the rest is the file name (or empty) */
}
break;
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index 40f5f3f18..eded5691c 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -205,9 +205,9 @@ CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data)
#define FTP_LP_MALFORMATED_PERM 0x01000000
-static int ftp_pl_get_permission(const char *str)
+static unsigned int ftp_pl_get_permission(const char *str)
{
- int permissions = 0;
+ unsigned int permissions = 0;
/* USER */
if(str[0] == 'r')
permissions |= 1 << 8;
diff --git a/lib/http.c b/lib/http.c
index f70405895..6037b1737 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -650,7 +650,7 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data)
if(!data->set.str[STRING_BEARER])
authmask &= (unsigned long)~CURLAUTH_BEARER;
- if(100 <= data->req.httpcode && 199 >= data->req.httpcode)
+ if(100 <= data->req.httpcode && data->req.httpcode <= 199)
/* this is a transient response code, ignore */
return CURLE_OK;
@@ -3751,7 +3751,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
result = Curl_altsvc_parse(data, data->asi,
headp + strlen("Alt-Svc:"),
id, conn->host.name,
- curlx_uitous(conn->remote_port));
+ curlx_uitous((unsigned int)conn->remote_port));
if(result)
return result;
}
diff --git a/lib/ldap.c b/lib/ldap.c
index b07334904..92006d693 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -565,8 +565,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
goto quit;
}
- result = Curl_client_write(data, CLIENTWRITE_BODY, (char *) name,
- name_len);
+ result = Curl_client_write(data, CLIENTWRITE_BODY, name, name_len);
if(result) {
FREE_ON_WINLDAP(name);
ldap_memfree(dn);
@@ -622,8 +621,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
goto quit;
}
- result = Curl_client_write(data, CLIENTWRITE_BODY,
- (char *) attr, attr_len);
+ result = Curl_client_write(data, CLIENTWRITE_BODY, attr, attr_len);
if(result) {
ldap_value_free_len(vals);
FREE_ON_WINLDAP(attr);
@@ -648,7 +646,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
dlsize += attr_len + 3;
if((attr_len > 7) &&
- (strcmp(";binary", (char *) attr + (attr_len - 7)) == 0)) {
+ (strcmp(";binary", attr + (attr_len - 7)) == 0)) {
/* Binary attribute, encode to base64. */
result = Curl_base64_encode(vals[i]->bv_val, vals[i]->bv_len,
&val_b64, &val_b64_sz);
diff --git a/lib/mime.c b/lib/mime.c
index 042141fc8..117c66f4d 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -1636,7 +1636,7 @@ static size_t slist_size(struct curl_slist *s,
static curl_off_t multipart_size(curl_mime *mime)
{
curl_off_t size;
- size_t boundarysize;
+ curl_off_t boundarysize;
curl_mimepart *part;
if(!mime)
diff --git a/lib/setopt.c b/lib/setopt.c
index 0ff9f9043..d32fdac0d 100644
--- a/lib/setopt.c
+++ b/lib/setopt.c
@@ -2205,7 +2205,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
else if(arg < READBUFFER_MIN)
arg = READBUFFER_MIN;
- data->set.buffer_size = (int)arg;
+ data->set.buffer_size = (unsigned int)arg;
break;
case CURLOPT_UPLOAD_BUFFERSIZE:
diff --git a/lib/socks.c b/lib/socks.c
index 52c29880a..52eac0990 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -566,7 +566,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
/* write the number of authentication methods */
socksreq[1] = (unsigned char) (idx - 2);
- result = Curl_write_plain(data, sockfd, (char *)socksreq, idx, &written);
+ result = Curl_write_plain(data, sockfd, socksreq, idx, &written);
if(result && (CURLE_AGAIN != result)) {
failf(data, "Unable to send initial SOCKS5 request.");
return CURLPX_SEND_CONNECT;
@@ -712,7 +712,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
}
/* FALLTHROUGH */
case CONNECT_AUTH_SEND:
- result = Curl_write_plain(data, sockfd, (char *)sx->outp,
+ result = Curl_write_plain(data, sockfd, sx->outp,
sx->outstanding, &written);
if(result && (CURLE_AGAIN != result)) {
failf(data, "Failed to send SOCKS5 sub-negotiation request.");
diff --git a/lib/telnet.c b/lib/telnet.c
index 77258736a..34f1a3419 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1200,7 +1200,7 @@ static CURLcode send_telnet_data(struct Curl_easy *data,
j = 0;
for(i = 0; i < nread; i++) {
- outbuf[j++] = buffer[i];
+ outbuf[j++] = (unsigned char)buffer[i];
if((unsigned char)buffer[i] == CURL_IAC)
outbuf[j++] = CURL_IAC;
}
diff --git a/lib/vauth/digest.c b/lib/vauth/digest.c
index 462a96fd6..c81ce1095 100644
--- a/lib/vauth/digest.c
+++ b/lib/vauth/digest.c
@@ -186,7 +186,7 @@ static char *auth_digest_string_quoted(const char *source)
}
*d++ = *s++;
}
- *d = 0;
+ *d = '\0';
}
return dest;
diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c
index 4ee4edea6..52d2eaec3 100644
--- a/lib/vtls/gskit.c
+++ b/lib/vtls/gskit.c
@@ -324,7 +324,7 @@ static CURLcode set_ciphers(struct Curl_easy *data,
GSKit tokens are always shorter than their cipher names, allocated buffers
will always be large enough to accommodate the result. */
l = strlen(cipherlist) + 1;
- memset((char *) ciphers, 0, sizeof(ciphers));
+ memset(ciphers, 0, sizeof(ciphers));
for(i = 0; i < CURL_GSKPROTO_LAST; i++) {
ciphers[i].buf = malloc(l);
if(!ciphers[i].buf) {
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index dd9d24a7c..29ff13f1c 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -1827,7 +1827,7 @@ static int ossl_shutdown(struct Curl_easy *data,
char buf[256]; /* We will use this for the OpenSSL error buffer, so it has
to be at least 256 bytes long. */
unsigned long sslerror;
- ssize_t nread;
+ int nread;
int buffsize;
int err;
bool done = FALSE;
@@ -1856,8 +1856,8 @@ static int ossl_shutdown(struct Curl_easy *data,
/* Something to read, let's do it and hope that it is the close
notify alert from the server */
- nread = (ssize_t)SSL_read(backend->handle, buf, buffsize);
- err = SSL_get_error(backend->handle, (int)nread);
+ nread = SSL_read(backend->handle, buf, buffsize);
+ err = SSL_get_error(backend->handle, nread);
switch(err) {
case SSL_ERROR_NONE: /* this is not an error */
diff --git a/packages/OS400/ccsidcurl.c b/packages/OS400/ccsidcurl.c
index da696ca2b..b7ef28cae 100644
--- a/packages/OS400/ccsidcurl.c
+++ b/packages/OS400/ccsidcurl.c
@@ -472,7 +472,7 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
memcpy((char *) id, (char *) p, sizeof(*p));
if(id->protocols) {
- int i = nproto * sizeof(id->protocols[0]);
+ i = nproto * sizeof(id->protocols[0]);
id->protocols = (const char * const *) cp;
memcpy(cp, (char *) p->protocols, i);
@@ -487,7 +487,7 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
for(i = 0; i < sizeof(charfields) / sizeof(charfields[0]); i++) {
cpp = (const char **) ((char *) p + charfields[i]);
- if (*cpp && convert_version_info_string(cpp, &cp, &n, ccsid))
+ if(*cpp && convert_version_info_string(cpp, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
}
diff --git a/packages/OS400/os400sys.c b/packages/OS400/os400sys.c
index 4219351ba..2cedc4fd7 100644
--- a/packages/OS400/os400sys.c
+++ b/packages/OS400/os400sys.c
@@ -745,7 +745,7 @@ OM_uint32
Curl_gss_import_name_a(OM_uint32 *minor_status, gss_buffer_t in_name,
gss_OID in_name_type, gss_name_t *out_name)
{
- int rc;
+ OM_uint32 rc;
unsigned int i;
gss_buffer_desc in;
@@ -859,7 +859,7 @@ Curl_gss_delete_sec_context_a(OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
gss_buffer_t output_token)
{
- int rc;
+ OM_uint32 rc;
rc = gss_delete_sec_context(minor_status, context_handle, output_token);
@@ -886,7 +886,7 @@ Curl_gss_delete_sec_context_a(OM_uint32 *minor_status,
void *
Curl_ldap_init_a(char *host, int port)
{
- unsigned int i;
+ size_t i;
char *ehost;
void *result;
diff --git a/packages/vms/curl_crtl_init.c b/packages/vms/curl_crtl_init.c
index 8b5da62d5..eedfa22a6 100644
--- a/packages/vms/curl_crtl_init.c
+++ b/packages/vms/curl_crtl_init.c
@@ -130,7 +130,7 @@ static int sys_trnlnm
status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst);
- if ($VMS_STATUS_SUCCESS(status)) {
+ if($VMS_STATUS_SUCCESS(status)) {
/* Null terminate and return the string */
/*--------------------------------------*/
@@ -192,7 +192,7 @@ static void set_feature_default(const char *name, int value)
index = decc$feature_get_index(name);
- if (index > 0)
+ if(index > 0)
decc$feature_set_value (index, 0, value);
}
#endif
@@ -205,7 +205,7 @@ static void set_features(void)
status = sys_trnlnm("GNV$UNIX_SHELL",
unix_shell_name, sizeof unix_shell_name -1);
- if (!$VMS_STATUS_SUCCESS(status)) {
+ if(!$VMS_STATUS_SUCCESS(status)) {
use_unix_settings = 0;
}
@@ -249,7 +249,7 @@ static void set_features(void)
/* Fix mv aa.bb aa */
set_feature_default ("DECC$RENAME_NO_INHERIT", ENABLE);
- if (use_unix_settings) {
+ if(use_unix_settings) {
/* POSIX requires that open files be able to be removed */
set_feature_default ("DECC$ALLOW_REMOVE_OPEN_FILES", ENABLE);
diff --git a/packages/vms/report_openssl_version.c b/packages/vms/report_openssl_version.c
index 493969616..2f5f52781 100644
--- a/packages/vms/report_openssl_version.c
+++ b/packages/vms/report_openssl_version.c
@@ -49,7 +49,7 @@ void * libptr;
const char * (*ssl_version)(int t);
const char * version;
- if (argc < 1) {
+ if(argc < 1) {
puts("report_openssl_version filename");
exit(1);
}
@@ -57,16 +57,16 @@ const char * version;
libptr = dlopen(argv[1], 0);
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLeay_version");
- if ((void *)ssl_version == NULL) {
+ if(ssl_version == NULL) {
ssl_version = (const char * (*)(int))dlsym(libptr, "ssleay_version");
- if ((void *)ssl_version == NULL) {
+ if(ssl_version == NULL) {
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLEAY_VERSION");
}
}
dlclose(libptr);
- if ((void *)ssl_version == NULL) {
+ if(ssl_version == NULL) {
puts("Unable to lookup version of OpenSSL");
exit(1);
}
@@ -76,7 +76,7 @@ const char * version;
puts(version);
/* Was a symbol argument given? */
- if (argc > 1) {
+ if(argc > 1) {
int status;
struct dsc$descriptor_s symbol_dsc;
struct dsc$descriptor_s value_dsc;
@@ -93,7 +93,7 @@ const char * version;
value_dsc.dsc$b_class = DSC$K_CLASS_S;
status = LIB$SET_SYMBOL(&symbol_dsc, &value_dsc, &table_type);
- if (!$VMS_STATUS_SUCCESS(status)) {
+ if(!$VMS_STATUS_SUCCESS(status)) {
exit(status);
}
}
diff --git a/tests/libtest/lib1542.c b/tests/libtest/lib1542.c
index 19c46b59b..5f268463c 100644
--- a/tests/libtest/lib1542.c
+++ b/tests/libtest/lib1542.c
@@ -84,5 +84,5 @@ test_cleanup:
curl_easy_cleanup(easy);
curl_global_cleanup();
- return (int)res;
+ return res;
}
diff --git a/tests/libtest/lib1568.c b/tests/libtest/lib1568.c
index 7e68b5f49..42204b0fd 100644
--- a/tests/libtest/lib1568.c
+++ b/tests/libtest/lib1568.c
@@ -40,7 +40,7 @@ int test(char *URL)
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "lib1568");
curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
- curl_easy_setopt(hnd, CURLOPT_PORT, (long)atoi(libtest_arg2));
+ curl_easy_setopt(hnd, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10));
ret = curl_easy_perform(hnd);