diff options
author | Elliott Sales de Andrade <qulogic@pidgin.im> | 2014-11-13 00:56:55 -0500 |
---|---|---|
committer | Elliott Sales de Andrade <qulogic@pidgin.im> | 2014-11-13 00:56:55 -0500 |
commit | b8dfe2456f9fa3db1e304b3f85c7ffec633b6005 (patch) | |
tree | 1059272677b100e4680f735263616c6eac34e284 | |
parent | 054be3b9af2b6fddefa37ab010c8a25c1719be8b (diff) | |
download | pidgin-b8dfe2456f9fa3db1e304b3f85c7ffec633b6005.tar.gz |
Remove -Wno-sign-compare and backport fixes from default.
93 files changed, 228 insertions, 225 deletions
diff --git a/configure.ac b/configure.ac index 8dbf155915..9078ace493 100644 --- a/configure.ac +++ b/configure.ac @@ -1254,7 +1254,7 @@ if test "x$GCC" = "xyes"; then "-Wdeclaration-after-statement" \ "-Wendif-labels" \ "-Werror-implicit-function-declaration" \ - "-Wextra -Wno-sign-compare -Wno-unused-parameter" \ + "-Wextra -Wno-unused-parameter" \ "-Wformat-security" \ "-Werror=format-security" \ "-Winit-self" \ diff --git a/finch/gntrequest.c b/finch/gntrequest.c index 851db7e240..23c6014a08 100644 --- a/finch/gntrequest.c +++ b/finch/gntrequest.c @@ -268,7 +268,7 @@ finch_request_action(const char *title, const char *primary, va_list actions) { GntWidget *window, *box, *button, *focus = NULL; - int i; + gsize i; window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); @@ -287,7 +287,7 @@ finch_request_action(const char *title, const char *primary, g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); - if (i == default_value) + if (default_value >= 0 && i == (gsize)default_value) focus = button; } diff --git a/finch/libgnt/gntcolors.c b/finch/libgnt/gntcolors.c index 082be1dd48..9e271433a0 100644 --- a/finch/libgnt/gntcolors.c +++ b/finch/libgnt/gntcolors.c @@ -299,7 +299,7 @@ int gnt_color_pair(int pair) { return (hascolors ? COLOR_PAIR(pair) : ((pair == GNT_COLOR_NORMAL || pair == GNT_COLOR_HIGHLIGHT_D || - pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : A_STANDOUT)); + pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : (int)A_STANDOUT)); } int gnt_color_add_pair(int fg, int bg) diff --git a/finch/libgnt/gntentry.c b/finch/libgnt/gntentry.c index b6399c6ae8..93ea9ebfc5 100644 --- a/finch/libgnt/gntentry.c +++ b/finch/libgnt/gntentry.c @@ -184,7 +184,7 @@ static gboolean show_suggest_dropdown(GntEntry *entry) { char *suggest = NULL; - int len; + gsize len; int offset = 0, x, y; int count = 0; GList *iter; @@ -815,7 +815,7 @@ gnt_entry_key_pressed(GntWidget *widget, const char *text) for (str = text; *str; str = next) { - int len; + gsize len; next = g_utf8_find_next_char(str, NULL); len = next - str; @@ -834,7 +834,7 @@ gnt_entry_key_pressed(GntWidget *widget, const char *text) if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max) continue; - if (entry->end + len - entry->start >= entry->buffer) + if ((gsize)(entry->end + len - entry->start) >= entry->buffer) { /* This will cause the buffer to grow */ char *tmp = g_strdup(entry->start); @@ -1184,8 +1184,11 @@ void gnt_entry_add_to_history(GntEntry *entry, const char *text) { g_return_if_fail(entry->history != NULL); /* Need to set_history_length first */ - if (g_list_length(entry->history) >= entry->histlength) + if (entry->histlength >= 0 && + g_list_length(entry->history) >= (gsize)entry->histlength) + { return; + } entry->history = g_list_first(entry->history); g_free(entry->history->data); diff --git a/finch/libgnt/gntmenu.c b/finch/libgnt/gntmenu.c index 920ad5ec43..778f52c2a8 100644 --- a/finch/libgnt/gntmenu.c +++ b/finch/libgnt/gntmenu.c @@ -309,7 +309,7 @@ gnt_menu_key_pressed(GntWidget *widget, const char *text) menu->selected = g_list_length(menu->list) - 1; } else if (strcmp(text, GNT_KEY_RIGHT) == 0) { menu->selected++; - if (menu->selected >= g_list_length(menu->list)) + if ((guint)menu->selected >= g_list_length(menu->list)) menu->selected = 0; } else if (strcmp(text, GNT_KEY_ENTER) == 0 || strcmp(text, GNT_KEY_DOWN) == 0) { diff --git a/finch/libgnt/gntstyle.c b/finch/libgnt/gntstyle.c index 3aa7964f96..20c3f51946 100644 --- a/finch/libgnt/gntstyle.c +++ b/finch/libgnt/gntstyle.c @@ -185,7 +185,7 @@ void gnt_style_read_workspaces(GntWM *wm) gsize c; for (i = 1; i < MAX_WORKSPACES; ++i) { - int j; + gsize j; GntWS *ws; gchar **titles; char group[32]; diff --git a/finch/libgnt/gnttextview.c b/finch/libgnt/gnttextview.c index 2cb6fd1460..31456805cc 100644 --- a/finch/libgnt/gnttextview.c +++ b/finch/libgnt/gnttextview.c @@ -513,7 +513,7 @@ void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tagname) { GntWidget *widget = GNT_WIDGET(view); - int fl = 0; + chtype fl = 0; const char *start, *end; GList *list = view->list; GntTextLine *line; diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c index 19c3696e5e..310d6c621c 100644 --- a/finch/libgnt/gntwm.c +++ b/finch/libgnt/gntwm.c @@ -443,7 +443,7 @@ switch_window(GntWM *wm, int direction, gboolean urgent) if (pos < 0) { wid = g_list_last(wm->cws->list)->data; pos = g_list_length(wm->cws->list) - 1; - } else if (pos >= g_list_length(wm->cws->list)) { + } else if ((guint)pos >= g_list_length(wm->cws->list)) { wid = wm->cws->list->data; pos = 0; } else diff --git a/libpurple/account.c b/libpurple/account.c index bef2620532..aa65257703 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -3038,7 +3038,8 @@ purple_accounts_reorder(PurpleAccount *account, gint new_index) GList *l; g_return_if_fail(account != NULL); - g_return_if_fail(new_index <= g_list_length(accounts)); + g_return_if_fail(new_index >= 0); + g_return_if_fail((guint)new_index <= g_list_length(accounts)); index = g_list_index(accounts, account); diff --git a/libpurple/cipher.c b/libpurple/cipher.c index 57e5d697c1..d0a7bb7937 100644 --- a/libpurple/cipher.c +++ b/libpurple/cipher.c @@ -444,8 +444,7 @@ purple_cipher_context_digest_to_str(PurpleCipherContext *context, size_t in_len, { /* 8k is a bit excessive, will tweak later. */ guchar digest[BUF_LEN * 4]; - gint n = 0; - size_t dlen = 0; + size_t n, dlen = 0; g_return_val_if_fail(context, FALSE); g_return_val_if_fail(digest_s, FALSE); diff --git a/libpurple/circbuffer.c b/libpurple/circbuffer.c index 619d9c9758..cfc27670e6 100644 --- a/libpurple/circbuffer.c +++ b/libpurple/circbuffer.c @@ -42,8 +42,8 @@ void purple_circ_buffer_destroy(PurpleCircBuffer *buf) { } static void grow_circ_buffer(PurpleCircBuffer *buf, gsize len) { - int in_offset = 0, out_offset = 0; - int start_buflen; + gsize in_offset = 0, out_offset = 0; + gsize start_buflen; g_return_if_fail(buf != NULL); @@ -70,10 +70,8 @@ static void grow_circ_buffer(PurpleCircBuffer *buf, gsize len) { * pointer, we need to shift the data */ if (in_offset < out_offset || (in_offset == out_offset && buf->bufused > 0)) { - int shift_n = MIN(buf->buflen - start_buflen, - in_offset); - memcpy(buf->buffer + start_buflen, buf->buffer, - shift_n); + gsize shift_n = MIN(buf->buflen - start_buflen, in_offset); + memcpy(buf->buffer + start_buflen, buf->buffer, shift_n); /* If we couldn't fit the wrapped read buffer * at the end */ @@ -92,7 +90,7 @@ static void grow_circ_buffer(PurpleCircBuffer *buf, gsize len) { void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len) { - int len_stored; + gsize len_stored; g_return_if_fail(buf != NULL); @@ -105,8 +103,7 @@ void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize l * One copy from inptr to the end of the buffer, and the * second copy from the start of the buffer to the end of src. */ if (buf->inptr >= buf->outptr) - len_stored = MIN(len, buf->buflen - - (buf->inptr - buf->buffer)); + len_stored = MIN(len, buf->buflen - (buf->inptr - buf->buffer)); else len_stored = len; @@ -145,7 +142,7 @@ gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len) { buf->outptr += len; buf->bufused -= len; /* wrap to the start if we're at the end */ - if ((buf->outptr - buf->buffer) == buf->buflen) + if ((gsize)(buf->outptr - buf->buffer) == buf->buflen) buf->outptr = buf->buffer; return TRUE; diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c index 508e502013..5f55915407 100644 --- a/libpurple/dnsquery.c +++ b/libpurple/dnsquery.c @@ -245,7 +245,7 @@ write_to_parent(int fd, const void *buf, size_t count) ssize_t written; written = write(fd, buf, count); - if (written != count) { + if (written < 0 || (gsize)written != count) { if (written < 0) fprintf(stderr, "dns[%d]: Error writing data to " "parent: %s\n", getpid(), strerror(errno)); @@ -554,7 +554,7 @@ send_dns_request_to_child(PurpleDnsQueryData *query_data, purple_dnsquery_resolver_destroy(resolver); return FALSE; } - if (rc < sizeof(dns_params)) { + if ((gsize)rc < sizeof(dns_params)) { purple_debug_error("dns", "Tried to write %" G_GSSIZE_FORMAT " bytes to child but only wrote %" G_GSSIZE_FORMAT "\n", sizeof(dns_params), rc); diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c index 060b5ddb7c..3a6ad89ad5 100644 --- a/libpurple/dnssrv.c +++ b/libpurple/dnssrv.c @@ -557,7 +557,7 @@ resolved(gpointer data, gint source, PurpleInputCondition cond) res->content = g_new0(gchar, len); red = read(source, res->content, len); - if (red != len) { + if (red < 0 || (gsize)red != len) { purple_debug_error("dnssrv","unable to read txt " "response: %s\n", g_strerror(errno)); size = 0; diff --git a/libpurple/ft.c b/libpurple/ft.c index 347c54dfce..2eb896f430 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -98,7 +98,7 @@ purple_xfer_status_type_to_string(PurpleXferStatusType type) { PURPLE_XFER_STATUS_CANCEL_LOCAL, "cancelled locally" }, { PURPLE_XFER_STATUS_CANCEL_REMOTE, "cancelled remotely" } }; - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS(type_names); ++i) if (type_names[i].type == type) @@ -1073,7 +1073,7 @@ purple_xfer_read(PurpleXfer *xfer, guchar **buffer) r = -1; } - if (r == xfer->current_buffer_size) + if (r >= 0 && (gsize)r == xfer->current_buffer_size) /* * We managed to read the entire buffer. This means our this * network is fast and our buffer is too small, so make it @@ -1128,7 +1128,7 @@ do_transfer(PurpleXfer *xfer) else wc = fwrite(buffer, 1, r, xfer->dest_fp); - if (wc != r) { + if (wc != (gsize)r) { purple_debug_error("filetransfer", "Unable to write whole buffer.\n"); purple_xfer_cancel_local(xfer); g_free(buffer); @@ -1221,7 +1221,7 @@ do_transfer(PurpleXfer *xfer) that case buffer doesn't belong to us. */ g_free(buffer); return; - } else if (r == result) { + } else if (r >= 0 && (gsize)r == result) { /* * We managed to write the entire buffer. This means our * network is fast and our buffer is too small, so make it diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c index 100636b723..1d561bcc63 100644 --- a/libpurple/media/backend-fs2.c +++ b/libpurple/media/backend-fs2.c @@ -1950,7 +1950,7 @@ create_stream(PurpleMediaBackendFs2 *self, 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 index 9969022d36..1e55b05228 100644 --- a/libpurple/plugins/joinpart.c +++ b/libpurple/plugins/joinpart.c @@ -80,7 +80,7 @@ static gboolean should_hide_notice(PurpleConversation *conv, const char *name, GHashTable *users) { PurpleConvChat *chat; - int threshold; + guint threshold; struct joinpart_key key; time_t *last_said; diff --git a/libpurple/plugins/perl/perl-handlers.h b/libpurple/plugins/perl/perl-handlers.h index c0079d2fb9..000f3dfffc 100644 --- a/libpurple/plugins/perl/perl-handlers.h +++ b/libpurple/plugins/perl/perl-handlers.h @@ -25,7 +25,7 @@ typedef struct SV *callback; SV *data; PurplePlugin *plugin; - int iotag; + guint iotag; } PurplePerlTimeoutHandler; @@ -44,7 +44,7 @@ typedef struct SV *callback; SV *data; PurplePlugin *plugin; - int iotag; + guint iotag; } PurplePerlPrefsHandler; diff --git a/libpurple/plugins/signals-test.c b/libpurple/plugins/signals-test.c index 2992d4dc15..ad4f693b53 100644 --- a/libpurple/plugins/signals-test.c +++ b/libpurple/plugins/signals-test.c @@ -635,11 +635,11 @@ notify_email_cb(char *subject, char *from, char *to, char *url) { static void notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint count) { - int i; - purple_debug_misc("signals test", "notify emails: count=%d\n", count); + guint i; + purple_debug_misc("signals test", "notify emails: count=%u\n", count); for(i=0; i<count && i<5; i++) { if(subjects[i]==NULL || froms[i]==NULL || tos[i]==NULL || urls[i]==NULL) continue; - purple_debug_misc("signals test", "notify emails[%d]: subject=%s, from=%s, to=%s, url=%s\n", + purple_debug_misc("signals test", "notify emails[%u]: subject=%s, from=%s, to=%s, url=%s\n", i, subjects[i], froms[i], tos[i], urls[i]); } } diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c index adb7e0c17a..063ee69c53 100644 --- a/libpurple/plugins/ssl/ssl-gnutls.c +++ b/libpurple/plugins/ssl/ssl-gnutls.c @@ -287,7 +287,7 @@ static void ssl_gnutls_handshake_cb(gpointer data, gint source, const gnutls_datum_t *cert_list; unsigned int cert_list_size = 0; gnutls_session_t session=gnutls_data->session; - int i; + guint i; cert_list = gnutls_certificate_get_peers(session, &cert_list_size); diff --git a/libpurple/plugins/tcl/tcl_purple.h b/libpurple/plugins/tcl/tcl_purple.h index 5e1d376ee1..ad3092eaea 100644 --- a/libpurple/plugins/tcl/tcl_purple.h +++ b/libpurple/plugins/tcl/tcl_purple.h @@ -47,7 +47,7 @@ struct tcl_signal_handler { }; struct tcl_cmd_handler { - int id; + PurpleCmdId id; Tcl_Obj *cmd; Tcl_Interp *interp; diff --git a/libpurple/plugins/tcl/tcl_ref.c b/libpurple/plugins/tcl/tcl_ref.c index 6189750b9f..e51650cd21 100644 --- a/libpurple/plugins/tcl/tcl_ref.c +++ b/libpurple/plugins/tcl/tcl_ref.c @@ -117,12 +117,12 @@ static int purple_tcl_ref_set(Tcl_Interp *interp, Tcl_Obj *obj) PurpleStringref *type; void *value; static const char prefix[] = "purple-"; - static const int prefixlen = sizeof(prefix) - 1; + static const gsize prefixlen = sizeof(prefix) - 1; if (strlen(bytes) < prefixlen || strncmp(bytes, prefix, prefixlen) || (ptr = strchr(bytes, ':')) == NULL - || (ptr - bytes) == prefixlen) + || (gsize)(ptr - bytes) == prefixlen) goto badobject; /* Bad Ethan */ diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index e8f19bbed3..451bdd4b30 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -1169,7 +1169,7 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) /* Send the end of the stream to the other end of the conversation */ if (bconv->sent_stream_start == FULLY_SENT) { size_t len = strlen(STREAM_END); - if (send(bconv->socket, STREAM_END, len, 0) != len) { + if (send(bconv->socket, STREAM_END, len, 0) != (gssize)len) { purple_debug_error("bonjour", "bonjour_jabber_close_conversation: " "couldn't send data\n"); diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c index 7a755729eb..c4caa5e933 100644 --- a/libpurple/protocols/irc/parse.c +++ b/libpurple/protocols/irc/parse.c @@ -390,7 +390,7 @@ char *irc_mirc2html(const char *string) do { end = strpbrk(cur, "\002\003\007\017\026\037"); - decoded = g_string_append_len(decoded, cur, end ? end - cur : strlen(cur)); + decoded = g_string_append_len(decoded, cur, (end ? (gssize)(end - cur) : (gssize)strlen(cur))); cur = end ? end : cur + strlen(cur); switch (*cur) { diff --git a/libpurple/protocols/jabber/auth_scram.c b/libpurple/protocols/jabber/auth_scram.c index a971f098c1..7d59f72863 100644 --- a/libpurple/protocols/jabber/auth_scram.c +++ b/libpurple/protocols/jabber/auth_scram.c @@ -34,7 +34,7 @@ static const JabberScramHash hashes[] = { static const JabberScramHash *mech_to_hash(const char *mech) { - int i; + gsize i; g_return_val_if_fail(mech != NULL && *mech != '\0', NULL); diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c index dd2c2b589d..0d8c53c878 100644 --- a/libpurple/protocols/jabber/bosh.c +++ b/libpurple/protocols/jabber/bosh.c @@ -1104,7 +1104,7 @@ http_connection_send_request(PurpleHTTPConnection *conn, const GString *req) tmp); g_free(tmp); return; - } else if (ret < len) { + } else if ((size_t)ret < len) { if (ret < 0) ret = 0; if (conn->writeh == 0) diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 95e88bc3c4..aacd431968 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -581,7 +581,7 @@ int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len) */ jabber_send_raw(js, buf, len); - return (len < 0 ? strlen(buf) : len); + return (len < 0 ? (int)strlen(buf) : len); } void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, diff --git a/libpurple/protocols/jabber/jutil.c b/libpurple/protocols/jabber/jutil.c index 649beab1f4..aa1b734e5f 100644 --- a/libpurple/protocols/jabber/jutil.c +++ b/libpurple/protocols/jabber/jutil.c @@ -713,7 +713,7 @@ static const struct { const char * jabber_buddy_state_get_name(const JabberBuddyState state) { - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS(jabber_statuses); ++i) if (jabber_statuses[i].state == state) return _(jabber_statuses[i].readable); @@ -724,7 +724,7 @@ jabber_buddy_state_get_name(const JabberBuddyState state) JabberBuddyState jabber_buddy_status_id_get_state(const char *id) { - int i; + gsize i; if (!id) return JABBER_BUDDY_STATE_UNKNOWN; @@ -737,7 +737,7 @@ jabber_buddy_status_id_get_state(const char *id) JabberBuddyState jabber_buddy_show_get_state(const char *id) { - int i; + gsize i; g_return_val_if_fail(id != NULL, JABBER_BUDDY_STATE_UNKNOWN); @@ -753,7 +753,7 @@ JabberBuddyState jabber_buddy_show_get_state(const char *id) const char * jabber_buddy_state_get_show(JabberBuddyState state) { - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS(jabber_statuses); ++i) if (state == jabber_statuses[i].state) return jabber_statuses[i].show; @@ -764,7 +764,7 @@ jabber_buddy_state_get_show(JabberBuddyState state) const char * jabber_buddy_state_get_status_id(JabberBuddyState state) { - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS(jabber_statuses); ++i) if (state == jabber_statuses[i].state) return jabber_statuses[i].status_id; diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index c59c4ce936..74f932f56f 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -87,7 +87,8 @@ static void jabber_oob_xfer_end(PurpleXfer *xfer) static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; JabberOOBXfer *jox = xfer->data; - int len, total_len = strlen(jox->write_buffer); + int len; + size_t total_len = strlen(jox->write_buffer); len = write(xfer->fd, jox->write_buffer + jox->written_len, total_len - jox->written_len); diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 7e0a11b93b..efeab830d5 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -63,7 +63,7 @@ static const struct { static JabberPresenceType str_to_presence_type(const char *type) { - int i; + gsize i; if (type == NULL) return JABBER_PRESENCE_AVAILABLE; diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 46dea124bb..ba6c610252 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -446,7 +446,7 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, close(source); purple_xfer_cancel_remote(xfer); return; - } else if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) { + } else if(jsx->rxlen - 5 < (size_t)jsx->rxqueue[4] + 2) { /* Upper-bound of 257 (jsx->rxlen = 5, jsx->rxqueue[4] = 0xFF) */ unsigned short to_read = jsx->rxqueue[4] + 2 - (jsx->rxlen - 5); purple_debug_info("jabber", "reading %u bytes for DST.ADDR + port num (trying to read %hu now)\n", @@ -467,7 +467,7 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, } /* Have we not read all of DST.ADDR and the following 2-byte port number? */ - if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) + if(jsx->rxlen - 5 < (size_t)jsx->rxqueue[4] + 2) return; purple_input_remove(xfer->watcher); @@ -594,7 +594,7 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); jsx->rxlen += len; return; - } else if(jsx->rxlen - 2 < jsx->rxqueue[1]) { + } else if(jsx->rxlen - 2 < (size_t)jsx->rxqueue[1]) { /* Has a maximum value of 255 (jsx->rxlen = 2, jsx->rxqueue[1] = 0xFF) */ unsigned short to_read = jsx->rxqueue[1] - (jsx->rxlen - 2); purple_debug_info("jabber", "reading %u bytes for auth methods (trying to read %hu now)\n", @@ -615,7 +615,7 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, } /* Have we not read all the auth. method bytes? */ - if(jsx->rxlen -2 < jsx->rxqueue[1]) + if(jsx->rxlen -2 < (size_t)jsx->rxqueue[1]) return; purple_input_remove(xfer->watcher); diff --git a/libpurple/protocols/msn/command.c b/libpurple/protocols/msn/command.c index 36f7c3005f..0be77b4630 100644 --- a/libpurple/protocols/msn/command.c +++ b/libpurple/protocols/msn/command.c @@ -57,7 +57,7 @@ msn_command_from_string(const char *string) if (cmd->params != NULL) { - int c; + guint c; for (c = 0; cmd->params[c] && cmd->params[c][0]; c++); cmd->param_count = c; diff --git a/libpurple/protocols/msn/command.h b/libpurple/protocols/msn/command.h index 481a807883..d5d2d3a75d 100644 --- a/libpurple/protocols/msn/command.h +++ b/libpurple/protocols/msn/command.h @@ -41,7 +41,7 @@ struct _MsnCommand char *command; char **params; - int param_count; + guint param_count; guint ref_count; diff --git a/libpurple/protocols/msn/directconn.c b/libpurple/protocols/msn/directconn.c index 63653def73..cbffb9fffe 100644 --- a/libpurple/protocols/msn/directconn.c +++ b/libpurple/protocols/msn/directconn.c @@ -406,7 +406,7 @@ msn_dc_send_cb(gpointer data, gint fd, PurpleInputCondition cond) dc->progress = TRUE; dc->msg_pos += bytes_sent; - if (dc->msg_pos == p->length) { + if ((guint32)dc->msg_pos == p->length) { if (p->sent_cb != NULL) p->sent_cb(p); @@ -671,7 +671,7 @@ msn_dc_recv_cb(gpointer data, gint fd, PurpleInputCondition cond) } /* Wait for the whole packet to arrive */ - if (dc->in_pos < 4 + packet_length) + if ((guint32)dc->in_pos < 4 + packet_length) return; switch (msn_dc_process_packet(dc, packet_length)) { @@ -685,7 +685,7 @@ msn_dc_recv_cb(gpointer data, gint fd, PurpleInputCondition cond) } - if (dc->in_pos > packet_length + 4) { + if ((guint32)dc->in_pos > packet_length + 4) { g_memmove(dc->in_buffer, dc->in_buffer + 4 + packet_length, dc->in_pos - packet_length - 4); } diff --git a/libpurple/protocols/msn/history.c b/libpurple/protocols/msn/history.c index 82488ce102..2b23af5ba1 100644 --- a/libpurple/protocols/msn/history.c +++ b/libpurple/protocols/msn/history.c @@ -68,7 +68,7 @@ void msn_history_add(MsnHistory *history, MsnTransaction *trans) { GQueue *queue; - int max_elems; + gsize max_elems; g_return_if_fail(history != NULL); g_return_if_fail(trans != NULL); diff --git a/libpurple/protocols/msn/httpconn.c b/libpurple/protocols/msn/httpconn.c index 5bdcd61c15..2f52d1ec34 100644 --- a/libpurple/protocols/msn/httpconn.c +++ b/libpurple/protocols/msn/httpconn.c @@ -126,7 +126,7 @@ msn_httpconn_parse_data(MsnHttpConn *httpconn, const char *buf, if ((s = purple_strcasestr(header, "Content-Length: ")) != NULL) { - int tmp_len; + size_t tmp_len; s += strlen("Content-Length: "); @@ -400,7 +400,7 @@ write_raw(MsnHttpConn *httpconn, const char *data, size_t data_len) return FALSE; } - if (res < 0 || res < data_len) + if (res < 0 || (size_t)res < data_len) { if (res < 0) res = 0; diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c index f22b434823..4f9727392c 100644 --- a/libpurple/protocols/msn/msg.c +++ b/libpurple/protocols/msn/msg.c @@ -371,7 +371,7 @@ msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) body = msn_message_get_bin_data(msg, &body_len); - if (body != NULL && (end - n) > body_len) + if (body != NULL && (end - n) > (gssize)body_len) { memcpy(n, body, body_len); n += body_len; diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c index 693b6db559..34e9f66e6f 100644 --- a/libpurple/protocols/msn/nexus.c +++ b/libpurple/protocols/msn/nexus.c @@ -56,7 +56,7 @@ MsnNexus * msn_nexus_new(MsnSession *session) { MsnNexus *nexus; - int i; + gsize i; nexus = g_new0(MsnNexus, 1); nexus->session = session; @@ -74,7 +74,7 @@ msn_nexus_new(MsnSession *session) void msn_nexus_destroy(MsnNexus *nexus) { - int i; + gsize i; for (i = 0; i < nexus->token_len; i++) { g_hash_table_destroy(nexus->tokens[i].token); g_free(nexus->tokens[i].secret); @@ -269,7 +269,7 @@ nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) return FALSE; id = atol(id_str + 7) - 1; /* 'Compact#' or 'PPToken#' */ - if (id >= nexus->token_len) + if (id < 0 || (gsize)id >= nexus->token_len) return FALSE; /* Where did this come from? */ } @@ -381,7 +381,7 @@ msn_nexus_connect(MsnNexus *nexus) char *password_xml; GString *domains; char *request; - int i; + gsize i; MsnSoapMessage *soap; @@ -405,7 +405,7 @@ msn_nexus_connect(MsnNexus *nexus) domains = g_string_new(NULL); for (i = 0; i < nexus->token_len; i++) { g_string_append_printf(domains, MSN_SSO_RST_TEMPLATE, - i+1, + (int)i+1, ticket_domains[i][SSO_VALID_TICKET_DOMAIN], ticket_domains[i][SSO_VALID_TICKET_POLICY] != NULL ? ticket_domains[i][SSO_VALID_TICKET_POLICY] : diff --git a/libpurple/protocols/msn/nexus.h b/libpurple/protocols/msn/nexus.h index d824b8f624..f6150780e9 100644 --- a/libpurple/protocols/msn/nexus.h +++ b/libpurple/protocols/msn/nexus.h @@ -206,7 +206,7 @@ struct _MsnNexus char *cipher; char *secret; MsnTicketToken *tokens; - int token_len; + gsize token_len; }; void msn_nexus_connect(MsnNexus *nexus); diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 5dadc3ee7d..7c73dd8c4e 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -240,7 +240,7 @@ ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) MsnTransaction *trans; PurpleAccount *account; gboolean protocol_supported = FALSE; - int proto_ver; + guint proto_ver; size_t i; session = cmdproc->session; diff --git a/libpurple/protocols/msn/p2p.c b/libpurple/protocols/msn/p2p.c index 9b028e27bd..d39979edb1 100644 --- a/libpurple/protocols/msn/p2p.c +++ b/libpurple/protocols/msn/p2p.c @@ -133,7 +133,9 @@ msn_p2p_header_from_wire(MsnP2PInfo *info, const char *wire, size_t max_len) header->opcode = msn_pop8(wire); header->message_len = msn_pop16be(wire); header->base_id = msn_pop32be(wire); - if (header->header_len + header->message_len + P2P_PACKET_FOOTER_SIZE > max_len) { + if ((gsize)header->header_len + header->message_len + + P2P_PACKET_FOOTER_SIZE > max_len) + { /* Invalid header and data length */ len = 0; break; @@ -208,12 +210,12 @@ msn_p2p_header_to_wire(MsnP2PInfo *info, size_t *len) char *data_header_wire = NULL; if (header->header_tlv != NULL) - header_wire = msn_tlvlist_write(header->header_tlv, (size_t *)&header->header_len); + header_wire = msn_tlvlist_write(header->header_tlv, &header->header_len); else header->header_len = 0; if (header->data_tlv != NULL) - data_header_wire = msn_tlvlist_write(header->data_tlv, (size_t *)&header->data_header_len); + data_header_wire = msn_tlvlist_write(header->data_tlv, &header->data_header_len); else header->data_header_len = 0; diff --git a/libpurple/protocols/msn/servconn.c b/libpurple/protocols/msn/servconn.c index 617216cee2..2d8ea83587 100644 --- a/libpurple/protocols/msn/servconn.c +++ b/libpurple/protocols/msn/servconn.c @@ -389,7 +389,7 @@ msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len) if (ret < 0 && errno == EAGAIN) ret = 0; - if (ret >= 0 && ret < len) { + if (ret >= 0 && (size_t)ret < len) { if (servconn->tx_handler == 0) servconn->tx_handler = purple_input_add( servconn->fd, PURPLE_INPUT_WRITE, @@ -462,7 +462,8 @@ MsnServConn *msn_servconn_process_data(MsnServConn *servconn) if (servconn->payload_len) { - if (servconn->payload_len > servconn->rx_len) + if (servconn->rx_len < 0 + || servconn->payload_len > (gsize)servconn->rx_len) /* The payload is still not complete. */ break; diff --git a/libpurple/protocols/msn/slplink.c b/libpurple/protocols/msn/slplink.c index eea9ee27d8..26f5e9e606 100644 --- a/libpurple/protocols/msn/slplink.c +++ b/libpurple/protocols/msn/slplink.c @@ -289,7 +289,7 @@ msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) { MsnSlpMessagePart *part; MsnP2PInfo *info; - long long real_size; + gsize real_size; size_t len = 0; guint64 offset; @@ -546,8 +546,8 @@ slpmsg_add_part(MsnSlpMessage *slpmsg, MsnSlpMessagePart *part) || (offset + part->size) > slpmsg->size || msn_p2p_info_get_offset(slpmsg->p2p_info) != offset) { purple_debug_error("msn", - "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", - slpmsg->size, offset, part->size); + "Oversized slpmsg - msgsize=%" G_GSIZE_FORMAT " offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", + (gsize)slpmsg->size, offset, (gsize)part->size); g_return_if_reached(); } else { memcpy(slpmsg->buffer + offset, part->buffer, part->size); diff --git a/libpurple/protocols/msn/slpmsg.h b/libpurple/protocols/msn/slpmsg.h index 11e9901bc1..45c755ebc5 100644 --- a/libpurple/protocols/msn/slpmsg.h +++ b/libpurple/protocols/msn/slpmsg.h @@ -57,7 +57,7 @@ struct _MsnSlpMessage * This is the size of buffer, unless this is an outgoing file transfer, * in which case this is the size of the file. */ - long long size; + gsize size; GList *parts; /**< A list with the SlpMsgParts */ diff --git a/libpurple/protocols/msn/slpmsg_part.c b/libpurple/protocols/msn/slpmsg_part.c index dfff1f5c24..add959a73a 100644 --- a/libpurple/protocols/msn/slpmsg_part.c +++ b/libpurple/protocols/msn/slpmsg_part.c @@ -172,7 +172,7 @@ msn_slpmsgpart_ack(MsnSlpMessagePart *part, void *data) { MsnSlpMessage *slpmsg; guint64 offset; - long long real_size; + gsize real_size; slpmsg = data; diff --git a/libpurple/protocols/msn/tlv.c b/libpurple/protocols/msn/tlv.c index 48400f35ac..d05cf4b9e2 100644 --- a/libpurple/protocols/msn/tlv.c +++ b/libpurple/protocols/msn/tlv.c @@ -326,7 +326,7 @@ msn_tlvlist_remove(GSList **list, const guint8 type) } char * -msn_tlvlist_write(GSList *list, size_t *out_len) +msn_tlvlist_write(GSList *list, guint8 *out_len) { char *buf; char *tmp; @@ -339,7 +339,7 @@ msn_tlvlist_write(GSList *list, size_t *out_len) for (; list; list = g_slist_next(list)) { msn_tlv_t *tlv = (msn_tlv_t *)list->data; - if (G_UNLIKELY(tlv->length + 2 > bytes_left)) { + if (G_UNLIKELY((gsize)tlv->length + 2 > bytes_left)) { buf = g_realloc(buf, total_len + 256); bytes_left += 256; total_len += 256; diff --git a/libpurple/protocols/msn/tlv.h b/libpurple/protocols/msn/tlv.h index c2032f79bc..065dee3388 100644 --- a/libpurple/protocols/msn/tlv.h +++ b/libpurple/protocols/msn/tlv.h @@ -52,7 +52,7 @@ GSList *msn_tlvlist_copy(GSList *orig); int msn_tlvlist_count(GSList *list); size_t msn_tlvlist_size(GSList *list); gboolean msn_tlvlist_equal(GSList *one, GSList *two); -char *msn_tlvlist_write(GSList *list, size_t *out_len); +char *msn_tlvlist_write(GSList *list, guint8 *out_len); void msn_tlvlist_free(GSList *list); int msn_tlvlist_add_raw(GSList **list, const guint8 type, const guint8 length, const char *value); diff --git a/libpurple/protocols/msn/transaction.c b/libpurple/protocols/msn/transaction.c index e77b13553b..57f3464553 100644 --- a/libpurple/protocols/msn/transaction.c +++ b/libpurple/protocols/msn/transaction.c @@ -158,7 +158,7 @@ msn_transaction_unqueue(MsnTransaction *trans, MsnCmdProc *cmdproc) void msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len) + const char *payload, gsize payload_len) { g_return_if_fail(trans != NULL); g_return_if_fail(payload != NULL); diff --git a/libpurple/protocols/msn/transaction.h b/libpurple/protocols/msn/transaction.h index 7d4764145e..10fe8fc0c3 100644 --- a/libpurple/protocols/msn/transaction.h +++ b/libpurple/protocols/msn/transaction.h @@ -75,7 +75,7 @@ char *msn_transaction_to_string(MsnTransaction *trans); void msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd); void msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc); void msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len); + const char *payload, gsize payload_len); void msn_transaction_set_data(MsnTransaction *trans, void *data); void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn); void msn_transaction_set_saveable(MsnTransaction *trans, gboolean saveable); diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index f0a9021444..252852e125 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -1776,10 +1776,10 @@ msim_process_reply(MsimSession *session, MsimMessage *msg) lid = msim_msg_get_integer(msg, "lid"); /* Unsolicited messages */ - if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_GET)) { - if (dsn == MG_SERVER_INFO_DSN && lid == MG_SERVER_INFO_LID) { + if (cmd == (guint)(MSIM_CMD_BIT_REPLY | MSIM_CMD_GET)) { + if (dsn == (guint)MG_SERVER_INFO_DSN && lid == (guint)MG_SERVER_INFO_LID) { return msim_process_server_info(session, msg); - } else if (dsn == MG_WEB_CHALLENGE_DSN && lid == MG_WEB_CHALLENGE_LID) { + } else if (dsn == (guint)MG_WEB_CHALLENGE_DSN && lid == (guint)MG_WEB_CHALLENGE_LID) { return msim_web_challenge(session, msg); } } @@ -2989,7 +2989,7 @@ msim_send_raw(MsimSession *session, const gchar *msg) purple_debug_info("msim", "msim_send_raw: writing <%s>\n", msg); len = strlen(msg); - return msim_send_really_raw(session->gc, msg, len) == len; + return msim_send_really_raw(session->gc, msg, len) == (int)len; } static GHashTable * @@ -3563,7 +3563,7 @@ msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) l = purple_accounts_get_all(); while (l) { if (purple_account_is_connected(l->data) && - (uid == 0 || purple_account_get_int(l->data, "uid", 0) == uid)) { + (uid == 0 || purple_account_get_int(l->data, "uid", 0) == (int)uid)) { account = l->data; break; } diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 7fdaaaba10..a2b65fc972 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -423,8 +423,8 @@ msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *use return FALSE; } - if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) + if (msim_msg_get_integer(msg, "dsn") == (guint)MG_OWN_IM_INFO_DSN && + msim_msg_get_integer(msg, "lid") == (guint)MG_OWN_IM_INFO_LID) { /* * Some of this info will be available on the buddy list if the @@ -452,8 +452,8 @@ msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *use session->show_only_to_list ? 1 : 0, session->privacy_mode & 1), NULL); - } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) { + } else if (msim_msg_get_integer(msg, "dsn") == (guint)MG_OWN_MYSPACE_INFO_DSN && + msim_msg_get_integer(msg, "lid") == (guint)MG_OWN_MYSPACE_INFO_LID) { /* TODO: same as above, but for MySpace info. */ } diff --git a/libpurple/protocols/oscar/bstream.c b/libpurple/protocols/oscar/bstream.c index 31acac2724..f933d18660 100644 --- a/libpurple/protocols/oscar/bstream.c +++ b/libpurple/protocols/oscar/bstream.c @@ -49,7 +49,7 @@ void byte_stream_destroy(ByteStream *bs) g_free(bs->data); } -int byte_stream_bytes_left(ByteStream *bs) +size_t byte_stream_bytes_left(ByteStream *bs) { return bs->len - bs->offset; } @@ -79,7 +79,7 @@ void byte_stream_rewind(ByteStream *bs) int byte_stream_advance(ByteStream *bs, int n) { g_return_val_if_fail(byte_stream_curpos(bs) + n >= 0, 0); - g_return_val_if_fail(n <= byte_stream_bytes_left(bs), 0); + g_return_val_if_fail((gsize)n <= byte_stream_bytes_left(bs), 0); bs->offset += n; return n; diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 26dfa21aaa..b752af0fed 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -80,7 +80,7 @@ aim_ssi_type_to_string(guint16 type) { 0x0020, "ICQ-MDir" }, { 0x0029, "Facebook" }, }; - int i; + size_t i; for (i = 0; i < G_N_ELEMENTS(type_strings); i++) { if (type_strings[i].type == type) { return type_strings[i].string; diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 6b7ba92cef..2ace89cfa6 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -949,17 +949,15 @@ straight_to_hell(gpointer data, gint source, const gchar *error_message) buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", pos->offset, pos->len, pos->modname ? pos->modname : ""); result = send(pos->fd, buf, strlen(buf), 0); - if (result != strlen(buf)) { - if (result < 0) - purple_debug_error("oscar", "Error writing %" G_GSIZE_FORMAT - " bytes to fetch AIM hash data: %s\n", - strlen(buf), g_strerror(errno)); - else - purple_debug_error("oscar", "Tried to write %" - G_GSIZE_FORMAT " bytes to fetch AIM hash data but " - "instead wrote %" G_GSSIZE_FORMAT " bytes\n", - strlen(buf), result); - } + if (result < 0) + purple_debug_error("oscar", "Error writing %" G_GSIZE_FORMAT + " bytes to fetch AIM hash data: %s\n", + strlen(buf), g_strerror(errno)); + else if ((gsize)result != strlen(buf)) + purple_debug_error("oscar", "Tried to write %" + G_GSIZE_FORMAT " bytes to fetch AIM hash data but " + "instead wrote %" G_GSSIZE_FORMAT " bytes\n", + strlen(buf), result); g_free(buf); g_free(pos->modname); pos->inpa = purple_input_add(pos->fd, PURPLE_INPUT_READ, damn_you, pos); @@ -1068,7 +1066,7 @@ purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) PurpleConnection *gc = od->gc; PurpleAccount *account = purple_connection_get_account(gc); char *host; int port; - int i; + size_t i; FlapConnection *newconn; va_list ap; struct aim_authresp_info *info; diff --git a/libpurple/protocols/oscar/oscar.h b/libpurple/protocols/oscar/oscar.h index fe01cecc48..93480718ed 100644 --- a/libpurple/protocols/oscar/oscar.h +++ b/libpurple/protocols/oscar/oscar.h @@ -595,8 +595,8 @@ struct chat_connection int id; PurpleConnection *gc; PurpleConversation *conv; - int maxlen; - int maxvis; + guint16 maxlen; + guint16 maxvis; }; /* @@ -1212,7 +1212,7 @@ void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint int byte_stream_new(ByteStream *bs, size_t len); int byte_stream_init(ByteStream *bs, guint8 *data, size_t len); void byte_stream_destroy(ByteStream *bs); -int byte_stream_bytes_left(ByteStream *bs); +size_t byte_stream_bytes_left(ByteStream *bs); int byte_stream_curpos(ByteStream *bs); int byte_stream_setpos(ByteStream *bs, size_t off); void byte_stream_rewind(ByteStream *bs); diff --git a/libpurple/protocols/oscar/tlv.c b/libpurple/protocols/oscar/tlv.c index bf2be748e5..fb89c0de40 100644 --- a/libpurple/protocols/oscar/tlv.c +++ b/libpurple/protocols/oscar/tlv.c @@ -658,7 +658,7 @@ void aim_tlvlist_remove(GSList **list, const guint16 type) */ int aim_tlvlist_write(ByteStream *bs, GSList **list) { - int goodbuflen; + size_t goodbuflen; GSList *cur; aim_tlv_t *tlv; diff --git a/libpurple/protocols/oscar/util.c b/libpurple/protocols/oscar/util.c index 1fa176e382..abdad3546d 100644 --- a/libpurple/protocols/oscar/util.c +++ b/libpurple/protocols/oscar/util.c @@ -62,7 +62,7 @@ static const char * const msgerrreason[] = { N_("Queue full"), N_("Not while on AOL") }; -static const int msgerrreasonlen = G_N_ELEMENTS(msgerrreason); +static const gsize msgerrreasonlen = G_N_ELEMENTS(msgerrreason); const char *oscar_get_msgerr_reason(size_t reason) { diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 4360a7e336..687cd3f6cd 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -750,7 +750,7 @@ silcpurple_add_buddy_save(SilcBool success, void *context) char filename[512], filename2[512], *fingerprint = NULL, *tmp; SilcUInt32 len; SilcHash hash; - int i; + gsize i; if (!success) { /* The user did not trust the public key. */ diff --git a/libpurple/protocols/silc/chat.c b/libpurple/protocols/silc/chat.c index 91dda7ba9c..f46d4b8aeb 100644 --- a/libpurple/protocols/silc/chat.c +++ b/libpurple/protocols/silc/chat.c @@ -680,14 +680,14 @@ static void silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) { SilcChannelEntry channel; - int ulimit = 0; + guint ulimit = 0; channel = silc_client_get_channel(s->sg->client, s->sg->conn, (char *)s->channel); if (!channel) return; if (limit) - ulimit = atoi(limit); + ulimit = strtoul(limit, NULL, 10); if (!limit || !(*limit) || *limit == '0') { if (limit && ulimit == channel->user_limit) { @@ -1120,7 +1120,7 @@ void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, SilcPurplePrvgrp prv; for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) + if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) break; if (!l) return; @@ -1131,7 +1131,7 @@ void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, /* Find channel by id */ silc_hash_table_list(conn->local_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { + if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { found = TRUE; break; } @@ -1165,7 +1165,7 @@ void silcpurple_chat_leave(PurpleConnection *gc, int id) SilcChannelEntry channel; for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) + if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) break; if (!l) return; @@ -1185,7 +1185,7 @@ void silcpurple_chat_leave(PurpleConnection *gc, int id) /* Find channel by id */ silc_hash_table_list(conn->local_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { + if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { found = TRUE; break; } @@ -1202,7 +1202,7 @@ void silcpurple_chat_leave(PurpleConnection *gc, int id) /* Leave from private groups on this channel as well */ for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->chid == id) { + if (((SilcPurplePrvgrp)l->data)->chid == (gulong)id) { prv = l->data; silc_client_del_channel_private_key(client, conn, chu->channel, @@ -1266,7 +1266,7 @@ int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, SilcPurplePrvgrp prv; for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) + if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) break; if (!l) { g_free(tmp); @@ -1286,7 +1286,7 @@ int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, /* Find channel by id */ silc_hash_table_list(conn->local_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { + if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { found = TRUE; break; } @@ -1357,7 +1357,7 @@ void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) SilcPurplePrvgrp prv; for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) + if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) break; if (!l) return; @@ -1368,7 +1368,7 @@ void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) /* Find channel by id */ silc_hash_table_list(conn->local_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { + if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { found = TRUE; break; } diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index c328ffa754..2e018eafea 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -455,7 +455,6 @@ silc_notify(SilcClient client, SilcClientConnection conn, SilcNotifyType notify; PurpleBuddy *b; SilcDList list; - int i; va_start(va, type); memset(buf, 0, sizeof(buf)); @@ -851,6 +850,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, if (public_key) { GSList *buddies; const char *f; + gsize i; pk = silc_pkcs_public_key_encode(public_key, &pk_len); if (!pk) diff --git a/libpurple/protocols/silc/pk.c b/libpurple/protocols/silc/pk.c index 6d25db910d..539e1d9478 100644 --- a/libpurple/protocols/silc/pk.c +++ b/libpurple/protocols/silc/pk.c @@ -122,7 +122,7 @@ void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, SilcVerifyPublicKey completion, void *context) { PurpleConnection *gc = client->application; - int i; + gsize i; char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; char *fingerprint, *babbleprint; struct passwd *pw; diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index e2824ec675..12693fefbc 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -2542,11 +2542,13 @@ static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pk static void yahoo_p2p_write_pkt(gint source, struct yahoo_packet *pkt) { size_t pkt_len; + gssize written; guchar *raw_packet; /*build the raw packet and send it to the host*/ pkt_len = yahoo_packet_build(pkt, 0, 0, 0, &raw_packet); - if(write(source, raw_packet, pkt_len) != pkt_len) + written = write(source, raw_packet, pkt_len); + if (written < 0 || (gsize)written != pkt_len) purple_debug_warning("yahoo","p2p: couldn't write to the source\n"); g_free(raw_packet); } diff --git a/libpurple/protocols/yahoo/libymsg.h b/libpurple/protocols/yahoo/libymsg.h index 6e2688657a..905bedc49f 100644 --- a/libpurple/protocols/yahoo/libymsg.h +++ b/libpurple/protocols/yahoo/libymsg.h @@ -129,7 +129,7 @@ enum yahoo_status { YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ YAHOO_STATUS_TYPING = 0x16, - YAHOO_STATUS_DISCONNECTED = 0xffffffff /* in ymsg 15. doesnt mean the normal sense of 'disconnected' */ + YAHOO_STATUS_DISCONNECTED = -1 /* 0xffffffff; in ymsg 15. doesnt mean the normal sense of 'disconnected' */ }; /* diff --git a/libpurple/protocols/yahoo/util.c b/libpurple/protocols/yahoo/util.c index 2807265595..5c80639c6e 100644 --- a/libpurple/protocols/yahoo/util.c +++ b/libpurple/protocols/yahoo/util.c @@ -546,7 +546,7 @@ char *yahoo_codes_to_html(const char *x) size_t x_len; xmlnode *html, *cur; GString *cdata = g_string_new(NULL); - int i, j; + guint i, j; gboolean no_more_gt_brackets = FALSE; const char *match; gchar *xmlstr1, *xmlstr2, *esc; @@ -803,7 +803,7 @@ char *yahoo_html_to_codes(const char *src) GSList *tags = NULL; size_t src_len; - int i, j; + guint i, j; GString *dest; char *esc; gboolean no_more_gt_brackets = FALSE; diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 65a60ccc4d..2165b37805 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -412,7 +412,7 @@ static void yahoo_xfer_start(PurpleXfer *xfer) static guint calculate_length(const gchar *l, size_t len) { - int i; + size_t i; for (i = 0; i < len; i++) { if (!g_ascii_isdigit(l[i])) diff --git a/libpurple/protocols/yahoo/yahoo_packet.c b/libpurple/protocols/yahoo/yahoo_packet.c index f029575782..f7dae441b1 100644 --- a/libpurple/protocols/yahoo/yahoo_packet.c +++ b/libpurple/protocols/yahoo/yahoo_packet.c @@ -139,7 +139,7 @@ void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) char key[64]; const guchar *delimiter; gboolean accept; - int x; + guint x; struct yahoo_pair *pair; while (pos + 1 < len) @@ -370,7 +370,7 @@ int yahoo_packet_send(struct yahoo_packet *pkt, YahooData *yd) return ret; } - if (ret < len) { + if ((gsize)ret < len) { if (yd->txhandler == 0) yd->txhandler = purple_input_add(yd->fd, PURPLE_INPUT_WRITE, yahoo_packet_send_can_write, yd); diff --git a/libpurple/protocols/yahoo/yahoo_packet.h b/libpurple/protocols/yahoo/yahoo_packet.h index f214351b26..6fdbd3438b 100644 --- a/libpurple/protocols/yahoo/yahoo_packet.h +++ b/libpurple/protocols/yahoo/yahoo_packet.h @@ -121,7 +121,7 @@ struct yahoo_pair { struct yahoo_packet { guint16 service; - guint32 status; + gint32 status; guint32 id; GSList *hash; }; diff --git a/libpurple/protocols/yahoo/yahoo_picture.c b/libpurple/protocols/yahoo/yahoo_picture.c index 7f9fa04300..c0410384b8 100644 --- a/libpurple/protocols/yahoo/yahoo_picture.c +++ b/libpurple/protocols/yahoo/yahoo_picture.c @@ -420,7 +420,7 @@ static void yahoo_buddy_icon_upload_pending(gpointer data, gint source, PurpleIn return; } d->pos += wrote; - if (d->pos >= d->str->len) { + if ((size_t)d->pos >= d->str->len) { purple_debug_misc("yahoo", "Finished uploading buddy icon.\n"); purple_input_remove(d->watcher); /* Clean out the sent buffer and reuse it to read the result */ diff --git a/libpurple/protocols/yahoo/ycht.c b/libpurple/protocols/yahoo/ycht.c index 5a05e1869d..304c3d6a9b 100644 --- a/libpurple/protocols/yahoo/ycht.c +++ b/libpurple/protocols/yahoo/ycht.c @@ -490,7 +490,7 @@ static void ycht_pending(gpointer data, gint source, PurpleInputCondition cond) while (1) { YchtPkt *pkt; int pos = 0; - int pktlen; + guint pktlen; guint service; guint version; gint status; diff --git a/libpurple/protocols/zephyr/ZReadAscii.c b/libpurple/protocols/zephyr/ZReadAscii.c index c90a103a46..deac15c63f 100644 --- a/libpurple/protocols/zephyr/ZReadAscii.c +++ b/libpurple/protocols/zephyr/ZReadAscii.c @@ -10,7 +10,7 @@ #include "internal.h" -#define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?temp:((temp-='A'-'9'-1),(temp<16)?temp:-1)) +#define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?(int)temp:((temp-='A'-'9'-1),(temp<16)?(int)temp:-1)) Code_t ZReadAscii(ptr, len, field, num) char *ptr; diff --git a/libpurple/protocols/zephyr/ZVariables.c b/libpurple/protocols/zephyr/ZVariables.c index d651f152b4..138f73542d 100644 --- a/libpurple/protocols/zephyr/ZVariables.c +++ b/libpurple/protocols/zephyr/ZVariables.c @@ -206,7 +206,7 @@ static int varline(bfr, var) #define max(a,b) ((a > b) ? (a) : (b)) #endif - if (g_ascii_strncasecmp(bfr, var, max(strlen(var), cp - bfr))) + if (g_ascii_strncasecmp(bfr, var, max(strlen(var), (gsize)(cp - bfr)))) return(0); /* var is not the var in bfr ==> no match */ diff --git a/libpurple/protocols/zephyr/Zinternal.c b/libpurple/protocols/zephyr/Zinternal.c index 8213bcbd94..d4e3e83b30 100644 --- a/libpurple/protocols/zephyr/Zinternal.c +++ b/libpurple/protocols/zephyr/Zinternal.c @@ -206,7 +206,7 @@ static struct _Z_InputQ *Z_SearchQueue(ZUnique_Id_t *uid, ZNotice_Kind_t kind) if (ZCompareUID(uid, &qptr->uid) && qptr->kind == kind) return (qptr); next = qptr->next; - if (qptr->timep && (qptr->timep+Z_NOTICETIMELIMIT < tv.tv_sec)) + if (qptr->timep && ((time_t)qptr->timep+Z_NOTICETIMELIMIT < tv.tv_sec)) Z_RemQueue(qptr); qptr = next; } @@ -654,7 +654,7 @@ Code_t Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine) Code_t Z_FormatRawHeader(notice, buffer, buffer_len, len, cstart, cend) ZNotice_t *notice; char *buffer; - int buffer_len; + gsize buffer_len; int *len; char **cstart, **cend; { diff --git a/libpurple/protocols/zephyr/internal.h b/libpurple/protocols/zephyr/internal.h index 14c06b1703..0a0648d88a 100644 --- a/libpurple/protocols/zephyr/internal.h +++ b/libpurple/protocols/zephyr/internal.h @@ -105,7 +105,7 @@ void Z_RemQueue __P((struct _Z_InputQ *)); Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int)); Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); -Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, int, +Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, gsize, int*, char **, char **)); Code_t Z_ReadEnqueue __P((void)); Code_t Z_ReadWait __P((void)); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 1e0fb5b385..e8f4f1c5c5 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2090,8 +2090,7 @@ static int zephyr_send_im(PurpleConnection * gc, const char *who, const char *im static char* zephyr_tzc_escape_msg(const char *message) { - int pos = 0; - int pos2 = 0; + gsize pos = 0, pos2 = 0; char *newmsg; if (message && (strlen(message) > 0)) { @@ -2122,8 +2121,7 @@ static char* zephyr_tzc_escape_msg(const char *message) char* zephyr_tzc_deescape_str(const char *message) { - int pos = 0; - int pos2 = 0; + gsize pos = 0, pos2 = 0; char *newmsg; if (message && (strlen(message) > 0)) { diff --git a/libpurple/proxy.c b/libpurple/proxy.c index 153462b3b1..5b78672525 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -878,7 +878,7 @@ proxy_do_write(gpointer data, gint source, PurpleInputCondition cond) purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); return; } - if (ret < request_len) { + if ((gsize)ret < request_len) { connect_data->written_len += ret; return; } @@ -943,7 +943,7 @@ http_canread(gpointer data, gint source, PurpleInputCondition cond) if (p != NULL) { *p = '\0'; headers_len = (p - (char *)connect_data->read_buffer) + 4; - } else if(len == max_read) + } else if((gsize)len == max_read) headers_len = len; else return; @@ -1465,7 +1465,7 @@ proxy_connect_socks4(PurpleProxyConnectData *connect_data, struct sockaddr *addr } static gboolean -s5_ensure_buffer_length(PurpleProxyConnectData *connect_data, int len) +s5_ensure_buffer_length(PurpleProxyConnectData *connect_data, guint len) { if(connect_data->read_len < len) { if(connect_data->read_buf_len < len) { diff --git a/libpurple/purple-client.c b/libpurple/purple-client.c index 1cada6a6d5..d52428df7a 100644 --- a/libpurple/purple-client.c +++ b/libpurple/purple-client.c @@ -15,7 +15,7 @@ static DBusGProxy *purple_proxy; static GList *garray_int_to_glist(GArray *array) { GList *list = NULL; - int i; + gsize i; for (i = 0; i < array->len; i++) list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); @@ -27,7 +27,7 @@ static GList *garray_int_to_glist(GArray *array) static GSList *garray_int_to_gslist(GArray *array) { GSList *list = NULL; - int i; + gsize i; for (i = 0; i < array->len; i++) list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); diff --git a/libpurple/stun.c b/libpurple/stun.c index c470b967b3..96bacda231 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -138,7 +138,7 @@ static gboolean timeoutfunc(gpointer data) { sc->retry++; if (sendto(sc->fd, sc->packet, sc->packetsize, 0, (struct sockaddr *)&(sc->addr), sizeof(struct sockaddr_in)) != - sc->packetsize) + (gssize)sc->packetsize) { purple_debug_warning("stun", "sendto failed\n"); return FALSE; @@ -171,7 +171,7 @@ static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) { struct stun_conn *sc = data; char buffer[65536]; char *tmp; - int len; + gssize len; struct in_addr in; struct stun_attrib *attrib; struct stun_header *hdr; @@ -188,13 +188,13 @@ static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) { } buffer[len] = '\0'; - if (len < sizeof(struct stun_header)) { + if ((gsize)len < sizeof(struct stun_header)) { purple_debug_warning("stun", "got invalid response\n"); return; } hdr = (struct stun_header*) buffer; - if (len != (ntohs(hdr->len) + sizeof(struct stun_header))) { + if ((gsize)len != (ntohs(hdr->len) + sizeof(struct stun_header))) { purple_debug_warning("stun", "got incomplete response\n"); return; } @@ -323,7 +323,7 @@ static void hbn_listen_cb(int fd, gpointer data) { if(sendto(sc->fd, &hdr_data, sizeof(struct stun_header), 0, (struct sockaddr *)&(sc->addr), - sizeof(struct sockaddr_in)) < sizeof(struct stun_header)) { + sizeof(struct sockaddr_in)) < (gssize)sizeof(struct stun_header)) { nattype.status = PURPLE_STUN_STATUS_UNKNOWN; nattype.lookup_time = time(NULL); do_callbacks(); diff --git a/libpurple/upnp.c b/libpurple/upnp.c index e4dd36921b..feb200eba1 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -372,7 +372,7 @@ purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, const char *path, *start = strstr(baseURL, "://"); start = start ? start + 3 : baseURL; path = strchr(start, '/'); - length = path ? path - baseURL : strlen(baseURL); + length = path ? (gsize)(path - baseURL) : strlen(baseURL); controlURL = g_strdup_printf("%.*s%s", (int)length, baseURL, tmp); } else { controlURL = g_strdup_printf("%s%s", baseURL, tmp); @@ -611,10 +611,10 @@ purple_upnp_discover_send_broadcast(UPnPDiscoveryData *dd) totalSize = strlen(sendMessage); do { - if(sendto(dd->fd, sendMessage, totalSize, 0, - (struct sockaddr*) &(dd->server), - sizeof(struct sockaddr_in) - ) == totalSize) { + gssize sent = sendto(dd->fd, sendMessage, totalSize, 0, + (struct sockaddr*) &(dd->server), + sizeof(struct sockaddr_in)); + if (sent >= 0 && (gsize)sent == totalSize) { sentSuccess = TRUE; break; } diff --git a/libpurple/util.c b/libpurple/util.c index c39812ef20..9f2a904ae6 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -129,7 +129,7 @@ purple_util_uninit(void) gchar * purple_base16_encode(const guchar *data, gsize len) { - int i; + gsize i; gchar *ascii = NULL; g_return_val_if_fail(data != NULL, NULL); @@ -146,7 +146,7 @@ purple_base16_encode(const guchar *data, gsize len) guchar * purple_base16_decode(const char *str, gsize *ret_len) { - int len, i, accumulator = 0; + gsize len, i, accumulator = 0; guchar *data; g_return_val_if_fail(str != NULL, NULL); @@ -193,7 +193,7 @@ purple_base16_decode(const char *str, gsize *ret_len) gchar * purple_base16_encode_chunked(const guchar *data, gsize len) { - int i; + gsize i; gchar *ascii = NULL; g_return_val_if_fail(data != NULL, NULL); @@ -1993,13 +1993,12 @@ purple_markup_strip_html(const char *str) * address the link was pointing to. */ else if (href != NULL && g_ascii_strncasecmp(str2 + i, "</a>", 4) == 0) { - size_t hrlen = strlen(href); /* Only insert the href if it's different from the CDATA. */ - if ((hrlen != j - href_st || + if ((hrlen != (gsize)(j - href_st) || strncmp(str2 + href_st, href, hrlen)) && - (hrlen != j - href_st + 7 || /* 7 == strlen("http://") */ + (hrlen != (gsize)(j - href_st + 7) || /* 7 == strlen("http://") */ strncmp(str2 + href_st, href + 7, hrlen - 7))) { str2[j++] = ' '; @@ -2701,7 +2700,7 @@ purple_util_write_data_to_file_absolute(const char *filename_full, const char *d * It causes TOCTOU coverity warning (against g_rename below), * but it's not a threat for us. */ - if ((g_stat(filename_temp, &st) == -1) || (st.st_size != real_size)) + if ((g_stat(filename_temp, &st) == -1) || ((gsize)st.st_size != real_size)) { purple_debug_error("util", "Error writing data to file %s: " "Incomplete file written; is your disk " @@ -3306,7 +3305,7 @@ purple_str_size_to_units(size_t size) float size_mag; int size_index = 0; - if (size == -1) { + if (size == (size_t)-1) { return g_strdup(_("Calculating...")); } else if (size == 0) { @@ -3421,7 +3420,7 @@ void purple_got_protocol_handler_uri(const char *uri) return; } - len = MIN(sizeof(proto) - 1, (tmp - uri)); + len = MIN(sizeof(proto) - 1, (gsize)(tmp - uri)); strncpy(proto, uri, len); proto[len] = '\0'; @@ -4107,7 +4106,7 @@ url_fetch_send_cb(gpointer data, gint source, PurpleInputCondition cond) } gfud->request_written += len; - if (gfud->request_written < total_len) + if (gfud->request_written < (gsize)total_len) return; /* We're done writing our request, now start reading the response */ @@ -4349,7 +4348,7 @@ purple_url_encode(const char *str) buf[j++] = c; } else { int bytes = g_unichar_to_utf8(c, utf_char); - for (i = 0; i < bytes; i++) { + for (i = 0; (int)i < bytes; i++) { if (j > (BUF_LEN - 4)) break; if (i >= sizeof(utf_char)) { @@ -4842,7 +4841,7 @@ purple_utf8_has_word(const char *haystack, const char *needle) while ((p = strstr(start, pin)) != NULL) { prev_char = g_utf8_find_prev_char(hay, p); - before = -2; + before = (gunichar)-2; if (prev_char) { before = g_utf8_get_char(prev_char); } @@ -4853,8 +4852,8 @@ purple_utf8_has_word(const char *haystack, const char *needle) ("!g_unichar_isalnum()" is not a valid way to determine word boundaries, but it is the only reasonable thing to do here), and isn't the '&' from a "&" or some such entity*/ - (before != -2 && !g_unichar_isalnum(before) && *(p - 1) != '&')) - && after != -2 && !g_unichar_isalnum(after)) { + (before != (gunichar)-2 && !g_unichar_isalnum(before) && *(p - 1) != '&')) + && after != (gunichar)-2 && !g_unichar_isalnum(after)) { ret = TRUE; break; } @@ -5008,7 +5007,7 @@ purple_escape_filename(const char *str) buf[j++] = c; } else { int bytes = g_unichar_to_utf8(c, utf_char); - for (i = 0; i < bytes; i++) { + for (i = 0; (int)i < bytes; i++) { if (j > (BUF_LEN - 4)) break; if (i >= sizeof(utf_char)) { diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index 00c5866638..c64c5385ff 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -109,7 +109,7 @@ xmlnode_insert_data(xmlnode *node, const char *data, gssize size) g_return_if_fail(data != NULL); g_return_if_fail(size != 0); - real_size = size == -1 ? strlen(data) : size; + real_size = size == -1 ? strlen(data) : (gsize)size; child = new_node(NULL, XMLNODE_TYPE_DATA); @@ -711,7 +711,7 @@ xmlnode_from_str(const char *str, gssize size) g_return_val_if_fail(str != NULL, NULL); - real_size = size < 0 ? strlen(str) : size; + real_size = size < 0 ? strlen(str) : (gsize)size; xpd = g_new0(struct _xmlnode_parser_data, 1); if (xmlSAXUserParseMemory(&xmlnode_parser_libxml, xpd, str, real_size) < 0) { diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 61280ed645..672e949c3c 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -157,7 +157,7 @@ static void update_typing_message(PidginConversation *gtkconv, const char *messa static const char *item_factory_translate_func (const char *path, gpointer func_data); gboolean pidgin_conv_has_focus(PurpleConversation *conv); static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); -static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); +static gboolean color_is_visible(GdkColor foreground, GdkColor background, guint color_contrast, guint brightness_contrast); static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create); static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields); static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win); @@ -4117,7 +4117,7 @@ tab_complete_process_item(int *most_matched, const char *entered, gsize entered_ while (purple_utf8_strcasecmp(tmp, *partial)) { (*partial)[*most_matched] = '\0'; - if (*most_matched < strlen(tmp)) + if (*most_matched < (goffset)strlen(tmp)) tmp[*most_matched] = '\0'; (*most_matched)--; } @@ -10195,7 +10195,7 @@ pidgin_conv_is_hidden(PidginConversation *gtkconv) /* Algorithm from http://www.w3.org/TR/AERT#color-contrast */ static gboolean -color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast) +color_is_visible(GdkColor foreground, GdkColor background, guint color_contrast, guint brightness_contrast) { gulong fg_brightness; gulong bg_brightness; diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 895ba5b32d..13e2e10b47 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -429,7 +429,7 @@ regex_filter_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, gtk_tree_model_get(m, iter, 0, &text, 1, &level, -1); - if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) + if (level >= (PurpleDebugLevel)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) regex_match(win, text); g_free(text); @@ -457,7 +457,7 @@ regex_show_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, PurpleDebugLevel level; gtk_tree_model_get(m, iter, 0, &text, 1, &level, -1); - if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) + if (level >= (PurpleDebugLevel)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); g_free(text); @@ -584,7 +584,7 @@ regex_row_changed_cb(GtkTreeModel *model, GtkTreePath *path, gtk_tree_model_get(model, iter, 0, &text, 1, &level, -1); - if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) { + if (level >= (PurpleDebugLevel)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) { if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { regex_match(win, text); } else { @@ -722,7 +722,7 @@ toolbar_context(GtkWidget *toolbar, GdkEventButton *event, gpointer null) item = gtk_check_menu_item_new_with_mnemonic(text[i]); g_object_set_data(G_OBJECT(item), "user_data", GINT_TO_POINTER(value[i])); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(toolbar_icon_pref_changed), toolbar); - if (value[i] == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style")) + if (value[i] == (GtkToolbarStyle)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style")) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); } diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c index 4c1bc658ea..b000b0489c 100644 --- a/pidgin/gtkft.c +++ b/pidgin/gtkft.c @@ -636,7 +636,7 @@ make_info_table(PidginXferDialog *dialog) { GtkWidget *table; GtkWidget *label; - int i; + gsize i; struct { diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 8b8cd320e6..b26386dc88 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -1472,7 +1472,7 @@ imhtml_find_protocol(const char *url, gboolean reverse) GtkIMHtmlClass *klass; GList *iter; GtkIMHtmlProtocol *proto = NULL; - int length = reverse ? strlen(url) : -1; + int length = reverse ? strlen(url) : 0; klass = g_type_class_ref(GTK_TYPE_IMHTML); for (iter = klass->protocols; iter; iter = iter->next) { diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c index 88166a2128..3c4d1ad888 100644 --- a/pidgin/gtkmain.c +++ b/pidgin/gtkmain.c @@ -248,7 +248,7 @@ ui_main(void) GList *icons = NULL; GdkPixbuf *icon = NULL; char *icon_path; - int i; + gsize i; struct { const char *dir; const char *filename; diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c index 78f7278f13..5463d0b3ac 100644 --- a/pidgin/gtkprivacy.c +++ b/pidgin/gtkprivacy.c @@ -74,7 +74,7 @@ typedef struct static struct { const char *text; - int num; + PurplePrivacyType type; } const menu_entries[] = { @@ -206,12 +206,12 @@ static void select_account_cb(GtkWidget *dropdown, PurpleAccount *account, PidginPrivacyDialog *dialog) { - int i; + gsize i; dialog->account = account; for (i = 0; i < menu_entry_count; i++) { - if (menu_entries[i].num == account->perm_deny) { + if (menu_entries[i].type == account->perm_deny) { gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); break; } @@ -228,7 +228,8 @@ select_account_cb(GtkWidget *dropdown, PurpleAccount *account, static void type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) { - int new_type = menu_entries[gtk_combo_box_get_active(combo)].num; + PurplePrivacyType new_type = + menu_entries[gtk_combo_box_get_active(combo)].type; dialog->account->perm_deny = new_type; serv_set_permit_deny(purple_account_get_connection(dialog->account)); @@ -335,8 +336,8 @@ privacy_dialog_new(void) GtkWidget *button; GtkWidget *dropdown; GtkWidget *label; - int selected = -1; - int i; + gssize selected = -1; + gsize i; dialog = g_new0(PidginPrivacyDialog, 1); @@ -371,8 +372,8 @@ privacy_dialog_new(void) gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), _(menu_entries[i].text)); - if (menu_entries[i].num == dialog->account->perm_deny) - selected = i; + if (menu_entries[i].type == dialog->account->perm_deny) + selected = (gssize)i; } gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), selected); diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index b6d56dccb0..f9309d9f3f 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -144,7 +144,7 @@ input_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data) else value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry)); - if (id < data->cb_count && data->cbs[id] != NULL) + if (id >= 0 && (gsize)id < data->cb_count && data->cbs[id] != NULL) ((PurpleRequestInputCb)data->cbs[id])(data->user_data, value); else if (data->cbs[1] != NULL) ((PurpleRequestInputCb)data->cbs[1])(data->user_data, value); @@ -160,7 +160,7 @@ action_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data) { generic_response_start(data); - if (id < data->cb_count && data->cbs[id] != NULL) + if (id >= 0 && (gsize)id < data->cb_count && data->cbs[id] != NULL) ((PurpleRequestActionCb)data->cbs[id])(data->user_data, id); purple_request_close(PURPLE_REQUEST_INPUT, data); @@ -175,7 +175,7 @@ choice_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data) generic_response_start(data); - if (id < data->cb_count && data->cbs[id] != NULL) + if (id >= 0 && (gsize)id < data->cb_count && data->cbs[id] != NULL) while (group) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(group->data))) { ((PurpleRequestChoiceCb)data->cbs[id])(data->user_data, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(group->data), "choice_id"))); @@ -599,7 +599,7 @@ pidgin_request_action_with_icon(const char *title, const char *primary, void **buttons; char *label_text; char *primary_esc, *secondary_esc; - int i; + gsize i; data = g_new0(PidginRequestData, 1); data->type = PURPLE_REQUEST_ACTION; diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index acc19eea4f..97b93d2c66 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -574,7 +574,7 @@ static void pidgin_status_box_finalize(GObject *obj) { PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(obj); - int i; + gsize i; purple_signals_disconnect_by_handle(statusbox); purple_prefs_disconnect_by_handle(statusbox); @@ -873,7 +873,7 @@ status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed) /* This is a special case because Primitives for the token_status_account are actually * saved statuses with substatuses for the enabled accounts */ if (status_box->token_status_account && purple_savedstatus_is_transient(saved_status) - && type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) + && type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE && primitive == (PurpleStatusPrimitive)GPOINTER_TO_INT(data)) { char *name; const char *acct_status_name = purple_status_get_name( @@ -1189,7 +1189,7 @@ static void cache_pixbufs(PidginStatusBox *status_box) { GtkIconSize icon_size; - int i; + gsize i; g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL); icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c index f1102e22d9..d15040406a 100644 --- a/pidgin/gtkthemes.c +++ b/pidgin/gtkthemes.c @@ -315,14 +315,14 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) } while (*i) { char l[64]; - int li = 0; + size_t li = 0; char *next; while (*i && !isspace(*i) && li < sizeof(l) - 1) { if (*i == '\\' && *(i+1) != '\0') i++; /* coverity[tainted_data] */ next = g_utf8_next_char(i); - if ((next - i) > (sizeof(l) - li -1)) { + if ((size_t)(next - i) > (sizeof(l) - li -1)) { break; } while (i != next) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 4d4552f50a..5289f6e795 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -300,7 +300,7 @@ pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) { gboolean sensitivity; gpointer element; - int i; + guint i; for (i=0; i < data->len; i++) { element = g_ptr_array_index(data,i); diff --git a/pidgin/pidginstock.c b/pidgin/pidginstock.c index 79de271094..bd50db6717 100644 --- a/pidgin/pidginstock.c +++ b/pidgin/pidginstock.c @@ -403,7 +403,7 @@ void pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme) { GtkIconFactory *icon_factory; - gint i; + gsize i; GtkIconSet *normal; GtkIconSet *translucent = NULL; GtkWidget *win; @@ -491,7 +491,7 @@ void pidgin_stock_load_stock_icon_theme(PidginStockIconTheme *theme) { GtkIconFactory *icon_factory; - gint i; + gsize i; GtkWidget *win; if (theme != NULL) { diff --git a/pidgin/plugins/pidginrc.c b/pidgin/plugins/pidginrc.c index 3d9bc9c9eb..852fce0082 100644 --- a/pidgin/plugins/pidginrc.c +++ b/pidgin/plugins/pidginrc.c @@ -106,7 +106,7 @@ static GtkWidget *widget_bool_widgets[G_N_ELEMENTS(widget_bool_prefs)]; static GString * make_gtkrc_string(void) { - gint i; + gsize i; gchar *prefbase = NULL; GString *style_string = g_string_new(""); @@ -370,7 +370,7 @@ purplerc_make_interface_vbox(void) { GtkWidget *vbox = NULL, *hbox = NULL, *check = NULL; GtkSizeGroup *labelsg = NULL; - gint i; + gsize i; vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -409,7 +409,7 @@ purplerc_make_fonts_vbox(void) { GtkWidget *vbox = NULL, *hbox = NULL, *check = NULL, *widget = NULL; GtkSizeGroup *labelsg = NULL; - int i; + gsize i; vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -469,7 +469,7 @@ purplerc_make_misc_vbox(void) * the size group not the whole thing, which isn't what I want. */ GtkWidget *vbox = NULL, *hbox = NULL, *check = NULL, *widget = NULL; GtkSizeGroup *labelsg = NULL; - int i; + gsize i; vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); labelsg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -648,7 +648,7 @@ static PurplePluginInfo purplerc_info = static void purplerc_init(PurplePlugin *plugin) { - gint i; + gsize i; purple_prefs_add_none("/plugins"); purple_prefs_add_none("/plugins/gtk"); diff --git a/pidgin/plugins/spellchk.c b/pidgin/plugins/spellchk.c index ae7e767a82..00b4c20f80 100644 --- a/pidgin/plugins/spellchk.c +++ b/pidgin/plugins/spellchk.c @@ -126,7 +126,8 @@ make_word_proper(const gchar *word) gchar *ret; bytes = g_unichar_to_utf8(g_unichar_toupper(g_utf8_get_char(word)), buf); - buf[MIN(bytes, sizeof(buf) - 1)] = '\0'; + g_assert(bytes >= 0); + buf[MIN((gsize)bytes, sizeof(buf) - 1)] = '\0'; ret = g_strconcat(buf, g_utf8_offset_to_pointer(lower, 1), NULL); g_free(lower); @@ -675,10 +676,10 @@ spellchk_new_attach(PurpleConversation *conv) return; } -static int buf_get_line(char *ibuf, char **buf, int *position, gsize len) +static int buf_get_line(char *ibuf, char **buf, gsize *position, gsize len) { - int pos = *position; - int spos = pos; + gsize pos = *position; + gsize spos = pos; if (pos == len) return 0; @@ -1775,7 +1776,7 @@ static void load_conf(void) GHashTable *hashes; char bad[82] = ""; char good[256] = ""; - int pnt = 0; + gsize pnt = 0; gsize size; gboolean complete = TRUE; gboolean case_sensitive = FALSE; diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index 71a3038127..1c50fab7c9 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -109,7 +109,7 @@ get_element_devices(const gchar *element_name) !(pspec = gst_property_probe_get_property(probe, "device"))) { purple_debug_info("vvconfig", "'%s' - no device\n", element_name); } else { - gint n; + gsize n; GValueArray *array; /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */ |