[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: [PATCH] Fix warning about missing parentheses around && within ||
From:       Johannes Simon <johannes.simon () gmail ! com>
Date:       2008-12-03 8:26:50
Message-ID: 200812030926.51361.johannes.simon () gmail ! com
[Download RAW message or body]

Yep, though this was already the case in the original code. So the patch 
itself is totally fine ;)

- Johannes

On Tuesday 02 December 2008 15:36:59 Luciano Montanaro wrote:
> .
>
> On Sun, Nov 23, 2008 at 10:52 PM, Magnus Lundborg
>
> <lundborg.magnus@gmail.com> wrote:
> > This is my first patch to koffice. I will try to make a few more in the
> > near future at this stage focusing on fixing some compilation warnings.
> > This patch just fixes a warning about missing parentheses around &&
> > within || in an if statement.
> >
> > I hope you do not find any problems with it and I hope my next few
> > patches will be more substantial. Please give me feedback if there is
> > anything I should do differently.
> >
> > Best Regards
> > /Magnus Lundborg
> >
> >
> > Index:
> > /home/magnus/development/kde/koffice/kexi/widget/tableview/kexitableview.
> >cpp ===================================================================
> > ---
> > /home/magnus/development/kde/koffice/kexi/widget/tableview/kexitableview.
> >cpp (revision 888098)
> > +++
> > /home/magnus/development/kde/koffice/kexi/widget/tableview/kexitableview.
> >cpp (working copy)
> > @@ -1277,7 +1277,7 @@
> >     QWidget *w = focusWidget();
> >  // if (!w || w!=viewport() && w!=this && (!m_editor ||
> > w!=m_editor->view() && w!=m_editor)) {
> >  // if (!w || w!=viewport() && w!=this && (!m_editor ||
> > w!=m_editor->view())) {
> > -    if (!w || w != viewport() && w != this && (!m_editor ||
> > !KexiUtils::hasParent(dynamic_cast<QObject*>(m_editor), w))) {
> > +    if (!w ||(w != viewport() && w != this && (!m_editor ||
> > !KexiUtils::hasParent(dynamic_cast<QObject*>(m_editor), w)))) {
> >         //don't process stranger's events
> >         e->ignore();
> >         return;
> > @@ -1415,7 +1415,7 @@
> >                 startEditOrToggleValue();
> >             } else {
> >                 kexidbg << "KexiTableView::KeyPressEvent(): default";
> > -                if (e->text().isEmpty() || !e->text().isEmpty() &&
> > !e->text()[0].isPrint()) {
> > +                if (e->text().isEmpty() || (!e->text().isEmpty() &&
> > !e->text()[0].isPrint())) {
> >                     kDebug(44021) << "NOT PRINTABLE: 0x0" <<
> > QString("%1").arg(k, 0, 16);
> >                     //    e->ignore();
> >                     Q3ScrollView::keyPressEvent(e);
> >
> > _______________________________________________
> > koffice-devel mailing list
> > koffice-devel@kde.org
> > https://mail.kde.org/mailman/listinfo/koffice-devel
>
> Uhm... can't that condition be simplified?
> the || part of the statement can only be reached if the first part is
> not met. So the !e->text().isEmpty() check is redundant.

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic