talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 08916bffe4b3d42199b11060a49a812a9a7817f2
parent 504dd92adc45548622126faa441b7f8523bdb869
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Thu, 24 Nov 2016 20:13:10 +0100

Fix more compile warnings for Windows in socket.c.

Diffstat:
Msrc/action.c | 5++---
Msrc/common/socket.c | 7++++---
Msrc/common/utils.c | 11++++++-----
Msrc/compose.c | 6+++++-
Msrc/ldapquery.c | 8++++++++
Msrc/ldapserver.c | 5++---
Msrc/ldaputil.c | 6+++---
Msrc/mbox.c | 2+-
Msrc/send_message.c | 2+-
Msrc/textview.c | 7++++++-
10 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/src/action.c b/src/action.c @@ -371,8 +371,6 @@ static gchar *parse_action_cmd(gchar *action, MsgInfo *msginfo, static gboolean parse_append_filename(GString *cmd, MsgInfo *msginfo) { gchar *filename; - gchar *p, *q; - gchar escape_ch[] = "\\ "; cm_return_val_if_fail(msginfo, FALSE); @@ -384,9 +382,10 @@ static gboolean parse_append_filename(GString *cmd, MsgInfo *msginfo) return FALSE; } - p = filename; g_string_append(cmd, "\""); #ifdef G_OS_UNIX + gchar *p = filename, *q; + gchar escape_ch[] = "\\ "; while ((q = strpbrk(p, "$\"`\\~")) != NULL) { escape_ch[1] = *q; *q = '\0'; diff --git a/src/common/socket.c b/src/common/socket.c @@ -720,7 +720,7 @@ static gboolean sock_connect_async_cb(GIOChannel *source, g_io_channel_unref(source); len = sizeof(val); - if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &val, &len) < 0) { + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&val, &len) < 0) { perror("getsockopt"); close(fd); sock_connect_address_list_async(conn_data); @@ -1422,8 +1422,7 @@ static gint fd_recv(gint fd, gchar *buf, gint len, gint flags) gint fd_gets(gint fd, gchar *buf, gint len) { - gchar *newline, *bp = buf; - gint n; + gchar *bp = buf; if (--len < 1) return -1; @@ -1452,6 +1451,8 @@ Single-byte send() and recv(). len--; } while (0 < len); #else /*!G_OS_WIN32*/ + gchar *newline; + gint n; do { if ((n = fd_recv(fd, bp, len, MSG_PEEK)) <= 0) return -1; diff --git a/src/common/utils.c b/src/common/utils.c @@ -89,9 +89,6 @@ #define BUFFSIZE 8192 static gboolean debug_mode = FALSE; -#ifdef G_OS_WIN32 -static GSList *tempfiles=NULL; -#endif #if !GLIB_CHECK_VERSION(2, 26, 0) guchar *g_base64_decode_wa(const gchar *text, gsize *out_len) @@ -1793,7 +1790,7 @@ const gchar *get_home_dir(void) (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, home_dir_utf16) < 0) strcpy (home_dir_utf16, "C:\\Claws Mail"); - home_dir_utf8 = g_utf16_to_utf8 ((const gunichar *)home_dir_utf16, -1, NULL, NULL, NULL); + home_dir_utf8 = g_utf16_to_utf8 ((const gunichar2 *)home_dir_utf16, -1, NULL, NULL, NULL); } return home_dir_utf8; #else @@ -5185,7 +5182,9 @@ static GSList *cm_split_path(const gchar *filename, int depth) GSList *canonical_parts = NULL; GStatBuf st; int i; +#ifndef G_OS_WIN32 gboolean follow_symlinks = TRUE; +#endif if (depth > 32) { #ifndef G_OS_WIN32 @@ -5228,7 +5227,9 @@ static GSList *cm_split_path(const gchar *filename, int depth) if(g_stat(tmp_path, &st) < 0) { if (errno == ENOENT) { errno = 0; +#ifndef G_OS_WIN32 follow_symlinks = FALSE; +#endif } if (errno != 0) { g_free(tmp_path); @@ -5393,7 +5394,7 @@ get_random_bytes(void *buf, size_t count) /* Read data from the source into buf. */ #if defined G_OS_WIN32 if (!CryptGenRandom(rnd, count, buf)) { - debug_print("Could not read %d random bytes.\n", count); + debug_print("Could not read %zd random bytes.\n", count); CryptReleaseContext(rnd, 0); return FALSE; } diff --git a/src/compose.c b/src/compose.c @@ -5671,8 +5671,12 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool privacy_system_can_sign(compose->privacy_system)) { encoding = ENC_QUOTED_PRINTABLE; } - + +#ifdef G_OS_WIN32 + debug_print("main text: %Id bytes encoded as %s in %d\n", +#else debug_print("main text: %zd bytes encoded as %s in %d\n", +#endif strlen(buf), out_codeset, encoding); /* check for line length limit */ diff --git a/src/ldapquery.c b/src/ldapquery.c @@ -821,7 +821,11 @@ static gint ldapqry_search_retrieve( LdapQuery *qry ) { } ADDRQUERY_RETVAL(qry) = LDAPRC_STOP_FLAG; +#ifdef G_OS_WIN32 + debug_print("Total results are: %lu\n", ldap_count_entries(ld, result)); +#else debug_print("Total results are: %d\n", ldap_count_entries(ld, result)); +#endif /* Process results */ first = TRUE; @@ -1217,7 +1221,11 @@ static gint ldapqry_locate_retrieve( LdapQuery *qry ) { return ADDRQUERY_RETVAL(qry); } +#ifdef G_OS_WIN32 + debug_print("Total results are: %lu\n", ldap_count_entries(ld, result)); +#else debug_print("Total results are: %d\n", ldap_count_entries(ld, result)); +#endif /* Process results */ ADDRQUERY_RETVAL(qry) = LDAPRC_STOP_FLAG; diff --git a/src/ldapserver.c b/src/ldapserver.c @@ -718,12 +718,11 @@ gint ldapsvr_read_data( LdapServer *server ) void ldapsrv_set_options (gint secs, LDAP *ld) { +#ifdef G_OS_UNIX static struct timeval timeout; - int rc; - int i; timeout.tv_sec = secs; timeout.tv_usec = 0; -#ifdef G_OS_UNIX + int i, rc; i = LDAP_OPT_X_TLS_ALLOW; rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i); if (ld) diff --git a/src/ldaputil.c b/src/ldaputil.c @@ -198,6 +198,8 @@ static GList *ldaputil_test_v2( LDAP *ld, gint tov ) { int claws_ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd ) { + debug_print("binding: DN->%s\n", dn?dn:"null"); +#ifdef G_OS_UNIX struct berval cred; if ( passwd != NULL ) { @@ -208,12 +210,10 @@ int claws_ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *pa cred.bv_len = 0; } - debug_print("binding: DN->%s\n", dn?dn:"null"); -#ifdef G_OS_UNIX return ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL ); #else - return ldap_simple_bind_s(ld, dn, passwd); + return ldap_simple_bind_s(ld, (PCHAR)dn, (PCHAR)passwd); #endif } diff --git a/src/mbox.c b/src/mbox.c @@ -429,8 +429,8 @@ gint unlock_mbox(const gchar *base, gint fd, LockType type) return 0; } else if (type == LOCK_FLOCK) { - gboolean fcntled = FALSE; #if HAVE_FCNTL_H && !defined(G_OS_WIN32) + gboolean fcntled = FALSE; struct flock fl; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; diff --git a/src/send_message.c b/src/send_message.c @@ -145,7 +145,6 @@ gint send_message_local(const gchar *command, FILE *fp) gint child_stdin; gchar buf[BUFFSIZE]; gboolean err = FALSE; - gint status; cm_return_val_if_fail(command != NULL, -1); cm_return_val_if_fail(fp != NULL, -1); @@ -190,6 +189,7 @@ gint send_message_local(const gchar *command, FILE *fp) fd_close(child_stdin); #ifndef G_OS_WIN32 + gint status; waitpid(pid, &status, 0); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) err = TRUE; diff --git a/src/textview.c b/src/textview.c @@ -1041,7 +1041,10 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo) FILE *tmpfp; gchar buf[BUFFSIZE]; CodeConverter *conv; - const gchar *charset, *p, *cmd; + const gchar *charset; +#ifndef G_OS_WIN32 + const gchar *p, *cmd; +#endif GSList *cur; gboolean continue_write = TRUE; size_t wrote = 0, i = 0; @@ -1161,7 +1164,9 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo) g_unlink(fname); #endif } else { +#ifndef G_OS_WIN32 textview_default: +#endif if (!g_ascii_strcasecmp(mimeinfo->subtype, "x-patch") || !g_ascii_strcasecmp(mimeinfo->subtype, "x-diff")) textview->is_diff = TRUE;