[Commits] [SCM] claws branch, master, updated. 3.14.1-86-gb2b913e

wwp at claws-mail.org wwp at claws-mail.org
Tue Dec 27 18:07:46 CET 2016


The branch, master has been updated
       via  b2b913e310f2876e5e4686ff5746be8e3c79d455 (commit)
      from  f69f1588a93e4988990617bba6ec03933b081693 (commit)

Summary of changes:
 src/gtk/gtkunit.c   |    3 +--
 src/passwordstore.c |   33 ++++++++++++++-------------------
 src/stock_pixmap.c  |    6 +++---
 3 files changed, 18 insertions(+), 24 deletions(-)


- Log -----------------------------------------------------------------
commit b2b913e310f2876e5e4686ff5746be8e3c79d455
Author: wwp <wwp at free.fr>
Date:   Tue Dec 27 18:06:11 2016 +0100

    Fix compiler warnings when we test enum-based variables for impossible
    <0 values.

diff --git a/src/gtk/gtkunit.c b/src/gtk/gtkunit.c
index 5652610..4c0f47a 100644
--- a/src/gtk/gtkunit.c
+++ b/src/gtk/gtkunit.c
@@ -436,8 +436,7 @@ gtk_unit_format_string (const gchar *format,
 
   g_return_val_if_fail (format != NULL, NULL);
   g_return_val_if_fail (unit == CM_UNIT_PERCENT ||
-                        (unit >= CM_UNIT_PIXEL &&
-                         unit < gtk_unit_get_number_of_units ()), NULL);
+                        (unit < gtk_unit_get_number_of_units ()), NULL);
 
   while (i < (sizeof (buffer) - 1) && *format)
     {
diff --git a/src/passwordstore.c b/src/passwordstore.c
index 95946ef..68f4b51 100644
--- a/src/passwordstore.c
+++ b/src/passwordstore.c
@@ -45,8 +45,7 @@ static PasswordBlock *_get_block(PasswordBlockType block_type,
 	GSList *item;
 	PasswordBlock *block;
 
-	g_return_val_if_fail(block_type >= 0 && block_type < NUM_PWS_TYPES,
-			NULL);
+	g_return_val_if_fail(block_type < NUM_PWS_TYPES, NULL);
 	g_return_val_if_fail(block_name != NULL, NULL);
 
 	for (item = _password_store; item != NULL; item = item->next) {
@@ -72,8 +71,7 @@ static PasswordBlock *_new_block(PasswordBlockType block_type,
 {
 	PasswordBlock *block;
 
-	g_return_val_if_fail(block_type >= 0 && block_type < NUM_PWS_TYPES,
-			NULL);
+	g_return_val_if_fail(block_type < NUM_PWS_TYPES, NULL);
 	g_return_val_if_fail(block_name != NULL, NULL);
 
 	/* First check to see if the block doesn't already exist. */
@@ -98,7 +96,7 @@ static PasswordBlock *_new_block(PasswordBlockType block_type,
 	return block;
 }
 
-///////////////////////////////////////////////////////////////
+/*************************************************************/
 
 /* Stores a password. */
 gboolean passwd_store_set(PasswordBlockType block_type,
@@ -111,8 +109,7 @@ gboolean passwd_store_set(PasswordBlockType block_type,
 	PasswordBlock *block;
 	gchar *encrypted_password;
 
-	g_return_val_if_fail(block_type >= 0 && block_type < NUM_PWS_TYPES,
-			FALSE);
+	g_return_val_if_fail(block_type < NUM_PWS_TYPES, FALSE);
 	g_return_val_if_fail(block_name != NULL, FALSE);
 	g_return_val_if_fail(password_id != NULL, FALSE);
 
@@ -127,7 +124,7 @@ gboolean passwd_store_set(PasswordBlockType block_type,
 			password_id, block_type, block_name,
 			(encrypted ? ", already encrypted" : "") );
 
-	// find correct block (create if needed)
+	/* find correct block (create if needed) */
 	if ((block = _get_block(block_type, block_name)) == NULL) {
 		/* If caller wants to delete a password, and even its block
 		 * doesn't exist, we're done. */
@@ -159,7 +156,7 @@ gboolean passwd_store_set(PasswordBlockType block_type,
 			encrypted_password = g_strdup(p);
 		}
 
-		// add encrypted password to the block
+		/* add encrypted password to the block */
 		g_hash_table_insert(block->entries,
 				g_strdup(password_id),
 				encrypted_password);
@@ -176,21 +173,20 @@ gchar *passwd_store_get(PasswordBlockType block_type,
 	PasswordBlock *block;
 	gchar *encrypted_password, *password;
 
-	g_return_val_if_fail(block_type >= 0 && block_type < NUM_PWS_TYPES,
-			NULL);
+	g_return_val_if_fail(block_type < NUM_PWS_TYPES, NULL);
 	g_return_val_if_fail(block_name != NULL, NULL);
 	g_return_val_if_fail(password_id != NULL, NULL);
 
 	debug_print("Getting password '%s' from block (%d/%s)\n",
 			password_id, block_type, block_name);
 
-	// find correct block
+	/* find correct block */
 	if ((block = _get_block(block_type, block_name)) == NULL) {
 		debug_print("Block (%d/%s) not found.\n", block_type, block_name);
 		return NULL;
 	}
 
-	// grab pointer to encrypted password
+	/* grab pointer to encrypted password */
 	if ((encrypted_password =
 				g_hash_table_lookup(block->entries, password_id)) == NULL) {
 		debug_print("Password '%s' in block (%d/%s) not found.\n",
@@ -198,7 +194,7 @@ gchar *passwd_store_get(PasswordBlockType block_type,
 		return NULL;
 	}
 
-	// decrypt password
+	/* decrypt password */
 	if ((password =
 				password_decrypt(encrypted_password, NULL)) == NULL) {
 		debug_print("Could not decrypt password '%s' for block (%d/%s).\n",
@@ -206,7 +202,7 @@ gchar *passwd_store_get(PasswordBlockType block_type,
 		return NULL;
 	}
 
-	// return decrypted password
+	/* return decrypted password */
 	return password;
 }
 
@@ -215,13 +211,12 @@ gboolean passwd_store_delete_block(PasswordBlockType block_type,
 {
 	PasswordBlock *block;
 
-	g_return_val_if_fail(block_type >= 0 && block_type < NUM_PWS_TYPES,
-			FALSE);
+	g_return_val_if_fail(block_type < NUM_PWS_TYPES, FALSE);
 	g_return_val_if_fail(block_name != NULL, FALSE);
 
 	debug_print("Deleting block (%d/%s)\n", block_type, block_name);
 
-	// find correct block
+	/* find correct block */
 	if ((block = _get_block(block_type, block_name)) == NULL) {
 		debug_print("Block (%d/%s) not found.\n", block_type, block_name);
 		return FALSE;
@@ -401,7 +396,7 @@ void passwd_store_read_config(void)
 	PasswordBlock *block = NULL;
 	PasswordBlockType type;
 
-	// TODO: passwd_store_clear();
+	/* TODO: passwd_store_clear(); */
 
 	debug_print("Reading password store from file...\n");
 
diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c
index 702b45c..b73ebc2 100644
--- a/src/stock_pixmap.c
+++ b/src/stock_pixmap.c
@@ -464,7 +464,7 @@ GtkWidget *stock_pixmap_widget(StockPixmap icon)
 {
 	GdkPixbuf *pixbuf;
 
-	cm_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, NULL);
+	cm_return_val_if_fail(icon < N_STOCK_PIXMAPS, NULL);
 
 	if (stock_pixbuf_gdk(icon, &pixbuf) != -1)
 		return gtk_image_new_from_pixbuf(pixbuf);
@@ -485,7 +485,7 @@ gint stock_pixbuf_gdk(StockPixmap icon, GdkPixbuf **pixbuf)
 	if (pixbuf)
 		*pixbuf = NULL;
 
-	cm_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, -1);
+	cm_return_val_if_fail(icon < N_STOCK_PIXMAPS, -1);
 
 	pix_d = &pixmaps[icon];
 
@@ -635,7 +635,7 @@ void stock_pixmap_themes_list_free(GList *list)
 
 gchar *stock_pixmap_get_name (StockPixmap icon)
 {
-	if (icon < 0 || icon >= N_STOCK_PIXMAPS)
+	if (icon >= N_STOCK_PIXMAPS)
 		return NULL;
 
 	return pixmaps[icon].file;

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list