[Commits] [SCM] claws branch, master, updated. 3.14.1-23-g08916bf

ticho at claws-mail.org ticho at claws-mail.org
Thu Nov 24 21:03:58 CET 2016


The branch, master has been updated
       via  08916bffe4b3d42199b11060a49a812a9a7817f2 (commit)
       via  504dd92adc45548622126faa441b7f8523bdb869 (commit)
      from  0d330cb779f940d0ccc0848ca64cf8ff0c95d810 (commit)

Summary of changes:
 src/action.c             |    5 ++--
 src/common/socket.c      |    7 +++---
 src/common/utils.c       |   11 +++++----
 src/common/w32_account.c |   60 ----------------------------------------------
 src/compose.c            |    6 ++++-
 src/ldapquery.c          |    8 +++++++
 src/ldapserver.c         |    5 ++--
 src/ldaputil.c           |    6 ++---
 src/mbox.c               |    2 +-
 src/send_message.c       |    2 +-
 src/textview.c           |    7 +++++-
 11 files changed, 38 insertions(+), 81 deletions(-)


- Log -----------------------------------------------------------------
commit 08916bffe4b3d42199b11060a49a812a9a7817f2
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Nov 24 20:13:10 2016 +0100

    Fix more compile warnings for Windows in socket.c.

diff --git a/src/action.c b/src/action.c
index f5ab41b..a60a6b7 100644
--- 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
index 19fb5e7..2fc18b1 100644
--- 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
index d7d1b4c..875bbe1 100644
--- 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
index 14f81cc..21274bb 100644
--- 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
index b729d94..4ad9779 100644
--- 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
index b6ae2d4..545e7f4 100644
--- 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
index 060c82d..21e5d97 100644
--- 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
index c084602..3561053 100644
--- 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
index 376e122..1560f9d 100644
--- 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
index fa2860d..916b8d2 100644
--- 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;

commit 504dd92adc45548622126faa441b7f8523bdb869
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Nov 24 20:19:31 2016 +0100

    Removed unused w32_get_uid_equiv() function.

diff --git a/src/common/w32_account.c b/src/common/w32_account.c
index 37faa97..5bd9a0f 100644
--- a/src/common/w32_account.c
+++ b/src/common/w32_account.c
@@ -149,63 +149,3 @@ w32_is_administrator (void)
 
   return is_admin;
 }
-
-/* Vomit bags are available under your seats */
-int w32_get_uid_equiv(void)
-{
-	HANDLE Thandle;
-	DWORD size;
-	PSID sid;
-	char *sidStr = NULL;
-	char *last_sep = NULL;
-	static int siduid = -1;
-	static BOOL (WINAPI *GetTokenInformation)(
-	  HANDLE TokenHandle,
-	  TOKEN_INFORMATION_CLASS TokenInformationClass,
-	  LPVOID TokenInformation,
-	  DWORD TokenInformationLength,
-	  PDWORD ReturnLength
-	);
-	static  BOOL (WINAPI *ConvertSidToStringSid)(
-	  PSID Sid,
-	  LPTSTR *StringSid
-	);
-	static int TokenLogonSid = 28 /* according to Google. */;
-
-	if (siduid == -1) {
-		void *handle = LoadLibrary ("advapi32.dll");
-		if (handle) {
-			GetTokenInformation = GetProcAddress (handle, "GetTokenInformation");
-			if (!GetTokenInformation) {
-				FreeLibrary (handle);
-				debug_print("can't resolve GetTokenInformation\n");
-				return -1;
-			}
-		}
-
-		if (OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &Thandle) == 0
-		    && OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &Thandle) == 0) {
-			debug_print("OpenProcessToken error %d\n", GetLastError());
-			return -1;
-		}
-
-		if (GetTokenInformation(Thandle, TokenLogonSid, &sid, sizeof(sid), &size) == 0) {
-			debug_print("GetTokenInformation error %d\n", GetLastError());
-			return -1;
-		}
-		if (ConvertSidToStringSid((PSID)sid, &sidStr) == 0) {
-			debug_print("ConvertSidToStringSid error %d\n", GetLastError());
-			return -1;
-		}
-
-		debug_print("SID %s\n", sidStr);
-		last_sep = strrchr(sidStr, '-');
-		if (last_sep != NULL) {
-			last_sep++;
-			siduid = strtol(last_sep, NULL, 10);
-			debug_print("Using UID equivalent %d\n", siduid);
-		}
-		LocalFree(sidStr);
-	}
-	return siduid;
-}

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list