← Back to team overview

kicad-developers team mailing list archive

warning: enum constant in boolean context in dialog_print_generic.cpp

 

Hi Orson and KiCad devs,

During rebuilding current nightly I noticed this warning and decided to
look into it.

/usr/local/google/home/alutsenko/src/kicad/common/dialogs/dialog_print_generic.cpp:
In member function ‘virtual void
DIALOG_PRINT_GENERIC::onCloseButton(wxCommandEvent&)’:
/usr/local/google/home/alutsenko/src/kicad/common/dialogs/dialog_print_generic.cpp:246:24:
warning: enum constant in boolean context [-Wint-in-bool-context]
     Close( wxID_CANCEL );
                        ^
wxWindow::Close takes a boolean as an argument and wxID_CANCEL being not
zero means this will be interpreted as force close. I don't think this was
the intended behavior here.

Please take a look at my simple patch that fixes this warning and (I think)
a latent bug.

Regards,
Andrew Lutsenko
From b4ee7b53c30ef5ea273b1c77b40b5b79ea9f0ea6 Mon Sep 17 00:00:00 2001
From: qu1ck <anlutsenko@xxxxxxxxx>
Date: Tue, 6 Nov 2018 21:14:01 -0800
Subject: [PATCH] Fix warning in dialog_print_generic.cpp

---
 common/dialogs/dialog_print_generic.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/dialogs/dialog_print_generic.cpp b/common/dialogs/dialog_print_generic.cpp
index affa2937a..d5313de82 100644
--- a/common/dialogs/dialog_print_generic.cpp
+++ b/common/dialogs/dialog_print_generic.cpp
@@ -243,7 +243,7 @@ void DIALOG_PRINT_GENERIC::onCloseButton( wxCommandEvent& event )
     if( IsModal() )
         EndModal( wxID_CANCEL );
 
-    Close( wxID_CANCEL );
+    Close();
 }
 
 
-- 
2.19.1.930.g4563a0d9d0-goog


Follow ups