summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-11-01 12:28:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2010-11-01 12:28:23 +0000
commit8fc51872759aa2bb96c1e0e75e088f3c1cb9b748 (patch)
treee4bf98ac840e269e92057185dca9117b451176f3 /basic
parent612a73d752664fe643dd3bfac4cb5bf11d42190e (diff)
WaE, resolve && || warning with a small optimization
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sbxmod.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 4766d19f50..52bdddfef5 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;
}