Skip to content

Commit

Permalink
fix a bunch of MSVC compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yangtse committed Sep 3, 2011
1 parent 2be65bb commit 6b75d2c
Show file tree
Hide file tree
Showing 41 changed files with 109 additions and 82 deletions.
6 changes: 3 additions & 3 deletions lib/asyn.h
Expand Up @@ -146,15 +146,15 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,

#ifndef CURLRES_ASYNCH
/* convert these functions if an asynch resolver isn't used */
#define Curl_resolver_cancel(x)
#define Curl_resolver_cancel(x) Curl_nop_stmt
#define Curl_resolver_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST
#define Curl_resolver_wait_resolv(x,y) CURLE_COULDNT_RESOLVE_HOST
#define Curl_resolver_getsock(x,y,z) 0
#define Curl_resolver_duphandle(x,y) CURLE_OK
#define Curl_resolver_init(x) CURLE_OK
#define Curl_resolver_global_init() CURLE_OK
#define Curl_resolver_global_cleanup()
#define Curl_resolver_cleanup(x)
#define Curl_resolver_global_cleanup() Curl_nop_stmt
#define Curl_resolver_cleanup(x) Curl_nop_stmt
#endif

#ifdef CURLRES_ASYNCH
Expand Down
2 changes: 1 addition & 1 deletion lib/connect.c
Expand Up @@ -790,7 +790,7 @@ static void nosigpipe(struct connectdata *conn,
Curl_strerror(conn, SOCKERRNO));
}
#else
#define nosigpipe(x,y)
#define nosigpipe(x,y) Curl_nop_stmt
#endif

#ifdef USE_WINSOCK
Expand Down
3 changes: 2 additions & 1 deletion lib/connect.h
Expand Up @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */

Expand Down Expand Up @@ -64,7 +65,7 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data,
*/
void Curl_sndbufset(curl_socket_t sockfd);
#else
#define Curl_sndbufset(y)
#define Curl_sndbufset(y) Curl_nop_stmt
#endif

void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd);
Expand Down
10 changes: 5 additions & 5 deletions lib/content_encoding.h
@@ -1,13 +1,13 @@
#ifndef __CURL_CONTENT_ENCODING_H
#define __CURL_CONTENT_ENCODING_H
#ifndef HEADER_CURL_CONTENT_ENCODING_H
#define HEADER_CURL_CONTENT_ENCODING_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand All @@ -32,7 +32,7 @@
void Curl_unencode_cleanup(struct connectdata *conn);
#else
#define ALL_CONTENT_ENCODINGS "identity"
#define Curl_unencode_cleanup(x)
#define Curl_unencode_cleanup(x) Curl_nop_stmt
#endif

CURLcode Curl_unencode_deflate_write(struct connectdata *conn,
Expand All @@ -45,4 +45,4 @@ Curl_unencode_gzip_write(struct connectdata *conn,
ssize_t nread);


#endif
#endif /* HEADER_CURL_CONTENT_ENCODING_H */
7 changes: 4 additions & 3 deletions lib/cookie.h
Expand Up @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

#include <curl/curl.h>

Expand Down Expand Up @@ -86,10 +87,10 @@ void Curl_cookie_clearsess(struct CookieInfo *cookies);

#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
#define Curl_cookie_list(x) NULL
#define Curl_cookie_loadfiles(x) do { } while (0)
#define Curl_cookie_loadfiles(x) Curl_nop_stmt
#define Curl_cookie_init(x,y,z,w) NULL
#define Curl_cookie_cleanup(x) do { } while (0)
#define Curl_flush_cookies(x,y)
#define Curl_cookie_cleanup(x) Curl_nop_stmt
#define Curl_flush_cookies(x,y) Curl_nop_stmt
#else
void Curl_flush_cookies(struct SessionHandle *data, int cleanup);
void Curl_cookie_cleanup(struct CookieInfo *);
Expand Down
2 changes: 1 addition & 1 deletion lib/curl_ntlm.c
Expand Up @@ -57,7 +57,7 @@
#if DEBUG_ME
# define DEBUG_OUT(x) x
#else
# define DEBUG_OUT(x)
# define DEBUG_OUT(x) Curl_nop_stmt
#endif

CURLcode Curl_input_ntlm(struct connectdata *conn,
Expand Down
2 changes: 1 addition & 1 deletion lib/curl_ntlm.h
Expand Up @@ -37,7 +37,7 @@ void Curl_http_ntlm_cleanup(struct connectdata *conn);

#else

#define Curl_http_ntlm_cleanup(a)
#define Curl_http_ntlm_cleanup(a) Curl_nop_stmt

#endif

Expand Down
2 changes: 1 addition & 1 deletion lib/curl_ntlm_msgs.c
Expand Up @@ -182,7 +182,7 @@ static void ntlm_print_hex(FILE *handle, const char *buf, size_t len)
fprintf(stderr, "%02.2x", (unsigned int)*p++);
}
#else
# define DEBUG_OUT(x)
# define DEBUG_OUT(x) Curl_nop_stmt
#endif

#ifndef USE_WINDOWS_SSPI
Expand Down
16 changes: 13 additions & 3 deletions lib/curl_ntlm_wb.c
Expand Up @@ -60,7 +60,17 @@
#if DEBUG_ME
# define DEBUG_OUT(x) x
#else
# define DEBUG_OUT(x)
# define DEBUG_OUT(x) Curl_nop_stmt
#endif

/* Portable 'sclose_nolog' used only in child process instead of 'sclose'
to avoid fooling the socket leak detector */
#if defined(HAVE_CLOSESOCKET)
# define sclose_nolog(x) closesocket((x))
#elif defined(HAVE_CLOSESOCKET_CAMEL)
# define sclose_nolog(x) CloseSocket((x))
#else
# define sclose_nolog(x) close((x))
#endif

void Curl_ntlm_wb_cleanup(struct connectdata *conn)
Expand Down Expand Up @@ -167,7 +177,7 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
*/

/* Don't use sclose in the child since it fools the socket leak detector */
close(sockfds[0]);
sclose_nolog(sockfds[0]);
if(dup2(sockfds[1], STDIN_FILENO) == -1) {
error = ERRNO;
failf(conn->data, "Could not redirect child stdin. errno %d: %s",
Expand Down Expand Up @@ -197,7 +207,7 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
NULL);

error = ERRNO;
close(sockfds[1]);
sclose_nolog(sockfds[1]);
failf(conn->data, "Could not execl(). errno %d: %s",
error, Curl_strerror(conn, error));
exit(1);
Expand Down
3 changes: 2 additions & 1 deletion lib/cyassl.h
Expand Up @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

#ifdef USE_CYASSL

Expand All @@ -45,7 +46,7 @@ CURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,

/* API setup for CyaSSL */
#define curlssl_init Curl_cyassl_init
#define curlssl_cleanup()
#define curlssl_cleanup() Curl_nop_stmt
#define curlssl_connect Curl_cyassl_connect
#define curlssl_connect_nonblocking Curl_cyassl_connect_nonblocking
#define curlssl_session_free(x) Curl_cyassl_session_free(x)
Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Expand Up @@ -104,7 +104,7 @@
#endif

#ifdef CURL_DISABLE_VERBOSE_STRINGS
#define ftp_pasv_verbose(a,b,c,d) do { } while(0)
#define ftp_pasv_verbose(a,b,c,d) Curl_nop_stmt
#endif

/* Local API functions */
Expand Down
2 changes: 1 addition & 1 deletion lib/hostip6.c
Expand Up @@ -154,7 +154,7 @@ static void dump_addrinfo(struct connectdata *conn, const Curl_addrinfo *ai)
}
}
#else
#define dump_addrinfo(x,y)
#define dump_addrinfo(x,y) Curl_nop_stmt
#endif

/*
Expand Down
9 changes: 5 additions & 4 deletions lib/http_digest.h
@@ -1,5 +1,5 @@
#ifndef __HTTP_DIGEST_H
#define __HTTP_DIGEST_H
#ifndef HEADER_CURL_HTTP_DIGEST_H
#define HEADER_CURL_HTTP_DIGEST_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
Expand All @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

typedef enum {
CURLDIGEST_NONE, /* not a digest */
Expand Down Expand Up @@ -50,7 +51,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
void Curl_digest_cleanup(struct SessionHandle *data);
#else
#define Curl_digest_cleanup(x) do {} while(0)
#define Curl_digest_cleanup(x) Curl_nop_stmt
#endif

#endif
#endif /* HEADER_CURL_HTTP_DIGEST_H */
2 changes: 1 addition & 1 deletion lib/imap.c
Expand Up @@ -335,7 +335,7 @@ static void imap_to_imaps(struct connectdata *conn)
conn->handler = &Curl_handler_imaps;
}
#else
#define imap_to_imaps(x)
#define imap_to_imaps(x) Curl_nop_stmt
#endif

/* for STARTTLS responses */
Expand Down
2 changes: 1 addition & 1 deletion lib/krb5.c
Expand Up @@ -190,7 +190,7 @@ krb5_auth(void *app_data, struct connectdata *conn)
chan.application_data.value = NULL;

/* this loop will execute twice (once for service, once for host) */
while(1) {
for(;;) {
/* this really shouldn't be repeated here, but can't help it */
if(service == srv_host) {
result = Curl_ftpsendf(conn, "AUTH GSSAPI");
Expand Down
4 changes: 2 additions & 2 deletions lib/ldap.c
Expand Up @@ -105,11 +105,11 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp);
#define LDAP_TRACE(x) do { \
_ldap_trace ("%u: ", __LINE__); \
_ldap_trace x; \
} while(0)
} WHILE_FALSE

static void _ldap_trace (const char *fmt, ...);
#else
#define LDAP_TRACE(x) ((void)0)
#define LDAP_TRACE(x) Curl_nop_stmt
#endif


Expand Down
6 changes: 3 additions & 3 deletions lib/memdebug.c
Expand Up @@ -42,7 +42,7 @@
#include "memdebug.h"

#ifndef HAVE_ASSERT_H
# define assert(x) do { } while (0)
# define assert(x) Curl_nop_stmt
#endif

/*
Expand Down Expand Up @@ -82,13 +82,13 @@
#ifdef CURL_MT_MALLOC_FILL
# define mt_malloc_fill(buf,len) memset((buf), CURL_MT_MALLOC_FILL, (len))
#else
# define mt_malloc_fill(buf,len)
# define mt_malloc_fill(buf,len) Curl_nop_stmt
#endif

#ifdef CURL_MT_FREE_FILL
# define mt_free_fill(buf,len) memset((buf), CURL_MT_FREE_FILL, (len))
#else
# define mt_free_fill(buf,len)
# define mt_free_fill(buf,len) Curl_nop_stmt
#endif

struct memdebug {
Expand Down
2 changes: 1 addition & 1 deletion lib/memdebug.h
Expand Up @@ -146,7 +146,7 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
*/

#ifndef fake_sclose
#define fake_sclose(x) do { } WHILE_FALSE
#define fake_sclose(x) Curl_nop_stmt
#endif

/*
Expand Down
6 changes: 3 additions & 3 deletions lib/non-ascii.h
Expand Up @@ -51,9 +51,9 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
CURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form);
#else
#define Curl_convert_clone(a,b,c,d) ((void)a, CURLE_OK)
#define Curl_convert_init(x)
#define Curl_convert_setup(x)
#define Curl_convert_close(x)
#define Curl_convert_init(x) Curl_nop_stmt
#define Curl_convert_setup(x) Curl_nop_stmt
#define Curl_convert_close(x) Curl_nop_stmt
#define Curl_convert_to_network(a,b,c) ((void)a, CURLE_OK)
#define Curl_convert_from_network(a,b,c) ((void)a, CURLE_OK)
#define Curl_convert_from_utf8(a,b,c) ((void)a, CURLE_OK)
Expand Down
2 changes: 1 addition & 1 deletion lib/nss.c
Expand Up @@ -92,7 +92,7 @@ typedef struct {
ptr->type = (_type); \
ptr->pValue = (_val); \
ptr->ulValueLen = (_len); \
} while(0)
} WHILE_FALSE

#define CERT_NewTempCertificate __CERT_NewTempCertificate

Expand Down
3 changes: 2 additions & 1 deletion lib/nssg.h
Expand Up @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

#ifdef USE_NSS
/*
Expand Down Expand Up @@ -56,7 +57,7 @@ CURLcode Curl_nss_force_init(struct SessionHandle *data);
#define curlssl_connect Curl_nss_connect

/* NSS has its own session ID cache */
#define curlssl_session_free(x)
#define curlssl_session_free(x) Curl_nop_stmt
#define curlssl_close_all Curl_nss_close_all
#define curlssl_close Curl_nss_close
/* NSS has no shutdown function provided and thus always fail */
Expand Down
3 changes: 2 additions & 1 deletion lib/polarssl.h
Expand Up @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

#ifdef USE_POLARSSL

Expand All @@ -39,7 +40,7 @@ int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex);

/* API setup for PolarSSL */
#define curlssl_init() (1)
#define curlssl_cleanup()
#define curlssl_cleanup() Curl_nop_stmt
#define curlssl_connect Curl_polarssl_connect
#define curlssl_session_free(x) Curl_polarssl_session_free(x)
#define curlssl_close_all Curl_polarssl_close_all
Expand Down
2 changes: 1 addition & 1 deletion lib/pop3.c
Expand Up @@ -280,7 +280,7 @@ static void pop3_to_pop3s(struct connectdata *conn)
conn->handler = &Curl_handler_pop3s;
}
#else
#define pop3_to_pop3s(x)
#define pop3_to_pop3s(x) Curl_nop_stmt
#endif

/* for STARTTLS responses */
Expand Down
10 changes: 6 additions & 4 deletions lib/qssl.h
@@ -1,5 +1,5 @@
#ifndef __QSSL_H
#define __QSSL_H
#ifndef HEADER_CURL_QSSL_H
#define HEADER_CURL_QSSL_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
Expand All @@ -21,6 +21,7 @@
* KIND, either express or implied.
*
***************************************************************************/
#include "setup.h"

/*
* This header should only be needed to get included by sslgen.c and qssl.c
Expand All @@ -45,7 +46,7 @@ int Curl_qsossl_check_cxn(struct connectdata * cxn);
#define curlssl_connect Curl_qsossl_connect

/* No session handling for QsoSSL */
#define curlssl_session_free(x)
#define curlssl_session_free(x) Curl_nop_stmt
#define curlssl_close_all Curl_qsossl_close_all
#define curlssl_close Curl_qsossl_close
#define curlssl_shutdown(x,y) Curl_qsossl_shutdown(x,y)
Expand All @@ -56,4 +57,5 @@ int Curl_qsossl_check_cxn(struct connectdata * cxn);
#define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x)
#define curlssl_data_pending(x,y) 0
#endif /* USE_QSOSSL */
#endif

#endif /* HEADER_CURL_QSSL_H */
2 changes: 1 addition & 1 deletion lib/select.c
Expand Up @@ -49,7 +49,7 @@
/* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1] */

#if defined(USE_WINSOCK) || defined(TPF)
#define VERIFY_SOCK(x) do { } WHILE_FALSE
#define VERIFY_SOCK(x) Curl_nop_stmt
#else
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
#define VERIFY_SOCK(x) do { \
Expand Down

0 comments on commit 6b75d2c

Please sign in to comment.