Re: Probable boolean logic bug



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 <mmcco mykolab com>
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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]