/pidgin/main: faf0414a8b51: Fix most of libpurple warnings about...
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Wed Aug 21 08:59:40 EDT 2013
Changeset: faf0414a8b51c5509601c40a556e21a8ec316ba5
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2013-08-21 14:59 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/faf0414a8b51
Description:
Fix most of libpurple warnings about -Wsign-compare
diffstat:
finch/gntaccount.c | 3 +-
libpurple/account.c | 6 ++--
libpurple/account.h | 2 +-
libpurple/ciphers/aes.c | 4 +-
libpurple/ciphers/des.c | 42 ++++++++++++++++------------
libpurple/ciphers/gchecksum.c | 5 ++-
libpurple/ciphers/hmac.c | 2 +-
libpurple/ciphers/pbkdf2.c | 2 +-
libpurple/media/backend-fs2.c | 2 +-
libpurple/plugins/joinpart.c | 2 +-
libpurple/plugins/keyrings/internalkeyring.c | 2 +-
libpurple/plugins/perl/perl-handlers.h | 4 +-
libpurple/plugins/signals-test.c | 2 +-
libpurple/plugins/ssl/ssl-gnutls.c | 4 +-
libpurple/plugins/tcl/tcl_purple.h | 2 +-
libpurple/plugins/tcl/tcl_ref.c | 4 +-
libpurple/protocols/gg/account.h | 2 +-
libpurple/protocols/gg/libgadu-events.c | 4 +-
libpurple/protocols/gg/pubdir-prpl.c | 5 ++-
libpurple/protocols/gg/utils.c | 4 +-
libpurple/protocols/gg/utils.h | 2 +-
libpurple/protocols/irc/parse.c | 2 +-
libpurple/protocols/jabber/auth_scram.c | 2 +-
libpurple/protocols/jabber/jabber.c | 2 +-
libpurple/protocols/jabber/jutil.c | 10 +++---
libpurple/protocols/jabber/presence.c | 2 +-
libpurple/protocols/jabber/si.c | 8 ++--
libpurple/protocols/msn/command.c | 2 +-
libpurple/protocols/msn/command.h | 2 +-
libpurple/protocols/msn/directconn.c | 6 ++--
libpurple/protocols/msn/history.c | 2 +-
libpurple/protocols/msn/nexus.c | 8 ++--
libpurple/protocols/msn/nexus.h | 2 +-
libpurple/protocols/msn/notification.c | 4 +-
libpurple/protocols/msn/p2p.c | 4 ++-
libpurple/protocols/msn/servconn.c | 7 +++-
libpurple/protocols/msn/slplink.c | 4 +-
libpurple/protocols/msn/slpmsg.h | 2 +-
libpurple/protocols/msn/slpmsg_part.c | 2 +-
libpurple/protocols/msn/tlv.c | 2 +-
libpurple/protocols/msn/transaction.c | 2 +-
libpurple/protocols/msn/transaction.h | 2 +-
libpurple/protocols/myspace/myspace.c | 8 +++--
libpurple/protocols/myspace/persist.h | 4 +-
libpurple/protocols/myspace/user.c | 6 ++--
libpurple/protocols/novell/nmrtf.c | 2 +-
libpurple/protocols/oscar/bstream.c | 7 +++-
libpurple/protocols/oscar/family_feedbag.c | 2 +-
libpurple/protocols/oscar/oscar.c | 2 +-
libpurple/protocols/oscar/oscar.h | 8 ++--
libpurple/protocols/oscar/tlv.c | 6 ++--
libpurple/protocols/oscar/util.c | 2 +-
libpurple/protocols/silc/buddy.c | 2 +-
libpurple/protocols/silc/chat.c | 22 +++++++-------
libpurple/protocols/silc/ops.c | 2 +-
libpurple/protocols/silc/pk.c | 2 +-
libpurple/protocols/yahoo/libymsg.c | 4 ++-
libpurple/protocols/yahoo/libymsg.h | 2 +-
libpurple/protocols/yahoo/util.c | 4 +-
libpurple/protocols/yahoo/yahoo_packet.c | 4 +-
libpurple/protocols/yahoo/yahoo_packet.h | 2 +-
libpurple/protocols/yahoo/ycht.c | 2 +-
libpurple/protocols/zephyr/ZReadAscii.c | 2 +-
libpurple/protocols/zephyr/ZVariables.c | 2 +-
libpurple/protocols/zephyr/Zinternal.c | 4 +-
libpurple/protocols/zephyr/internal.h | 2 +-
libpurple/protocols/zephyr/zephyr.c | 6 +--
libpurple/purple-client.c | 4 +-
libpurple/stun.c | 10 +++---
libpurple/upnp.c | 10 +++---
libpurple/util.c | 24 ++++++++-------
libpurple/xmlnode.c | 4 +-
pidgin/gtkaccount.c | 3 +-
73 files changed, 184 insertions(+), 162 deletions(-)
diffs (truncated from 1603 to 300 lines):
diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -765,7 +765,8 @@ account_list_key_pressed_cb(GntWidget *w
count = g_list_length(accounts);
pos = g_list_index(accounts, account);
pos = (move + pos + count + 1) % (count + 1);
- purple_accounts_reorder(account, pos);
+ if (pos >= 0)
+ purple_accounts_reorder(account, pos);
/* I don't like this, but recreating the entire list seems to be
* the easiest way of doing it */
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -3037,7 +3037,7 @@ purple_accounts_delete(PurpleAccount *ac
}
void
-purple_accounts_reorder(PurpleAccount *account, gint new_index)
+purple_accounts_reorder(PurpleAccount *account, guint new_index)
{
gint index;
GList *l;
@@ -3047,7 +3047,7 @@ purple_accounts_reorder(PurpleAccount *a
index = g_list_index(accounts, account);
- if (index == -1) {
+ if (index < 0) {
purple_debug_error("account",
"Unregistered account (%s) discovered during reorder!\n",
purple_account_get_username(account));
@@ -3056,7 +3056,7 @@ purple_accounts_reorder(PurpleAccount *a
l = g_list_nth(accounts, index);
- if (new_index > index)
+ if (new_index > (guint)index)
new_index--;
/* Remove the old one. */
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -1118,7 +1118,7 @@ void purple_accounts_delete(PurpleAccoun
* @param account The account to reorder.
* @param new_index The new index for the account.
*/
-void purple_accounts_reorder(PurpleAccount *account, gint new_index);
+void purple_accounts_reorder(PurpleAccount *account, guint new_index);
/**
* Returns a list of all accounts.
diff --git a/libpurple/ciphers/aes.c b/libpurple/ciphers/aes.c
--- a/libpurple/ciphers/aes.c
+++ b/libpurple/ciphers/aes.c
@@ -162,14 +162,14 @@ purple_aes_pad_pkcs7(const guchar input[
static ssize_t
purple_aes_unpad_pkcs7(guchar input[], size_t in_len)
{
- int padding_len, i;
+ guchar padding_len, i;
size_t out_len;
g_return_val_if_fail(input != NULL, -1);
g_return_val_if_fail(in_len > 0, -1);
padding_len = input[in_len - 1];
- if (padding_len <= 0 || padding_len > PURPLE_AES_BLOCK_SIZE ||
+ if (padding_len == 0 || padding_len > PURPLE_AES_BLOCK_SIZE ||
padding_len > in_len) {
purple_debug_warning("cipher-aes",
"Invalid padding length: %d (total %" G_GSIZE_FORMAT ") - "
diff --git a/libpurple/ciphers/des.c b/libpurple/ciphers/des.c
--- a/libpurple/ciphers/des.c
+++ b/libpurple/ciphers/des.c
@@ -393,11 +393,11 @@ static ssize_t
des_encrypt(PurpleCipherContext *context, const guchar input[], size_t in_len,
guchar output[], size_t out_size)
{
- int offset = 0;
+ gsize offset = 0;
int i = 0;
- int tmp;
+ gsize tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
- ssize_t out_len;
+ gsize out_len;
g_return_val_if_fail(out_size >= in_len, -1);
@@ -410,6 +410,7 @@ des_encrypt(PurpleCipherContext *context
}
out_len = in_len;
if(offset<in_len) {
+ g_return_val_if_fail(in_len >= offset, -1);
out_len += in_len - offset;
g_return_val_if_fail(out_size >= out_len, -1);
tmp = offset;
@@ -429,11 +430,11 @@ static ssize_t
des_decrypt(PurpleCipherContext *context, const guchar input[], size_t in_len,
guchar output[], size_t out_size)
{
- int offset = 0;
+ gsize offset = 0;
int i = 0;
- int tmp;
+ gsize tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
- ssize_t out_len;
+ gsize out_len;
g_return_val_if_fail(out_size >= in_len, -1);
@@ -446,6 +447,7 @@ des_decrypt(PurpleCipherContext *context
}
out_len = in_len;
if(offset<in_len) {
+ g_return_val_if_fail(in_len >= offset, -1);
out_len += in_len - offset;
g_return_val_if_fail(out_size >= out_len, -1);
tmp = offset;
@@ -556,11 +558,11 @@ static ssize_t
des3_ecb_encrypt(struct _des3_ctx *ctx, const guchar input[], size_t in_len,
guchar output[], size_t out_size)
{
- int offset = 0;
+ gsize offset = 0;
int i = 0;
- int tmp;
+ gsize tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
- ssize_t out_len;
+ gsize out_len;
g_return_val_if_fail(out_size >= in_len, -1);
@@ -581,6 +583,7 @@ des3_ecb_encrypt(struct _des3_ctx *ctx,
}
out_len = in_len;
if (offset < in_len) {
+ g_return_val_if_fail(in_len >= offset, -1);
out_len += in_len - offset;
g_return_val_if_fail(out_size >= out_len, -1);
tmp = offset;
@@ -609,11 +612,11 @@ static ssize_t
des3_cbc_encrypt(struct _des3_ctx *ctx, const guchar input[], size_t in_len,
guchar output[], size_t out_size)
{
- int offset = 0;
+ gsize offset = 0;
int i = 0;
- int tmp;
+ gsize tmp;
guint8 buf[8];
- ssize_t out_len;
+ gsize out_len;
memcpy(buf, ctx->iv, 8);
g_return_val_if_fail(out_size >= in_len, -1);
@@ -639,6 +642,7 @@ des3_cbc_encrypt(struct _des3_ctx *ctx,
}
out_len = in_len;
if (offset < in_len) {
+ g_return_val_if_fail(in_len >= offset, -1);
out_len += in_len - offset;
g_return_val_if_fail(out_size >= out_len, -1);
tmp = offset;
@@ -684,11 +688,11 @@ static ssize_t
des3_ecb_decrypt(struct _des3_ctx *ctx, const guchar input[], size_t in_len,
guchar output[], size_t out_size)
{
- int offset = 0;
+ gsize offset = 0;
int i = 0;
- int tmp;
+ gsize tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
- ssize_t out_len;
+ gsize out_len;
g_return_val_if_fail(out_size >= in_len, -1);
@@ -710,6 +714,7 @@ des3_ecb_decrypt(struct _des3_ctx *ctx,
}
out_len = in_len;
if (offset < in_len) {
+ g_return_val_if_fail(in_len >= offset, -1);
out_len += in_len - offset;
g_return_val_if_fail(out_size >= out_len, -1);
tmp = offset;
@@ -738,12 +743,12 @@ static ssize_t
des3_cbc_decrypt(struct _des3_ctx *ctx, const guchar input[], size_t in_len,
guchar output[], size_t out_size)
{
- int offset = 0;
+ gsize offset = 0;
int i = 0;
- int tmp;
+ gsize tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
guint8 link[8];
- ssize_t out_len;
+ gsize out_len;
g_return_val_if_fail(out_size >= in_len, -1);
@@ -768,6 +773,7 @@ des3_cbc_decrypt(struct _des3_ctx *ctx,
}
out_len = in_len;
if(offset<in_len) {
+ g_return_val_if_fail(in_len >= offset, -1);
out_len += in_len - offset;
g_return_val_if_fail(out_size >= out_len, -1);
tmp = offset;
diff --git a/libpurple/ciphers/gchecksum.c b/libpurple/ciphers/gchecksum.c
--- a/libpurple/ciphers/gchecksum.c
+++ b/libpurple/ciphers/gchecksum.c
@@ -62,12 +62,13 @@ purple_g_checksum_digest(PurpleCipherCon
checksum = purple_cipher_context_get_data(context);
- g_return_val_if_fail(buff_len >= required_len, FALSE);
+ g_return_val_if_fail(required_len >= 0, FALSE);
+ g_return_val_if_fail(buff_len >= (gsize)required_len, FALSE);
g_return_val_if_fail(checksum != NULL, FALSE);
g_checksum_get_digest(checksum, digest, &digest_len);
- if (digest_len != required_len)
+ if (digest_len != (gsize)required_len)
return FALSE;
purple_cipher_context_reset(context, NULL);
diff --git a/libpurple/ciphers/hmac.c b/libpurple/ciphers/hmac.c
--- a/libpurple/ciphers/hmac.c
+++ b/libpurple/ciphers/hmac.c
@@ -171,7 +171,7 @@ hmac_uninit(PurpleCipherContext *context
hmac_set_key(PurpleCipherContext *context, const guchar * key, size_t key_len)
{
struct HMAC_Context *hctx = purple_cipher_context_get_data(context);
- int blocksize, i;
+ gsize blocksize, i;
guchar *full_key;
g_return_if_fail(hctx->hash != NULL);
diff --git a/libpurple/ciphers/pbkdf2.c b/libpurple/ciphers/pbkdf2.c
--- a/libpurple/ciphers/pbkdf2.c
+++ b/libpurple/ciphers/pbkdf2.c
@@ -249,7 +249,7 @@ purple_pbkdf2_digest(PurpleCipherContext
memset(halfkey, 0, halfkey_len);
for (iter_no = 1; iter_no <= ctx_data->iter_count; iter_no++) {
- int i;
+ guint i;
purple_cipher_context_reset_state(hash, NULL);
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -1976,7 +1976,7 @@ create_stream(PurpleMediaBackendFs2 *sel
we need to do this to allow them to override when using non-standard
TURN modes, like Google f.ex. */
gboolean got_turn_from_prpl = FALSE;
- int i;
+ guint i;
session = get_session(self, sess_id);
diff --git a/libpurple/plugins/joinpart.c b/libpurple/plugins/joinpart.c
--- a/libpurple/plugins/joinpart.c
+++ b/libpurple/plugins/joinpart.c
@@ -80,7 +80,7 @@ static gboolean should_hide_notice(Purpl
GHashTable *users)
{
PurpleConvChat *chat;
- int threshold;
+ guint threshold;
struct joinpart_key key;
time_t *last_said;
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
@@ -321,7 +321,7 @@ intkeyring_decrypt(intkeyring_buff_t *ke
verify_len = strlen(INTKEYRING_VERIFY_STR);
/* Don't remove the len > 0 check! */
- if (plaintext_len > 0 && plaintext_len > verify_len &&
+ if (plaintext_len > 0 && (gsize)plaintext_len > verify_len &&
plaintext[plaintext_len] == '\0')
{
verify_str = (gchar*)plaintext + plaintext_len - verify_len;
diff --git a/libpurple/plugins/perl/perl-handlers.h b/libpurple/plugins/perl/perl-handlers.h
--- a/libpurple/plugins/perl/perl-handlers.h
+++ b/libpurple/plugins/perl/perl-handlers.h
@@ -25,7 +25,7 @@ typedef struct
More information about the Commits
mailing list