diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-11-01 12:28:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-11-01 12:28:23 +0000 |
commit | d9e0cc456d09a0996a790c37a6c4629ca067ab2a (patch) | |
tree | 0f5ee6d35247bc2ac0aa7ab8c069eac370f9db2f /basic | |
parent | 495efa6bb73cc9ce582dbdeac84eb3524eb7ad11 (diff) |
WaE, resolve && || warning with a small optimization
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 18 |
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; } |