Commit 21aa32d3 authored by Marcel Raad's avatar Marcel Raad Committed by Daniel Stenberg
Browse files

lib: fix compiler warnings after de4de4e3

Visual C++ now complains about implicitly casting time_t (64-bit) to
long (32-bit). Fix this by changing some variables from long to time_t,
or explicitly casting to long where the public interface would be
affected.

Closes #1131
parent 0b8d682f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ struct thread_sync_data {
struct thread_data {
  curl_thread_t thread_hnd;
  unsigned int poll_interval;
  long interval_end;
  time_t interval_end;
  struct thread_sync_data tsd;
};

@@ -525,7 +525,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
  }
  else {
    /* poll for name lookup done with exponential backoff up to 250ms */
    long elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);
    time_t elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);
    if(elapsed < 0)
      elapsed = 0;

+6 −6
Original line number Diff line number Diff line
@@ -179,12 +179,12 @@ singleipconnect(struct connectdata *conn,
 *
 * @unittest: 1303
 */
long Curl_timeleft(struct Curl_easy *data,
time_t Curl_timeleft(struct Curl_easy *data,
                     struct timeval *nowp,
                     bool duringconnect)
{
  int timeout_set = 0;
  long timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;
  time_t timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;
  struct timeval now;

  /* if a timeout is set, use the most restrictive one */
@@ -722,7 +722,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
{
  struct Curl_easy *data = conn->data;
  CURLcode result = CURLE_OK;
  long allow;
  time_t allow;
  int error = 0;
  struct timeval now;
  int rc;
@@ -1153,7 +1153,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
  struct timeval before = Curl_tvnow();
  CURLcode result = CURLE_COULDNT_CONNECT;

  long timeout_ms = Curl_timeleft(data, &before, TRUE);
  time_t timeout_ms = Curl_timeleft(data, &before, TRUE);

  if(timeout_ms < 0) {
    /* a precaution, no need to continue if time already is up */
+3 −3
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ CURLcode Curl_connecthost(struct connectdata *conn,

/* generic function that returns how much time there's left to run, according
   to the timeouts set */
long Curl_timeleft(struct Curl_easy *data,
time_t Curl_timeleft(struct Curl_easy *data,
                     struct timeval *nowp,
                     bool duringconnect);

+8 −8
Original line number Diff line number Diff line
@@ -384,10 +384,10 @@ static CURLcode AcceptServerConnect(struct connectdata *conn)
 * Curl_pgrsTime(..., TIMER_STARTACCEPT);
 *
 */
static long ftp_timeleft_accept(struct Curl_easy *data)
static time_t ftp_timeleft_accept(struct Curl_easy *data)
{
  long timeout_ms = DEFAULT_ACCEPT_TIMEOUT;
  long other;
  time_t timeout_ms = DEFAULT_ACCEPT_TIMEOUT;
  time_t other;
  struct timeval now;

  if(data->set.accepttimeout > 0)
@@ -430,7 +430,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)
  struct ftp_conn *ftpc = &conn->proto.ftpc;
  struct pingpong *pp = &ftpc->pp;
  int result;
  long timeout_ms;
  time_t timeout_ms;
  ssize_t nread;
  int ftpcode;

@@ -547,7 +547,7 @@ static CURLcode InitiateTransfer(struct connectdata *conn)
static CURLcode AllowServerConnect(struct connectdata *conn, bool *connected)
{
  struct Curl_easy *data = conn->data;
  long timeout_ms;
  time_t timeout_ms;
  CURLcode result = CURLE_OK;

  *connected = FALSE;
@@ -687,8 +687,8 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
   * line in a response or continue reading.  */

  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
  long timeout;              /* timeout in milliseconds */
  long interval_ms;
  time_t timeout;              /* timeout in milliseconds */
  time_t interval_ms;
  struct Curl_easy *data = conn->data;
  CURLcode result = CURLE_OK;
  struct ftp_conn *ftpc = &conn->proto.ftpc;
@@ -3250,7 +3250,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
  ssize_t nread;
  int ftpcode;
  CURLcode result = CURLE_OK;
  char *path;
  char *path = NULL;
  const char *path_to_use = data->state.path;

  if(!ftp)
+1 −1
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ int Curl_resolv_timeout(struct connectdata *conn,
                        const char *hostname,
                        int port,
                        struct Curl_dns_entry **entry,
                        long timeoutms)
                        time_t timeoutms)
{
#ifdef USE_ALARM_TIMEOUT
#ifdef HAVE_SIGACTION
Loading