Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Oh, I think this was a mistake o mine. I removed the brackets, didn't
really thought, that the else statement could be associated with the
inner if. I attached the patch to bring the brackets back.

-Thomas

On 02/02/2011 08:38 PM, Kohei Yoshida wrote:
On Thu, 2011-02-03 at 03:20 +0900, Takeshi Abe wrote:
Hi,

On building calc, I found a warning suggesting an ambiguous "else".
The attached patch is under LGPLv3+/MPL.

Hmm... But your patch may change the intention of that code block based
on how the lines are indented.

Here is the code we have right now

if(eType==SC_CAT_CONTENT)
    if(!pScChangeAction->IsDialogParent())
        pScChangeAction->GetDescription( aDesc, pDoc, TRUE);
else
    pScChangeAction->GetDescription( aDesc, pDoc,!pScChangeAction->IsMasterDelete());

which makes me think the the else block is supposed to get executed when

eType != SC_CAT_CONTENT

I have no idea how the compiler parses that block of code as it is
indeed ambiguous.  But I'm more in favor of interpreting it based on the
indent levels than how the compiler might be parsing it.

Kohei


From 088714d49235976ff04a0ac0f8f37e32120810b6 Mon Sep 17 00:00:00 2001
From: Thomas Arnhold <thomas@arnhold.org>
Date: Wed, 2 Feb 2011 23:26:47 +0100
Subject: [PATCH] Use brackets, to be safe.

---
 sc/source/ui/miscdlgs/acredlin.cxx |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index ceba5b4..d4ea8de 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -343,8 +343,10 @@ BOOL ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction)
     aComment.EraseAllChars('\n');
 
     if(eType==SC_CAT_CONTENT)
+    {
         if(!pScChangeAction->IsDialogParent())
             pScChangeAction->GetDescription( aDesc, pDoc, TRUE);
+    }
     else
         pScChangeAction->GetDescription( aDesc, pDoc,!pScChangeAction->IsMasterDelete());
 
-- 
1.7.3.5


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.