]> git.saurik.com Git - wxWidgets.git/commitdiff
fix warnings about conversion to bool, closes #14381
authorPaul Cornett <paulcor@bullseye.com>
Thu, 7 Jun 2012 05:18:30 +0000 (05:18 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 7 Jun 2012 05:18:30 +0000 (05:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
src/gtk/app.cpp
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/checklst.cpp
src/gtk/clipbrd.cpp
src/gtk/dataview.cpp
src/gtk/filectrl.cpp
src/gtk/listbox.cpp
src/gtk/menu.cpp
src/gtk/radiobox.cpp
src/gtk/region.cpp
src/gtk/spinctrl.cpp
src/gtk/textctrl.cpp
src/gtk/textentry.cpp
src/gtk/toplevel.cpp
src/gtk/window.cpp
src/msw/ole/uuid.cpp

index ebe21af915cd4a0d0e05e272ef79edc845928dfe..318952f62bb38439b09f7c5c3f6db3346b48043e 100644 (file)
@@ -368,7 +368,7 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_)
     init_result = true;  // is there a _check() version of this?
     gpe_application_init( &argcGTK, &argvGTK );
 #else
-    init_result = gtk_init_check( &argcGTK, &argvGTK );
+    init_result = gtk_init_check( &argcGTK, &argvGTK ) != 0;
 #endif
     wxUpdateLocaleIsUtf8();
 
index cf3fb8b26aea5aaff6be2c5278e78b97a5e25134..d668fb6cce6c1e53d9698424d4bd1d5dd890e1d5 100644 (file)
@@ -295,7 +295,7 @@ wxSize wxButton::DoGetBestSize() const
     // extra border around it, but we don't want to take it into account in
     // our size calculations (otherwise the result is visually ugly), so
     // always return the size of non default button from here
-    const bool isDefault = gtk_widget_has_default(m_widget);
+    const bool isDefault = gtk_widget_has_default(m_widget) != 0;
     if ( isDefault )
     {
         // temporarily unset default flag
index f7dc166843533f4eb425e9d91d0a709334abd767..f793ad7088062cd710cc4102d6a22a64f83e9c87 100644 (file)
@@ -44,8 +44,8 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb)
         {
             // The 3 states cycle like this when clicked:
             // checked -> undetermined -> unchecked -> checked -> ...
-            bool active = gtk_toggle_button_get_active(toggle);
-            bool inconsistent = gtk_toggle_button_get_inconsistent(toggle);
+            bool active = gtk_toggle_button_get_active(toggle) != 0;
+            bool inconsistent = gtk_toggle_button_get_inconsistent(toggle) != 0;
 
             cb->GTKDisableEvents();
 
@@ -177,7 +177,7 @@ bool wxCheckBox::GetValue() const
 {
     wxCHECK_MSG( m_widgetCheckbox != NULL, false, wxT("invalid checkbox") );
 
-    return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widgetCheckbox));
+    return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widgetCheckbox)) != 0;
 }
 
 void wxCheckBox::DoSet3StateValue(wxCheckBoxState state)
index a75aebf608ef942e4e12dea3f0be8ebe25e4ac62..e0826434223d6af71ef447fd0e04eee0fd5e8974 100644 (file)
@@ -121,7 +121,7 @@ bool wxCheckListBox::IsChecked(unsigned int index) const
                              0, //column
                              &value);
 
-    return g_value_get_boolean(&value) == TRUE ? true : false;
+    return g_value_get_boolean(&value) != 0;
 }
 
 void wxCheckListBox::Check(unsigned int index, bool check)
index fa9c32bc84cd0db477330d849670fa0b066fc258..aeb6af2ea06ac2538ace64d70cde2ebfd08e342f 100644 (file)
@@ -507,7 +507,7 @@ bool wxClipboard::SetSelectionOwner(bool set)
                 set ? m_clipboardWidget : NULL,
                 GTKGetClipboardAtom(),
                 (guint32)GDK_CURRENT_TIME
-              );
+              ) != 0;
 
     if ( !rc )
     {
index 01fad1c67ce1fc1aa09760aa2d2ee666eabc10df..8a6dba495a51e9d5a9d45ccba8893e4e376d9721 100644 (file)
@@ -2257,12 +2257,10 @@ static void wxGtkToggleRendererToggledCallback( GtkCellRendererToggle *renderer,
     GValue gvalue = { 0, };
     g_value_init( &gvalue, G_TYPE_BOOLEAN );
     g_object_get_property( G_OBJECT(renderer), "active", &gvalue );
-    bool tmp = g_value_get_boolean( &gvalue );
-    g_value_unset( &gvalue );
     // invert it
-    tmp = !tmp;
+    wxVariant value = !g_value_get_boolean( &gvalue );
+    g_value_unset( &gvalue );
 
-    wxVariant value = tmp;
     if (!cell->Validate( value ))
         return;
 
@@ -2320,11 +2318,9 @@ bool wxDataViewToggleRenderer::GetValue( wxVariant &value ) const
     GValue gvalue = { 0, };
     g_value_init( &gvalue, G_TYPE_BOOLEAN );
     g_object_get_property( G_OBJECT(m_renderer), "active", &gvalue );
-    bool tmp = g_value_get_boolean( &gvalue );
+    value = g_value_get_boolean( &gvalue ) != 0;
     g_value_unset( &gvalue );
 
-    value = tmp;
-
     return true;
 }
 
@@ -2625,7 +2621,7 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString &choices
                 "has-entry", FALSE,
                 NULL);
 
-        bool editable = (mode & wxDATAVIEW_CELL_EDITABLE);
+        bool editable = (mode & wxDATAVIEW_CELL_EDITABLE) != 0;
         g_object_set (m_renderer, "editable", editable, NULL);
 
         SetAlignment(alignment);
@@ -3143,19 +3139,19 @@ void wxDataViewColumn::SetSortable( bool sortable )
 bool wxDataViewColumn::IsSortable() const
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    return gtk_tree_view_column_get_clickable( column );
+    return gtk_tree_view_column_get_clickable( column ) != 0;
 }
 
 bool wxDataViewColumn::IsSortKey() const
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    return gtk_tree_view_column_get_sort_indicator( column );
+    return gtk_tree_view_column_get_sort_indicator( column ) != 0;
 }
 
 bool wxDataViewColumn::IsResizeable() const
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    return gtk_tree_view_column_get_resizable( column );
+    return gtk_tree_view_column_get_resizable( column ) != 0;
 }
 
 bool wxDataViewColumn::IsHidden() const
@@ -3225,7 +3221,7 @@ void wxDataViewColumn::SetReorderable( bool reorderable )
 
 bool wxDataViewColumn::IsReorderable() const
 {
-    return gtk_tree_view_column_get_reorderable( GTK_TREE_VIEW_COLUMN(m_column) );
+    return gtk_tree_view_column_get_reorderable( GTK_TREE_VIEW_COLUMN(m_column) ) != 0;
 }
 
 //-----------------------------------------------------------------------------
@@ -4811,7 +4807,7 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
     GtkTreeIter iter;
     iter.user_data = item.GetID();
     wxGtkTreePath path(m_internal->get_path( &iter ));
-    return gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path );
+    return gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path ) != 0;
 }
 
 wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
@@ -4996,7 +4992,7 @@ bool wxDataViewCtrl::IsSelected( const wxDataViewItem & item ) const
     iter.stamp = m_internal->GetGtkModel()->stamp;
     iter.user_data = (gpointer) item.GetID();
 
-    return gtk_tree_selection_iter_is_selected( selection, &iter );
+    return gtk_tree_selection_iter_is_selected( selection, &iter ) != 0;
 }
 
 void wxDataViewCtrl::SelectAll()
index 4c0d97ba34a4967fa548ddf0b0d559188c88bfef..70cd51acbd58329ac439cd9f292f3c1b21e55ff9 100644 (file)
@@ -88,7 +88,7 @@ bool wxGtkFileChooser::SetPath( const wxString& path )
     if ( path.empty() )
         return true;
 
-    return gtk_file_chooser_set_filename( m_widget, path.utf8_str() );
+    return gtk_file_chooser_set_filename( m_widget, path.utf8_str() ) != 0;
 }
 
 bool wxGtkFileChooser::SetDirectory( const wxString& dir )
index b6945a51f48e40b20211621532ccfc5b22e5b2b3..621f0199c992c75d6eea1cd31b5118a407534c50 100644 (file)
@@ -729,7 +729,7 @@ bool wxListBox::IsSelected( int n ) const
     GtkTreeIter iter;
     wxCHECK_MSG( GTKGetIteratorFor(n, &iter), false, wxT("Invalid index") );
 
-    return gtk_tree_selection_iter_is_selected(selection, &iter);
+    return gtk_tree_selection_iter_is_selected(selection, &iter) != 0;
 }
 
 void wxListBox::DoSetSelection( int n, bool select )
index f0dbd471f767bdb18be9e2e8107fbf926f22f6aa..b19352d17ce4bd9c5dc7c8d470f02ffe20c2d1b1 100644 (file)
@@ -434,7 +434,7 @@ bool wxMenuBar::IsEnabledTop(size_t pos) const
     wxCHECK_MSG( node, false, wxS("invalid index in IsEnabledTop") );
     wxMenu* const menu = node->GetData();
     wxCHECK_MSG( menu->m_owner, true, wxS("no menu owner?") );
-    return gtk_widget_get_sensitive( menu->m_owner );
+    return gtk_widget_get_sensitive( menu->m_owner ) != 0;
 }
 
 wxString wxMenuBar::GetMenuLabel( size_t pos ) const
index eace0af70b6d3ec659b92b0edf1c98de88443d36..db1bc95ab15d7a9255edad60d3852102d6bd5723 100644 (file)
@@ -88,7 +88,7 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
         // GDK reports GDK_ISO_Left_Tab for SHIFT-TAB
         new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
         // CTRL-TAB changes the (parent) window, i.e. switch notebook page
-        new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
+        new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) != 0 );
         new_event.SetCurrentFocus( rb );
         return rb->GetParent()->HandleWindowEvent(new_event);
     }
@@ -475,7 +475,7 @@ bool wxRadioBox::IsItemEnabled(unsigned int item) const
 
     // don't use GTK_WIDGET_IS_SENSITIVE() here, we want to return true even if
     // the parent radiobox is disabled
-    return gtk_widget_get_sensitive(GTK_WIDGET(button));
+    return gtk_widget_get_sensitive(GTK_WIDGET(button)) != 0;
 }
 
 bool wxRadioBox::Show(unsigned int item, bool show)
@@ -506,7 +506,7 @@ bool wxRadioBox::IsItemShown(unsigned int item) const
 
     GtkButton *button = GTK_BUTTON( node->GetData()->button );
 
-    return gtk_widget_get_visible(GTK_WIDGET(button));
+    return gtk_widget_get_visible(GTK_WIDGET(button)) != 0;
 }
 
 unsigned int wxRadioBox::GetCount() const
index 92ec47f1e790cf18884d97512405345fee55a8d4..1e1cb84e8fbf82f450a6c1327c3ff49abc0efe54 100644 (file)
@@ -137,7 +137,7 @@ wxGDIRefData *wxRegion::CloneGDIRefData(const wxGDIRefData *data) const
 bool wxRegion::DoIsEqual(const wxRegion& region) const
 {
     return gdk_region_equal(M_REGIONDATA->m_region,
-                            M_REGIONDATA_OF(region)->m_region);
+                            M_REGIONDATA_OF(region)->m_region) != 0;
 }
 
 // ----------------------------------------------------------------------------
@@ -292,7 +292,7 @@ bool wxRegion::IsEmpty() const
     if (!m_refData)
         return true;
 
-    return gdk_region_empty( M_REGIONDATA->m_region );
+    return gdk_region_empty( M_REGIONDATA->m_region ) != 0;
 }
 
 wxRegionContain wxRegion::DoContainsPoint( wxCoord x, wxCoord y ) const
index f35eca84452dcb4b55f319d834ae7db6b883e4eb..8a7e8649e3245a4eea05187c51be47c0c671dff1 100644 (file)
@@ -195,7 +195,7 @@ bool wxSpinCtrlGTKBase::GetSnapToTicks() const
 {
     wxCHECK_MSG(m_widget, false, "invalid spin button");
 
-    return gtk_spin_button_get_snap_to_ticks( GTK_SPIN_BUTTON(m_widget) );
+    return gtk_spin_button_get_snap_to_ticks( GTK_SPIN_BUTTON(m_widget) ) != 0;
 }
 
 void wxSpinCtrlGTKBase::SetValue( const wxString& value )
index ac6026106440519822bcff862b0e3c4803507265..12d35c479b482cd8252891f4271387d602881faf 100644 (file)
@@ -1599,7 +1599,7 @@ bool wxTextCtrl::IsEditable() const
 
     if ( IsMultiLine() )
     {
-        return gtk_text_view_get_editable(GTK_TEXT_VIEW(m_text));
+        return gtk_text_view_get_editable(GTK_TEXT_VIEW(m_text)) != 0;
     }
     else
     {
index d631d5889903477764b06c7be692e76bd5076dbd..7d543738a38fbbe88753e8cd12a75ae9f9d249e3 100644 (file)
@@ -279,7 +279,7 @@ bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
 
 bool wxTextEntry::IsEditable() const
 {
-    return gtk_editable_get_editable(GetEditable());
+    return gtk_editable_get_editable(GetEditable()) != 0;
 }
 
 void wxTextEntry::SetEditable(bool editable)
index 05452347b0d29befa5438a1ba6a324499a6b5dd0..0dd59d4b330e95457eae77fe01f71aa86f5d68eb 100644 (file)
@@ -1433,7 +1433,7 @@ bool wxTopLevelWindowGTK::CanSetTransparent()
 #if GTK_CHECK_VERSION(2,10,0)
     if (!gtk_check_version(2,10,0))
     {
-        return (gtk_widget_is_composited (m_widget));
+        return gtk_widget_is_composited(m_widget) != 0;
     }
     else
 #endif // In case of lower versions than gtk+-2.10.0 we could look for _NET_WM_CM_Sn ourselves
index 4f9ce50f42ab0413d954e277e9f1db3c03cb7cd9..4178eddb5729d9c1612df273c082c4667cc8caa4 100644 (file)
@@ -923,7 +923,8 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget),
         // We should let GTK+ IM filter key event first. According to GTK+ 2.0 API
         // docs, if IM filter returns true, no further processing should be done.
         // we should send the key_down event anyway.
-        bool intercepted_by_IM = gtk_im_context_filter_keypress(win->m_imData->context, gdk_event);
+        bool intercepted_by_IM =
+            gtk_im_context_filter_keypress(win->m_imData->context, gdk_event) != 0;
         win->m_imData->lastKeyEvent = NULL;
         if (intercepted_by_IM)
         {
@@ -3417,7 +3418,7 @@ bool wxWindowGTK::DoNavigateIn(int flags)
         gboolean rc;
         g_signal_emit_by_name(parent->m_widget, "focus", dir, &rc);
 
-        return rc == TRUE;
+        return rc != 0;
     }
 }
 
@@ -3883,7 +3884,7 @@ void wxWindowGTK::SetDoubleBuffered( bool on )
 
 bool wxWindowGTK::IsDoubleBuffered() const
 {
-    return gtk_widget_get_double_buffered( m_wxwindow );
+    return gtk_widget_get_double_buffered( m_wxwindow ) != 0;
 }
 
 void wxWindowGTK::ClearBackground()
index d4079803b4708122a2d2ce48ae671daa179bbf75..2153a25391f5135fba51b19a1fa2a807134afcd7 100644 (file)
@@ -86,7 +86,7 @@ bool Uuid::operator==(const Uuid& uuid) const
 {
     // IsEqualGUID() returns BOOL and not bool so use an explicit comparison to
     // avoid MSVC warnings about int->bool conversion
-    return IsEqualGUID(m_uuid, uuid.m_uuid) == TRUE;
+    return IsEqualGUID(m_uuid, uuid.m_uuid) != 0;
 }
 
 // dtor