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
commitd9e0cc456d09a0996a790c37a6c4629ca067ab2a (patch)
tree0f5ee6d35247bc2ac0aa7ab8c069eac370f9db2f /basic
parent495efa6bb73cc9ce582dbdeac84eb3524eb7ad11 (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 dfd9533d6039..089a963cf05c 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;
}