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 <tho...@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

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to