mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 16:48:49 -05:00
curl-compilers: enable -Wbad-function-cast on GCC
This warning used to be enabled only for clang as it's a bit stricter on GCC. Silence the remaining occurrences and enable it on GCC too. Closes https://github.com/curl/curl/pull/2747
This commit is contained in:
parent
d5c0351055
commit
60776a0515
@ -57,9 +57,9 @@ int main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(isdigit(*name)) {
|
else if(isdigit(*name)) {
|
||||||
curl_sslbackend id = (curl_sslbackend)atoi(name);
|
int id = atoi(name);
|
||||||
|
|
||||||
result = curl_global_sslset(id, NULL, NULL);
|
result = curl_global_sslset((curl_sslbackend)id, NULL, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = curl_global_sslset(-1, name, NULL);
|
result = curl_global_sslset(-1, name, NULL);
|
||||||
|
@ -977,6 +977,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||||||
dnl Only gcc 2.95 or later
|
dnl Only gcc 2.95 or later
|
||||||
if test "$compiler_num" -ge "295"; then
|
if test "$compiler_num" -ge "295"; then
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
|
tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -Wbad-function-cast"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
dnl Only gcc 2.96 or later
|
dnl Only gcc 2.96 or later
|
||||||
|
@ -118,10 +118,12 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
|
|||||||
|
|
||||||
int tool_ftruncate64(int fd, curl_off_t where)
|
int tool_ftruncate64(int fd, curl_off_t where)
|
||||||
{
|
{
|
||||||
|
intptr_t handle = _get_osfhandle(fd);
|
||||||
|
|
||||||
if(_lseeki64(fd, where, SEEK_SET) < 0)
|
if(_lseeki64(fd, where, SEEK_SET) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(!SetEndOfFile((HANDLE)_get_osfhandle(fd)))
|
if(!SetEndOfFile((HANDLE)handle))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -62,6 +62,7 @@ int test(char *URL)
|
|||||||
struct curl_forms formarray[3];
|
struct curl_forms formarray[3];
|
||||||
size_t formlength = 0;
|
size_t formlength = 0;
|
||||||
char flbuf[32];
|
char flbuf[32];
|
||||||
|
long contentlength = 0;
|
||||||
|
|
||||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||||
fprintf(stderr, "curl_global_init() failed\n");
|
fprintf(stderr, "curl_global_init() failed\n");
|
||||||
@ -94,11 +95,13 @@ int test(char *URL)
|
|||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentlength = (long)(strlen(data) - 1);
|
||||||
|
|
||||||
/* Use a form array for the non-copy test. */
|
/* Use a form array for the non-copy test. */
|
||||||
formarray[0].option = CURLFORM_PTRCONTENTS;
|
formarray[0].option = CURLFORM_PTRCONTENTS;
|
||||||
formarray[0].value = data;
|
formarray[0].value = data;
|
||||||
formarray[1].option = CURLFORM_CONTENTSLENGTH;
|
formarray[1].option = CURLFORM_CONTENTSLENGTH;
|
||||||
formarray[1].value = (char *) strlen(data) - 1;
|
formarray[1].value = (char *)(size_t)contentlength;
|
||||||
formarray[2].option = CURLFORM_END;
|
formarray[2].option = CURLFORM_END;
|
||||||
formarray[2].value = NULL;
|
formarray[2].value = NULL;
|
||||||
formrc = curl_formadd(&formpost,
|
formrc = curl_formadd(&formpost,
|
||||||
|
@ -782,8 +782,9 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
|
|||||||
wsa++;
|
wsa++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
curl_socket_t socket = curlx_sitosk(fds);
|
||||||
WSACloseEvent(wsaevent);
|
WSACloseEvent(wsaevent);
|
||||||
handle = (HANDLE) curlx_sitosk(fds);
|
handle = (HANDLE) socket;
|
||||||
handle = select_ws_wait(handle, waitevent);
|
handle = select_ws_wait(handle, waitevent);
|
||||||
handles[nfd] = handle;
|
handles[nfd] = handle;
|
||||||
data[thd].thread = handle;
|
data[thd].thread = handle;
|
||||||
|
Loading…
Reference in New Issue
Block a user