Re: Probable boolean logic bug

Michael McConville <[email protected]> Mon, 18 Apr 2016 20:55:49 -0400
Newsgroups gmane.comp.gnome.nautilus
Message-ID <20160419005548.GA81760@thinkpad>
Carlos Soriano Sanchez wrote:
> Or should I?
> 
> I would like to have the appropriate author in the commit, but I
> understand if it's a burden for you.

Sure. I don't generally work with git-formatted patches, but I think I
did it right. Let me know if the below isn't what you're looking for.

Best,
Mike


From 24f5d8fda7b333ef595fc9279386c4ec84cafd73 Mon Sep 17 00:00:00 2001
From: Michael McConville <[email protected]>
Date: Mon, 18 Apr 2016 20:48:18 -0400
Subject: [PATCH] Fix boolean logic bug

A condition of the following form was used:

if (x != CONST_1 || x != CONST_2) ...

Where this was intended:

if (x != CONST_1 && x != CONST_2) ...

In its current form, it always evaluates to true.

Carlos Soriano Sanchez verified on the mailing list that this was a
mistake.
---
 libnautilus-private/nautilus-file-operations.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 1d9d319..e0a0897 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -4420,8 +4420,7 @@ do_run_conflict_dialog (gpointer _data)
 	if (response == CONFLICT_RESPONSE_RENAME) {
 		data->resp_data->new_name = 
 			nautilus_file_conflict_dialog_get_new_name (NAUTILUS_FILE_CONFLICT_DIALOG (dialog));
-	} else if (response != GTK_RESPONSE_CANCEL ||
-		   response != GTK_RESPONSE_NONE) {
+	} else if (response != GTK_RESPONSE_CANCEL && response != GTK_RESPONSE_NONE) {
 		   data->resp_data->apply_to_all =
 			   nautilus_file_conflict_dialog_get_apply_to_all 
 				(NAUTILUS_FILE_CONFLICT_DIALOG (dialog));
-- 
2.8.1

-- 
nautilus-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/nautilus-list