[seahorse] Fixes signedness mismatches and length check.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Fixes signedness mismatches and length check.
- Date: Mon, 27 May 2013 09:15:53 +0000 (UTC)
commit 0688d474c2070873905615f1b2bad876e41d27a0
Author: Alban Browaeys <prahal yahoo com>
Date: Sun Apr 28 15:20:55 2013 +0200
Fixes signedness mismatches and length check.
Length check vs minus one, check against negative value.
https://bugzilla.gnome.org/show_bug.cgi?id=699147
libseahorse/seahorse-object-model.c | 10 +++++-----
libseahorse/seahorse-prefs.c | 2 +-
libseahorse/seahorse-util.c | 2 +-
pgp/seahorse-gpgme-expires.c | 2 +-
pgp/seahorse-gpgme-exporter.c | 2 +-
pgp/seahorse-gpgme-generate.c | 6 +++---
pgp/seahorse-gpgme-key-op.c | 6 +++---
pgp/seahorse-gpgme-keyring.c | 2 +-
pgp/seahorse-gpgme-photos.c | 4 ++--
pgp/seahorse-pgp-key-properties.c | 4 ++--
src/seahorse-sidebar.c | 2 +-
ssh/seahorse-ssh-askpass.c | 2 +-
ssh/seahorse-ssh-generate.c | 2 +-
ssh/seahorse-ssh-key-data.c | 4 ++--
ssh/seahorse-ssh-key-data.h | 2 +-
ssh/seahorse-ssh-operation.c | 2 +-
ssh/seahorse-ssh-source.c | 4 ++--
17 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/libseahorse/seahorse-object-model.c b/libseahorse/seahorse-object-model.c
index 123e124..ceb9b9f 100644
--- a/libseahorse/seahorse-object-model.c
+++ b/libseahorse/seahorse-object-model.c
@@ -41,7 +41,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
typedef struct _SeahorseObjectModelPrivate {
GHashTable *rows;
- guint data_column;
+ gint data_column;
} SeahorseObjectModelPrivate;
G_DEFINE_TYPE (SeahorseObjectModel, seahorse_object_model, GTK_TYPE_TREE_STORE);
@@ -71,7 +71,7 @@ key_notify (GObject *object,
SeahorseObjectRow *skrow;
GtkTreeIter iter;
GtkTreePath *path;
- int i;
+ guint i;
skrow = g_hash_table_lookup (pv->rows, object);
if (!skrow)
@@ -311,7 +311,7 @@ seahorse_object_model_set_row_object (SeahorseObjectModel *self,
SeahorseObjectRow *skrow;
GtkTreePath *path;
GtkTreePath *ipath;
- int i;
+ guint i;
g_return_if_fail (SEAHORSE_IS_OBJECT_MODEL (self));
g_return_if_fail (G_IS_OBJECT (object) || object == NULL);
@@ -394,7 +394,7 @@ seahorse_object_model_remove_rows_for_object (SeahorseObjectModel *self,
SeahorseObjectRow *skrow;
GtkTreeIter iter;
GtkTreePath *path;
- int i;
+ guint i;
g_return_if_fail (SEAHORSE_IS_OBJECT_MODEL (self));
g_return_if_fail (G_IS_OBJECT (object));
@@ -427,7 +427,7 @@ seahorse_object_model_get_rows_for_object (SeahorseObjectModel *self,
SeahorseObjectRow *skrow;
GtkTreeIter *iter;
GtkTreePath *path;
- int i;
+ guint i;
g_return_val_if_fail (SEAHORSE_IS_OBJECT_MODEL (self), NULL);
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
diff --git a/libseahorse/seahorse-prefs.c b/libseahorse/seahorse-prefs.c
index 2b8daa2..2bd9224 100644
--- a/libseahorse/seahorse-prefs.c
+++ b/libseahorse/seahorse-prefs.c
@@ -234,7 +234,7 @@ calculate_keyserver_uri (SeahorseWidget *swidget)
gchar **types;
gint active;
gchar *uri;
- guint i;
+ gint i;
/* Figure out the scheme */
widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "keyserver-type"));
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index d342889..13c9615 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -224,7 +224,7 @@ seahorse_util_get_display_date_string (const time_t time)
guchar*
seahorse_util_read_to_memory (GInputStream *input, guint *len)
{
- gint size = 128;
+ gsize size = 128;
gchar *buffer, *text;
gsize nread = 0;
GString *string;
diff --git a/pgp/seahorse-gpgme-expires.c b/pgp/seahorse-gpgme-expires.c
index a3788e7..a6d8289 100644
--- a/pgp/seahorse-gpgme-expires.c
+++ b/pgp/seahorse-gpgme-expires.c
@@ -73,7 +73,7 @@ on_gpgme_expire_ok_clicked (GtkButton *button,
g_object_ref (swidget);
g_object_ref (subkey);
- if (expiry != seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey))) {
+ if (expiry != (time_t)seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey))) {
err = seahorse_gpgme_key_op_set_expires (subkey, expiry);
if (!GPG_IS_OK (err))
seahorse_gpgme_handle_error (err, _("Couldn't change expiry date"));
diff --git a/pgp/seahorse-gpgme-exporter.c b/pgp/seahorse-gpgme-exporter.c
index 78a7054..f53791d 100644
--- a/pgp/seahorse-gpgme-exporter.c
+++ b/pgp/seahorse-gpgme-exporter.c
@@ -293,7 +293,7 @@ on_keyring_export_complete (gpgme_error_t gerr,
g_assert (closure->at < (gint)closure->keyids->len);
closure->at++;
- if (closure->at == closure->keyids->len) {
+ if (closure->at == (gint)closure->keyids->len) {
g_simple_async_result_complete (res);
return FALSE; /* don't run this again */
}
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index b4aba1b..d0768d1 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -52,7 +52,7 @@
**/
void on_gpgme_generate_response (GtkDialog *dialog,
- guint response,
+ gint response,
gpointer user_data);
void on_gpgme_generate_entry_changed (GtkEditable *editable,
@@ -248,7 +248,7 @@ seahorse_gpgme_generate_key (SeahorseGpgmeKeyring *keyring,
*/
G_MODULE_EXPORT void
on_gpgme_generate_response (GtkDialog *dialog,
- guint response,
+ gint response,
gpointer user_data)
{
SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
@@ -296,7 +296,7 @@ on_gpgme_generate_response (GtkDialog *dialog,
widget = seahorse_widget_get_widget (swidget, "algorithm-choice");
g_return_if_fail (widget != NULL);
sel = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
- g_assert (sel <= G_N_ELEMENTS(available_algorithms));
+ g_assert (sel <= (gint) G_N_ELEMENTS(available_algorithms));
type = available_algorithms[sel].type;
/* The number of bits */
diff --git a/pgp/seahorse-gpgme-key-op.c b/pgp/seahorse-gpgme-key-op.c
index a529daf..f725972 100644
--- a/pgp/seahorse-gpgme-key-op.c
+++ b/pgp/seahorse-gpgme-key-op.c
@@ -1180,7 +1180,7 @@ seahorse_gpgme_key_op_set_expires (SeahorseGpgmeSubkey *subkey, const time_t exp
gpgme_key_t key;
g_return_val_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (expires != seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey)),
GPG_E (GPG_ERR_INV_VALUE));
+ g_return_val_if_fail (expires != (time_t)seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY
(subkey)), GPG_E (GPG_ERR_INV_VALUE));
key = seahorse_gpgme_subkey_get_pubkey (subkey);
g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
@@ -2359,7 +2359,7 @@ seahorse_gpgme_key_op_photo_delete (SeahorseGpgmePhoto *photo)
typedef struct {
GList *photos;
- gint uid;
+ guint uid;
guint num_uids;
char *output_file;
gpgme_key_t key;
@@ -2524,7 +2524,7 @@ seahorse_gpgme_key_op_photos_load (SeahorseGpgmeKey *pkey)
const gchar *oldpath;
const gchar *keyid;
gchar *path;
- guint fd;
+ gint fd;
g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
diff --git a/pgp/seahorse-gpgme-keyring.c b/pgp/seahorse-gpgme-keyring.c
index fee498f..da30fe6 100644
--- a/pgp/seahorse-gpgme-keyring.c
+++ b/pgp/seahorse-gpgme-keyring.c
@@ -623,7 +623,7 @@ on_keyring_import_complete (gpgme_error_t gerr,
gpgme_import_status_t import;
GError *error = NULL;
const gchar *msg;
- guint i;
+ gint i;
if (seahorse_gpgme_propagate_error (gerr, &error)) {
g_simple_async_result_take_error (res, error);
diff --git a/pgp/seahorse-gpgme-photos.c b/pgp/seahorse-gpgme-photos.c
index c6215f2..aa6ca87 100644
--- a/pgp/seahorse-gpgme-photos.c
+++ b/pgp/seahorse-gpgme-photos.c
@@ -89,10 +89,10 @@ static gboolean
save_to_fd (const gchar *buf, gsize count, GError **error, gpointer data)
{
int fd = GPOINTER_TO_INT (data);
- int written;
+ gssize written;
written = write (fd, buf, count);
- if (written != count) {
+ if (written != (gssize) count) {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
"%s", g_strerror (errno));
return FALSE;
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 69968d1..cf9e38a 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -261,7 +261,7 @@ on_pgp_signature_row_activated (GtkTreeView *treeview,
static void
unique_strings (GPtrArray *keyids)
{
- gint i;
+ guint i;
g_ptr_array_sort (keyids, (GCompareFunc)g_ascii_strcasecmp);
for (i = 0; i + 1 < keyids->len; ) {
@@ -1530,7 +1530,7 @@ on_pgp_trust_marginal_toggled (GtkToggleButton *toggle,
{
SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
GObject *object;
- guint trust;
+ SeahorseValidity trust;
gpgme_error_t err;
object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
diff --git a/src/seahorse-sidebar.c b/src/seahorse-sidebar.c
index abc4e04..5390e15 100644
--- a/src/seahorse-sidebar.c
+++ b/src/seahorse-sidebar.c
@@ -1367,7 +1367,7 @@ seahorse_sidebar_dispose (GObject *obj)
{
SeahorseSidebar *self = SEAHORSE_SIDEBAR (obj);
GList *places, *l;
- gint i;
+ guint i;
for (i = 0; i < self->backends->len; i++) {
g_signal_handlers_disconnect_by_func (self->backends->pdata[i], on_place_added, self);
diff --git a/ssh/seahorse-ssh-askpass.c b/ssh/seahorse-ssh-askpass.c
index 7b380a1..bfea5fb 100644
--- a/ssh/seahorse-ssh-askpass.c
+++ b/ssh/seahorse-ssh-askpass.c
@@ -43,7 +43,7 @@ main (int argc, char* argv[])
const gchar *flags;
gint result;
const gchar *pass;
- gsize len;
+ gssize len;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
diff --git a/ssh/seahorse-ssh-generate.c b/ssh/seahorse-ssh-generate.c
index 2703e52..6ba1019 100644
--- a/ssh/seahorse-ssh-generate.c
+++ b/ssh/seahorse-ssh-generate.c
@@ -133,7 +133,7 @@ on_generate_complete_and_upload (GObject *source,
}
static void
-on_response (GtkDialog *dialog, guint response, SeahorseWidget *swidget)
+on_response (GtkDialog *dialog, gint response, SeahorseWidget *swidget)
{
SeahorseSSHSource *src;
GCancellable *cancellable;
diff --git a/ssh/seahorse-ssh-key-data.c b/ssh/seahorse-ssh-key-data.c
index aabb8db..f050188 100644
--- a/ssh/seahorse-ssh-key-data.c
+++ b/ssh/seahorse-ssh-key-data.c
@@ -307,7 +307,7 @@ seahorse_ssh_key_data_parse_file (const gchar *filename, SeahorseSSHPublicKeyPa
}
SeahorseSSHKeyData*
-seahorse_ssh_key_data_parse_line (const gchar *line, guint length)
+seahorse_ssh_key_data_parse_line (const gchar *line, gssize length)
{
SeahorseSSHKeyData *keydata = NULL;
gchar *x;
@@ -323,7 +323,7 @@ seahorse_ssh_key_data_parse_line (const gchar *line, guint length)
if (!*line || *line == '#')
return NULL;
- x = g_strndup (line, length == -1 ? strlen (line) : length);
+ x = g_strndup (line, length < 0 ? strlen (line) : (gsize) length);
keydata = g_new0 (SeahorseSSHKeyData, 1);
if (!parse_key_data (x, keydata)) {
diff --git a/ssh/seahorse-ssh-key-data.h b/ssh/seahorse-ssh-key-data.h
index 1a7e8eb..ef1155c 100644
--- a/ssh/seahorse-ssh-key-data.h
+++ b/ssh/seahorse-ssh-key-data.h
@@ -82,7 +82,7 @@ guint seahorse_ssh_key_data_parse_file (const gchar *file
GError **error);
SeahorseSSHKeyData* seahorse_ssh_key_data_parse_line (const gchar *line,
- guint length);
+ gssize length);
gboolean seahorse_ssh_key_data_match (const gchar *line,
gint length,
diff --git a/ssh/seahorse-ssh-operation.c b/ssh/seahorse-ssh-operation.c
index 6b69534..5bc6dce 100644
--- a/ssh/seahorse-ssh-operation.c
+++ b/ssh/seahorse-ssh-operation.c
@@ -408,7 +408,7 @@ seahorse_ssh_operation_async (SeahorseSSHSource *source,
/* Copy the input for later writing */
if (input) {
- closure->sin = g_string_new_len (input, length == -1 ? strlen (input) : length);
+ closure->sin = g_string_new_len (input, length < 0 ? (gssize) strlen (input) : length);
seahorse_debug ("SSHOP: Will send SSH input: %s", closure->sin->str);
fcntl (fin, F_SETFL, O_NONBLOCK | fcntl (fin, F_GETFL));
diff --git a/ssh/seahorse-ssh-source.c b/ssh/seahorse-ssh-source.c
index 2bda2b0..609c360 100644
--- a/ssh/seahorse-ssh-source.c
+++ b/ssh/seahorse-ssh-source.c
@@ -789,7 +789,7 @@ seahorse_ssh_source_import_async (SeahorseSSHSource *self,
source_import_closure *closure;
gchar *contents;
GSimpleAsyncResult *res;
- guint count;
+ gint count;
res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
seahorse_ssh_source_import_async);
@@ -862,7 +862,7 @@ seahorse_ssh_source_file_for_algorithm (SeahorseSSHSource *ssrc, guint algo)
{
const gchar *pref;
gchar *filename, *t;
- guint i = 0;
+ gint i = 0;
switch (algo) {
case SSH_ALGO_DSA:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]