/soc/2013/ankitkv/gobjectification: b5b9c75a4b54: Merged default...

Ankit Vani a at nevitus.org
Fri May 23 17:08:00 EDT 2014


Changeset: b5b9c75a4b5422d9eba793778ceff48744b5f458
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-05-20 10:36 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b5b9c75a4b54

Description:

Merged default branch

diffstat:

 libpurple/connection.c                       |    3 +-
 libpurple/http.c                             |    7 +-
 libpurple/image.c                            |    2 +-
 libpurple/marshallers.list                   |    1 +
 libpurple/ntlm.c                             |    5 +-
 libpurple/plugins/ciphertest.c               |    5 -
 libpurple/plugins/keyrings/internalkeyring.c |    1 +
 libpurple/plugins/tcl/tcl_cmds.c             |    1 +
 libpurple/prefs.c                            |    6 +-
 libpurple/protocols.h                        |    3 -
 libpurple/protocols/bonjour/bonjour.c        |    3 +-
 libpurple/protocols/gg/gg.c                  |    1 -
 libpurple/protocols/gg/utils.c               |    3 +-
 libpurple/protocols/irc/irc.c                |    3 +-
 libpurple/protocols/jabber/auth.c            |    5 +-
 libpurple/protocols/jabber/jabber.c          |    4 +-
 libpurple/protocols/msn/msn.c                |   11 +-
 libpurple/protocols/msn/nexus.c              |    6 +-
 libpurple/protocols/msn/notification.c       |    5 +-
 libpurple/protocols/mxit/filexfer.c          |    5 +-
 libpurple/protocols/mxit/mxit.c              |    2 +-
 libpurple/protocols/novell/novell.c          |    2 +
 libpurple/protocols/null/nullprpl.c          |    2 +
 libpurple/protocols/oscar/oscar.c            |    3 +-
 libpurple/protocols/sametime/sametime.c      |    3 +-
 libpurple/protocols/silc/silc.c              |    2 +-
 libpurple/protocols/simple/simple.c          |    4 +
 libpurple/protocols/yahoo/util.c             |    7 +-
 libpurple/protocols/yahoo/yahoo_profile.c    |    2 +-
 libpurple/protocols/yahoo/ymsg.c             |    5 +-
 libpurple/protocols/zephyr/zephyr.c          |    4 +-
 libpurple/proxy.c                            |    5 +
 libpurple/request.c                          |    6 +-
 libpurple/tests/test_util.c                  |    2 +-
 libpurple/util.c                             |   42 +-
 pidgin/gtkconv.c                             |   17 +-
 pidgin/gtksmiley-theme.c                     |    8 +-
 pidgin/gtkutils.c                            |    2 +-
 pidgin/gtkwebview.c                          |   27 +
 pidgin/gtkwebview.h                          |    1 +
 pidgin/plugins/Makefile.am                   |    6 +
 pidgin/plugins/gevolution/gevolution.c       |    5 +-
 pidgin/plugins/imgupload.c                   |  483 +++++++++++++++++++++++++++
 pidgin/plugins/screencap.c                   |   12 +
 44 files changed, 663 insertions(+), 69 deletions(-)

diffs (truncated from 1444 to 300 lines):

diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -261,7 +261,8 @@ purple_connection_set_flags(PurpleConnec
 
 	priv->flags = flags;
 
-	g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_FLAGS]);
+	if (!priv->is_finalizing)
+		g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_FLAGS]);
 }
 
 void
diff --git a/libpurple/http.c b/libpurple/http.c
--- a/libpurple/http.c
+++ b/libpurple/http.c
@@ -1944,6 +1944,7 @@ static void purple_http_cookie_jar_parse
 					"Invalid cookie: [%s]\n", cookie);
 			else
 				purple_debug_warning("http", "Invalid cookie.");
+			continue;
 		}
 
 		name = g_strndup(cookie, eqsign - cookie);
@@ -1955,7 +1956,7 @@ static void purple_http_cookie_jar_parse
 
 		if (semicolon != NULL) {
 			GMatchInfo *match_info;
-			GRegex *re_expires = g_regex_new(
+			GRegex *re_expires = g_regex_new( /* XXX: make it static */
 				"expires=([a-z0-9, :]+)",
 				G_REGEX_OPTIMIZE | G_REGEX_CASELESS,
 				G_REGEX_MATCH_NOTEMPTY, NULL);
@@ -2884,7 +2885,7 @@ purple_http_url_parse(const char *raw_ur
 	url->fragment = g_match_info_fetch(match_info, 4);
 	g_match_info_free(match_info);
 
-	if (url->protocol[0] == '\0') {
+	if (g_strcmp0(url->protocol, "") == 0) {
 		g_free(url->protocol);
 		url->protocol = NULL;
 	} else if (url->protocol != NULL) {
@@ -2939,7 +2940,7 @@ purple_http_url_parse(const char *raw_ur
 			g_free(url->password);
 			url->password = NULL;
 		}
-		if (url->host[0] == '\0') {
+		if (g_strcmp0(url->host, "") == 0) {
 			g_free(url->host);
 			url->host = NULL;
 		} else if (url->host != NULL) {
diff --git a/libpurple/image.c b/libpurple/image.c
--- a/libpurple/image.c
+++ b/libpurple/image.c
@@ -135,7 +135,7 @@ fill_data(PurpleImage *image)
 		return;
 
 	g_return_if_fail(priv->path);
-	g_file_get_contents(priv->path, &contents, &length, &error);
+	(void)g_file_get_contents(priv->path, &contents, &length, &error);
 	if (error) {
 		purple_debug_error("image", "failed to read '%s' image: %s",
 			priv->path, error->message);
diff --git a/libpurple/marshallers.list b/libpurple/marshallers.list
--- a/libpurple/marshallers.list
+++ b/libpurple/marshallers.list
@@ -6,3 +6,4 @@ VOID:ENUM,STRING,STRING
 VOID:ENUM,STRING,STRING,BOOLEAN
 VOID:FLAGS,FLAGS
 VOID:STRING,STRING,OBJECT,OBJECT
+BOOLEAN:OBJECT
diff --git a/libpurple/ntlm.c b/libpurple/ntlm.c
--- a/libpurple/ntlm.c
+++ b/libpurple/ntlm.c
@@ -193,10 +193,12 @@ static void
 des_ecb_encrypt(const guint8 *plaintext, guint8 *result, const guint8 *key)
 {
 	PurpleCipher *cipher;
+	gssize encsiz;
 
 	cipher = purple_des_cipher_new();
 	purple_cipher_set_key(cipher, key, 8);
-	purple_cipher_encrypt(cipher, plaintext, 8, result, 8);
+	encsiz = purple_cipher_encrypt(cipher, plaintext, 8, result, 8);
+	g_warn_if_fail(encsiz == 8);
 	g_object_unref(cipher);
 }
 
@@ -246,6 +248,7 @@ gensesskey(char *buffer)
 					G_GSSIZE_FORMAT ".  Falling back to "
 					"inferior method\n", (gssize)red);
 		}
+		close(fd);
 	} else {
 		purple_debug_warning("ntlm", "Error opening /dev/urandom: %s."
 				"  Falling back to inferior method.\n", g_strerror(errno));
diff --git a/libpurple/plugins/ciphertest.c b/libpurple/plugins/ciphertest.c
--- a/libpurple/plugins/ciphertest.c
+++ b/libpurple/plugins/ciphertest.c
@@ -422,11 +422,6 @@ cipher_test_pbkdf2(void)
 		skip_nss = TRUE;
 #endif
 
-		if (!ret) {
-			purple_debug_info("cipher-test", "\tnss test failed\n");
-			fail = TRUE;
-		}
-
 		purple_debug_info("cipher-test", "\tGot:          %s\n", digest);
 		if (digest_nss)
 			purple_debug_info("cipher-test", "\tGot from NSS: %s\n", digest_nss);
diff --git a/libpurple/plugins/keyrings/internalkeyring.c b/libpurple/plugins/keyrings/internalkeyring.c
--- a/libpurple/plugins/keyrings/internalkeyring.c
+++ b/libpurple/plugins/keyrings/internalkeyring.c
@@ -339,6 +339,7 @@ intkeyring_decrypt(intkeyring_buff_t *ke
 		memset(plaintext, 0, sizeof(plaintext));
 		return NULL;
 	}
+	g_assert(plaintext_len > 0);
 
 	text_len = plaintext_len - verify_len;
 	ret = g_new(gchar, text_len + 1);
diff --git a/libpurple/plugins/tcl/tcl_cmds.c b/libpurple/plugins/tcl/tcl_cmds.c
--- a/libpurple/plugins/tcl/tcl_cmds.c
+++ b/libpurple/plugins/tcl/tcl_cmds.c
@@ -875,6 +875,7 @@ int tcl_cmd_conversation(ClientData unus
 			break;
 		}
 		purple_conversation_write_message(convo, from, what, flags, time(NULL));
+		break;
 	case CMD_CONV_NAME:
 		if (objc != 3) {
 			Tcl_WrongNumArgs(interp, 2, objv, "conversation");
diff --git a/libpurple/prefs.c b/libpurple/prefs.c
--- a/libpurple/prefs.c
+++ b/libpurple/prefs.c
@@ -396,8 +396,11 @@ purple_prefs_load()
 
 		error = NULL;
 
+#ifndef __COVERITY__
+		/* coverity dead_error_line false positive */
 		if (sysconfdir == NULL)
 			sysconfdir = "";
+#endif
 		filename = g_build_filename(sysconfdir, "purple", "prefs.xml", NULL);
 
 		purple_debug_info("prefs", "Reading %s\n", filename);
@@ -567,8 +570,7 @@ add_pref(PurplePrefType type, const char
 
 	parent = find_pref_parent(name);
 
-	if(!parent)
-		return NULL;
+	g_return_val_if_fail(parent, NULL);
 
 	my_name = get_path_basename(name);
 
diff --git a/libpurple/protocols.h b/libpurple/protocols.h
--- a/libpurple/protocols.h
+++ b/libpurple/protocols.h
@@ -78,8 +78,6 @@ typedef struct _PurpleProtocolChatEntry 
  *           password prompt.
  * @OPT_PROTO_MAIL_CHECK: Notify on new mail.<sbr/>
  *           MSN and Yahoo notify you when you have new mail.
- * @OPT_PROTO_IM_IMAGE: Images in IMs.<sbr/>
- *           Oscar lets you send images in direct IMs.
  * @OPT_PROTO_PASSWORD_OPTIONAL: Allow passwords to be optional.<sbr/>
  *           Passwords in IRC are optional, and are needed for certain
  *           functionality.
@@ -113,7 +111,6 @@ typedef enum  /*< flags >*/
 	OPT_PROTO_CHAT_TOPIC                    = 0x00000008,
 	OPT_PROTO_NO_PASSWORD                   = 0x00000010,
 	OPT_PROTO_MAIL_CHECK                    = 0x00000020,
-	OPT_PROTO_IM_IMAGE                      = 0x00000040,
 	OPT_PROTO_PASSWORD_OPTIONAL             = 0x00000080,
 	OPT_PROTO_USE_POINTSIZE                 = 0x00000100,
 	OPT_PROTO_REGISTER_NOSCREENNAME         = 0x00000200,
diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c
--- a/libpurple/protocols/bonjour/bonjour.c
+++ b/libpurple/protocols/bonjour/bonjour.c
@@ -106,7 +106,8 @@ bonjour_login(PurpleAccount *account)
 	}
 #endif /* _WIN32 */
 
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 	bd = g_new0(BonjourData, 1);
 	purple_connection_set_protocol_data(gc, bd);
 
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -985,7 +985,6 @@ ggp_protocol_init(PurpleProtocol *protoc
 
 	protocol->id        = "prpl-gg";
 	protocol->name      = "Gadu-Gadu";
-	protocol->options   = OPT_PROTO_IM_IMAGE;
 	protocol->icon_spec = purple_buddy_icon_spec_new("png",
 	                                                 1, 1, 200, 200, 0,
 	                                                 PURPLE_ICON_SCALE_DISPLAY |
diff --git a/libpurple/protocols/gg/utils.c b/libpurple/protocols/gg/utils.c
--- a/libpurple/protocols/gg/utils.c
+++ b/libpurple/protocols/gg/utils.c
@@ -111,10 +111,11 @@ gboolean ggp_password_validate(const gch
 
 gchar * ggp_utf8_strndup(const gchar *str, gsize n)
 {
-	size_t raw_len = strlen(str);
+	size_t raw_len;
 	gchar *end_ptr;
 	if (str == NULL)
 		return NULL;
+	raw_len = strlen(str);
 	if (raw_len <= n)
 		return g_strdup(str);
 
diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c
--- a/libpurple/protocols/irc/irc.c
+++ b/libpurple/protocols/irc/irc.c
@@ -337,7 +337,8 @@ static void irc_login(PurpleAccount *acc
 	const char *username = purple_account_get_username(account);
 
 	gc = purple_account_get_connection(account);
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_NEWLINES);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_NEWLINES |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
 		purple_connection_error (gc,
diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c
--- a/libpurple/protocols/jabber/auth.c
+++ b/libpurple/protocols/jabber/auth.c
@@ -282,6 +282,7 @@ static void auth_old_cb(JabberStream *js
 			gchar digest[33];
 			PurpleCipher *hmac;
 			PurpleHash *md5;
+			gssize diglen;
 
 			/* Calculate the MHAC-MD5 digest */
 			md5 = purple_md5_hash_new();
@@ -289,10 +290,12 @@ static void auth_old_cb(JabberStream *js
 			challenge = purple_xmlnode_get_attrib(x, "challenge");
 			purple_cipher_set_key(hmac, (guchar *)pw, strlen(pw));
 			purple_cipher_append(hmac, (guchar *)challenge, strlen(challenge));
-			purple_cipher_digest_to_str(hmac, digest, 33);
+			diglen = purple_cipher_digest_to_str(hmac, digest, 33);
 			g_object_unref(hmac);
 			g_object_unref(md5);
 
+			g_return_if_fail(diglen > 0);
+
 			/* Create the response query */
 			iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth");
 			query = purple_xmlnode_get_child(iq->node, "query");
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -1096,7 +1096,9 @@ jabber_login(PurpleAccount *account)
 	JabberStream *js;
 	PurpleImage *image;
 
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 	js = jabber_stream_new(account);
 	if (js == NULL)
 		return;
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c
+++ b/libpurple/protocols/msn/msn.c
@@ -1361,9 +1361,14 @@ msn_login(PurpleAccount *account)
 	session = msn_session_new(account);
 
 	purple_connection_set_protocol_data(gc, session);
-	purple_connection_set_flags(gc, 
-		PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_FORMATTING_WBFO | PURPLE_CONNECTION_FLAG_NO_BGCOLOR |
-		PURPLE_CONNECTION_FLAG_NO_FONTSIZE | PURPLE_CONNECTION_FLAG_NO_URLDESC | PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY);
+	purple_connection_set_flags(gc,
+		PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_FORMATTING_WBFO |
+		PURPLE_CONNECTION_FLAG_NO_BGCOLOR |
+		PURPLE_CONNECTION_FLAG_NO_FONTSIZE |
+		PURPLE_CONNECTION_FLAG_NO_URLDESC |
+		PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c
--- a/libpurple/protocols/msn/nexus.c
+++ b/libpurple/protocols/msn/nexus.c
@@ -146,6 +146,7 @@ des3_cbc(const char *key, const char *iv
 {
 	PurpleCipher *des3;
 	char *out;
+	gssize ciph_size;
 



More information about the Commits mailing list