diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-14 11:47:08 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-14 19:53:53 +0100 |
commit | 1205a4b77401eeb2270fe25193286066bb59d173 (patch) | |
tree | ad15770fb976a95552605aff55ce25b56058bb5f /vcl/unx | |
parent | e0f06e60c6e8958bc508d24585189043888e0eb9 (diff) |
New loplugin:consttobool
...to: "Find implicit conversions from non-'bool' constants (e.g., 'sal_False')
to 'bool'".
Due to how FALSE is defined as just
#define FALSE (0)
(i.e., a literal of type 'int') but TRUE is defined as
#define TRUE (!FALSE)
(i.e., an implicit conversion from 'int' to 'bool') in GLib (see the comment in
ConstToBool::VisitImplicitCastExpr), we get more warnings about uses of 'TRUE'
than of 'FALSE'. For example, in libreofficekit/source/gtk/lokdocview.cxx there
is a warning about the 'TRUE' in
g_main_context_iteration(nullptr, TRUE);
but not about the 'FALSE' in
g_main_context_iteration(nullptr, FALSE);
(where the parameter of 'g_main_context_iteration' is of type 'gboolean'). Lets
live with that asymmetry for now...
(Besides the issues addressed directly in this commit, it also found the two
bogus asserts at 7e09d08807b5ba2fd8b9831557752a415bdad562 "Fix useless
assert(true) (which would never fire)" and
122a0be8ae480473bd1d7f35e197a2529f4621e3 "Fix useless assert(true) (which would
never fire)", plus 5f0d6df7f57ae281fe161e61c7f25d67453fddd2 "Use two-argument
form of static_assert".)
Change-Id: Id77322de9f94b85a7b65608a03e0e9865d14467b
Reviewed-on: https://gerrit.libreoffice.org/82667
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/a11y/gtk3atklistener.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/a11y/gtk3atkselection.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk3/a11y/gtk3atkutil.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gloactiongroup.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3glomenu.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkdata.cxx | 20 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salprn-gtk.cxx | 4 |
10 files changed, 34 insertions, 34 deletions
diff --git a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx index da5a48eca1f2..21301d4da6bb 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx @@ -82,7 +82,7 @@ component_wrapper_grab_focus (AtkComponent *component) if( pComponent.is() ) { pComponent->grabFocus(); - return TRUE; + return true; } } catch( const uno::Exception & ) diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx index f690edfe62e3..600403773b92 100644 --- a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx @@ -81,7 +81,7 @@ extern "C" { SolarMutexGuard aGuard; // This is an equivalent to a state change to DEFUNC(T). - atk_object_notify_state_change( atk_obj, ATK_STATE_DEFUNCT, TRUE ); + atk_object_notify_state_change( atk_obj, ATK_STATE_DEFUNCT, true ); if( atk_get_focus_object() == atk_obj ) { SAL_WNODEPRECATED_DECLARATIONS_PUSH diff --git a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx index 1d9772bc1587..91759e8d0b21 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx @@ -53,7 +53,7 @@ selection_add_selection( AtkSelection *selection, if( pSelection.is() ) { pSelection->selectAccessibleChild( i ); - return TRUE; + return true; } } catch(const uno::Exception&) { @@ -72,7 +72,7 @@ selection_clear_selection( AtkSelection *selection ) if( pSelection.is() ) { pSelection->clearAccessibleSelection(); - return TRUE; + return true; } } catch(const uno::Exception&) { @@ -142,7 +142,7 @@ selection_remove_selection( AtkSelection *selection, if( pSelection.is() ) { pSelection->deselectAccessibleChild( i ); - return TRUE; + return true; } } catch(const uno::Exception&) { @@ -161,7 +161,7 @@ selection_select_all_selection( AtkSelection *selection) if( pSelection.is() ) { pSelection->selectAllAccessibleChildren(); - return TRUE; + return true; } } catch(const uno::Exception&) { diff --git a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx index e1526b5af5cf..1d1337d6e800 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx @@ -101,7 +101,7 @@ atk_wrapper_focus_idle_handler (gpointer data) if ( caretPos != -1 ) { - atk_object_notify_state_change( atk_obj, ATK_STATE_FOCUSED, TRUE ); + atk_object_notify_state_change( atk_obj, ATK_STATE_FOCUSED, true ); g_signal_emit_by_name( atk_obj, "text_caret_moved", caretPos ); } } diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index 75f832cc815a..5cfab0ada3aa 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -182,7 +182,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext g_object_unref (pListStores[i]); // owned by the widget. GtkCellRenderer *pCell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start( - GTK_CELL_LAYOUT(m_pLists[i]), pCell, TRUE); + GTK_CELL_LAYOUT(m_pLists[i]), pCell, true); gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT (m_pLists[i]), pCell, "text", 0, nullptr); diff --git a/vcl/unx/gtk3/gtk3gloactiongroup.cxx b/vcl/unx/gtk3/gtk3gloactiongroup.cxx index ca315b07e01b..80f932ace1a1 100644 --- a/vcl/unx/gtk3/gtk3gloactiongroup.cxx +++ b/vcl/unx/gtk3/gtk3gloactiongroup.cxx @@ -61,7 +61,7 @@ g_lo_action_init (GLOAction *action) { action->item_id = -1; action->submenu = FALSE; - action->enabled = TRUE; + action->enabled = true; action->parameter_type = nullptr; action->state_type = nullptr; action->state_hint = nullptr; @@ -179,7 +179,7 @@ g_lo_action_group_query_action (GActionGroup *group, if (state) *state = (action->state) ? g_variant_ref (action->state) : nullptr; - return TRUE; + return true; } static void @@ -217,14 +217,14 @@ g_lo_action_group_change_state (GActionGroup *group, g_lo_action_group_perform_submenu_action (lo_group, action_name, value); else { - bool is_new = FALSE; + bool is_new = false; /* If action already exists but has no state, it should be removed and added again. */ if (action->state_type == nullptr) { g_action_group_action_removed (G_ACTION_GROUP (group), action_name); action->state_type = g_variant_type_copy (g_variant_get_type(value)); - is_new = TRUE; + is_new = true; } if (g_variant_is_of_type (value, action->state_type)) diff --git a/vcl/unx/gtk3/gtk3glomenu.cxx b/vcl/unx/gtk3/gtk3glomenu.cxx index a82c6946422c..e14574722800 100644 --- a/vcl/unx/gtk3/gtk3glomenu.cxx +++ b/vcl/unx/gtk3/gtk3glomenu.cxx @@ -58,26 +58,26 @@ valid_attribute_name (const gchar *name) gint i; if (!g_ascii_islower (name[0])) - return FALSE; + return false; for (i = 1; name[i]; i++) { if (name[i] != '-' && !g_ascii_islower (name[i]) && !g_ascii_isdigit (name[i])) - return FALSE; + return false; if (name[i] == '-' && name[i + 1] == '-') - return FALSE; + return false; } if (name[i - 1] == '-') - return FALSE; + return false; if (i > 1024) - return FALSE; + return false; - return TRUE; + return true; } /* @@ -88,7 +88,7 @@ static gboolean g_lo_menu_is_mutable (GMenuModel*) { // Menu is always mutable. - return TRUE; + return true; } static gint diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx index 66a5dfcce890..29d038141d50 100644 --- a/vcl/unx/gtk3/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/gtk3gtkdata.cxx @@ -279,7 +279,7 @@ int GtkSalDisplay::CaptureMouse( SalFrame* pSFrame ) if( !pFrame ) { if( m_pCapture ) - static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( FALSE ); + static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( false ); m_pCapture = nullptr; return 0; } @@ -288,11 +288,11 @@ int GtkSalDisplay::CaptureMouse( SalFrame* pSFrame ) { if( pFrame == m_pCapture ) return 1; - static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( FALSE ); + static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( false ); } m_pCapture = pFrame; - pFrame->grabPointer( TRUE ); + pFrame->grabPointer( true ); return 1; } @@ -375,7 +375,7 @@ bool GtkSalData::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( bDispatchThread ) { int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; - bool wasOneEvent = TRUE; + bool wasOneEvent = true; while( nMaxEvents-- && wasOneEvent ) { wasOneEvent = g_main_context_iteration( nullptr, bWait && !bWasEvent ); @@ -557,7 +557,7 @@ extern "C" { if( nDeltaSec < 0 || ( nDeltaSec == 0 && nDeltaUSec < 0) ) { *nTimeoutMS = 0; - return TRUE; + return true; } if( nDeltaUSec < 0 ) { @@ -568,7 +568,7 @@ extern "C" { if( static_cast<unsigned long>(nDeltaSec) > 1 + ( pTSource->pInstance->m_nTimeoutMS / 1000 ) ) { sal_gtk_timeout_defer( pTSource ); - return TRUE; + return true; } *nTimeoutMS = MIN( G_MAXINT, ( nDeltaSec * 1000 + (nDeltaUSec + 999) / 1000 ) ); @@ -635,7 +635,7 @@ create_sal_gtk_timeout( GtkSalTimer *pTimer ) // #i36226# timers should be executed with lower priority // than XEvents like in generic plugin g_source_set_priority( pSource, G_PRIORITY_LOW ); - g_source_set_can_recurse( pSource, TRUE ); + g_source_set_can_recurse( pSource, true ); g_source_set_callback( pSource, /* unused dummy */ g_idle_remove_by_data, nullptr, nullptr ); @@ -705,7 +705,7 @@ extern "C" { assert(static_cast<const SalGenericDisplay *>(pThisDisplay) == pDisplay); pThisDisplay->DispatchInternalEvent(); } - return TRUE; + return true; } } @@ -720,7 +720,7 @@ void GtkSalData::TriggerUserEventProcessing() // events, which is G_PRIORITY_HIGH_IDLE + 20, so presentations // queue-redraw has a chance to be fulfilled g_source_set_priority (m_pUserEvent, G_PRIORITY_HIGH_IDLE + 30); - g_source_set_can_recurse (m_pUserEvent, TRUE); + g_source_set_can_recurse (m_pUserEvent, true); g_source_set_callback (m_pUserEvent, call_userEventFn, static_cast<gpointer>(this), nullptr); g_source_attach (m_pUserEvent, g_main_context_default ()); @@ -760,7 +760,7 @@ void GtkSalDisplay::deregisterFrame( SalFrame* pFrame ) { if( m_pCapture == pFrame ) { - static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( FALSE ); + static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( false ); m_pCapture = nullptr; } SalGenericDisplay::deregisterFrame( pFrame ); diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 4c4005dc9a7c..8ec93277e1a0 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -502,7 +502,7 @@ static bool ensure_dbus_setup( gpointer data ) pSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, nullptr); if( !pSessionBus ) { - return FALSE; + return false; } // Create menu model and action group attached to this frame. @@ -551,7 +551,7 @@ static bool ensure_dbus_setup( gpointer data ) g_free( aDBusMenubarPath ); } - return FALSE; + return false; } void on_registrar_available( GDBusConnection * /*connection*/, @@ -1773,7 +1773,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect { // temporarily re-sizeable if( !(m_nStyle & SalFrameStyleFlags::SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), true ); window_resize(nWidth, nHeight); } diff --git a/vcl/unx/gtk3/gtk3salprn-gtk.cxx b/vcl/unx/gtk3/gtk3salprn-gtk.cxx index 7d214a70afcc..e9d57c56a940 100644 --- a/vcl/unx/gtk3/gtk3salprn-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salprn-gtk.cxx @@ -697,8 +697,8 @@ GtkPrintDialog::impl_initPrintContent(uno::Sequence<sal_Bool> const& i_rDisabled // sw/source/core/view/printdata.cxx) if (m_xWrapper->supportsPrintSelection() && !i_rDisabled[2]) { - m_xWrapper->print_unix_dialog_set_support_selection(pDialog, TRUE); - m_xWrapper->print_unix_dialog_set_has_selection(pDialog, TRUE); + m_xWrapper->print_unix_dialog_set_support_selection(pDialog, true); + m_xWrapper->print_unix_dialog_set_has_selection(pDialog, true); } beans::PropertyValue* const pPrintContent( |