[Libreoffice-commits] .: basic/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Nov 1 05:28:35 PDT 2010


 basic/source/classes/sbxmod.cxx |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 8fc51872759aa2bb96c1e0e75e088f3c1cb9b748
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 1 12:28:23 2010 +0000

    WaE, resolve && || warning with a small optimization

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 4766d19..52bdddf 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1756,18 +1756,22 @@ IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
 
 bool SbModule::HasExeCode()
 {
+    // And empty Image always has the Global Chain set up
+    static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
+    // lets be stricter for the moment than VBA
 
+    if (!IsCompiled())
+    {
         ErrorHdlResetter aGblErrHdl;
-    // And empty Image always has the Global Chain set up
-        static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
-        // lets be stricter for the moment than VBA
+        Compile();
+        if (aGblErrHdl.HasError()) //assume unsafe on compile error
+            return true;
+    }
 
     bool bRes = false;
-    if ( !IsCompiled() )
-        Compile();
-    if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) )
-        || aGblErrHdl.HasError() )
+    if (pImage && !(pImage->GetCodeSize() == 5 && (memcmp(pImage->GetCode(), pEmptyImage, pImage->GetCodeSize()) == 0 )))
         bRes = true;
+
     return bRes;
 }
 


More information about the Libreoffice-commits mailing list