summaryrefslogtreecommitdiff
path: root/basic/source/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/runtime')
-rw-r--r--basic/source/runtime/ddectrl.cxx40
-rw-r--r--basic/source/runtime/iosys.cxx37
-rw-r--r--basic/source/runtime/runtime.cxx14
3 files changed, 38 insertions, 53 deletions
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 3c77fcbe26c0..adb2e7aebf2d 100644
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -29,36 +29,36 @@
static const ErrCode nDdeErrMap[] =
{
- /* DMLERR_ADVACKTIMEOUT */ 0x4000, ERRCODE_BASIC_DDE_TIMEOUT,
- /* DMLERR_BUSY */ 0x4001, ERRCODE_BASIC_DDE_BUSY,
- /* DMLERR_DATAACKTIMEOUT */ 0x4002, ERRCODE_BASIC_DDE_TIMEOUT,
- /* DMLERR_DLL_NOT_INITIALIZED */ 0x4003, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_DLL_USAGE */ 0x4004, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_EXECACKTIMEOUT */ 0x4005, ERRCODE_BASIC_DDE_TIMEOUT,
- /* DMLERR_INVALIDPARAMETER */ 0x4006, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_LOW_MEMORY */ 0x4007, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_MEMORY_ERROR */ 0x4008, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_NOTPROCESSED */ 0x4009, ERRCODE_BASIC_DDE_NOTPROCESSED,
- /* DMLERR_NO_CONV_ESTABLISHED */ 0x400a, ERRCODE_BASIC_DDE_NO_CHANNEL,
- /* DMLERR_POKEACKTIMEOUT */ 0x400b, ERRCODE_BASIC_DDE_TIMEOUT,
- /* DMLERR_POSTMSG_FAILED */ 0x400c, ERRCODE_BASIC_DDE_QUEUE_OVERFLOW,
- /* DMLERR_REENTRANCY */ 0x400d, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_SERVER_DIED */ 0x400e, ERRCODE_BASIC_DDE_PARTNER_QUIT,
- /* DMLERR_SYS_ERROR */ 0x400f, ERRCODE_BASIC_DDE_ERROR,
- /* DMLERR_UNADVACKTIMEOUT */ 0x4010, ERRCODE_BASIC_DDE_TIMEOUT,
- /* DMLERR_UNFOUND_QUEUE_ID */ 0x4011, ERRCODE_BASIC_DDE_NO_CHANNEL
+ /* DMLERR_ADVACKTIMEOUT */ ErrCode(0x4000), ERRCODE_BASIC_DDE_TIMEOUT,
+ /* DMLERR_BUSY */ ErrCode(0x4001), ERRCODE_BASIC_DDE_BUSY,
+ /* DMLERR_DATAACKTIMEOUT */ ErrCode(0x4002), ERRCODE_BASIC_DDE_TIMEOUT,
+ /* DMLERR_DLL_NOT_INITIALIZED */ ErrCode(0x4003), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_DLL_USAGE */ ErrCode(0x4004), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_EXECACKTIMEOUT */ ErrCode(0x4005), ERRCODE_BASIC_DDE_TIMEOUT,
+ /* DMLERR_INVALIDPARAMETER */ ErrCode(0x4006), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_LOW_MEMORY */ ErrCode(0x4007), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_MEMORY_ERROR */ ErrCode(0x4008), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_NOTPROCESSED */ ErrCode(0x4009), ERRCODE_BASIC_DDE_NOTPROCESSED,
+ /* DMLERR_NO_CONV_ESTABLISHED */ ErrCode(0x400a), ERRCODE_BASIC_DDE_NO_CHANNEL,
+ /* DMLERR_POKEACKTIMEOUT */ ErrCode(0x400b), ERRCODE_BASIC_DDE_TIMEOUT,
+ /* DMLERR_POSTMSG_FAILED */ ErrCode(0x400c), ERRCODE_BASIC_DDE_QUEUE_OVERFLOW,
+ /* DMLERR_REENTRANCY */ ErrCode(0x400d), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_SERVER_DIED */ ErrCode(0x400e), ERRCODE_BASIC_DDE_PARTNER_QUIT,
+ /* DMLERR_SYS_ERROR */ ErrCode(0x400f), ERRCODE_BASIC_DDE_ERROR,
+ /* DMLERR_UNADVACKTIMEOUT */ ErrCode(0x4010), ERRCODE_BASIC_DDE_TIMEOUT,
+ /* DMLERR_UNFOUND_QUEUE_ID */ ErrCode(0x4011), ERRCODE_BASIC_DDE_NO_CHANNEL
};
ErrCode SbiDdeControl::GetLastErr( DdeConnection* pConv )
{
if( !pConv )
{
- return 0;
+ return ERRCODE_NONE;
}
long nErr = pConv->GetError();
if( !nErr )
{
- return 0;
+ return ERRCODE_NONE;
}
if( nErr < DDE_FIRSTERR || nErr > DDE_LASTERR )
{
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 472c4321e0ec..fca1a1c17cc7 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -141,33 +141,23 @@ void SbiStream::MapError()
{
if( pStrm )
{
- switch( pStrm->GetError() )
- {
- case ERRCODE_NONE:
- nError = 0;
- break;
- case SVSTREAM_FILE_NOT_FOUND:
+ ErrCode nEC = pStrm->GetError();
+ if (nEC == ERRCODE_NONE)
+ nError = ERRCODE_NONE;
+ else if (nEC == SVSTREAM_FILE_NOT_FOUND)
nError = ERRCODE_BASIC_FILE_NOT_FOUND;
- break;
- case SVSTREAM_PATH_NOT_FOUND:
+ else if (nEC ==SVSTREAM_PATH_NOT_FOUND)
nError = ERRCODE_BASIC_PATH_NOT_FOUND;
- break;
- case SVSTREAM_TOO_MANY_OPEN_FILES:
+ else if (nEC ==SVSTREAM_TOO_MANY_OPEN_FILES)
nError = ERRCODE_BASIC_TOO_MANY_FILES;
- break;
- case SVSTREAM_ACCESS_DENIED:
+ else if (nEC ==SVSTREAM_ACCESS_DENIED)
nError = ERRCODE_BASIC_ACCESS_DENIED;
- break;
- case SVSTREAM_INVALID_PARAMETER:
+ else if (nEC ==SVSTREAM_INVALID_PARAMETER)
nError = ERRCODE_BASIC_BAD_ARGUMENT;
- break;
- case SVSTREAM_OUTOFMEMORY:
+ else if (nEC ==SVSTREAM_OUTOFMEMORY)
nError = ERRCODE_BASIC_NO_MEMORY;
- break;
- default:
+ else
nError = ERRCODE_BASIC_IO_ERROR;
- break;
- }
}
}
@@ -656,7 +646,7 @@ SbiIoSystem::SbiIoSystem()
i = nullptr;
}
nChan = 0;
- nError = 0;
+ nError = ERRCODE_NONE;
}
SbiIoSystem::~SbiIoSystem()
@@ -666,13 +656,14 @@ SbiIoSystem::~SbiIoSystem()
ErrCode SbiIoSystem::GetError()
{
- ErrCode n = nError; nError = 0;
+ ErrCode n = nError;
+ nError = ERRCODE_NONE;
return n;
}
void SbiIoSystem::Open(short nCh, const OString& rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen)
{
- nError = 0;
+ nError = ERRCODE_NONE;
if( nCh >= CHANNELS || !nCh )
{
nError = ERRCODE_BASIC_BAD_CHANNEL;
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index d33e584dce20..f8c8ed9aec2d 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -480,7 +480,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg )
ErrCode n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
if ( !n )
{
- n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
+ n = ErrCode(nVBNumber); // force orig number, probably should have a specific table of vb ( localized ) errors
}
aErrorMsg = rMsg;
SbiRuntime::translateErrorToVba( n, aErrorMsg );
@@ -494,7 +494,7 @@ void SbiInstance::setErrorVB( sal_Int32 nVBNumber )
ErrCode n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
if( !n )
{
- n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
+ n = ErrCode(nVBNumber); // force orig number, probably should have a specific table of vb ( localized ) errors
}
aErrorMsg = OUString();
SbiRuntime::translateErrorToVba( n, aErrorMsg );
@@ -773,7 +773,7 @@ bool SbiRuntime::Step()
}
ErrCode nErrCode = SbxBase::GetError();
- Error( ERRCODE_TOERROR(nErrCode) );
+ Error( nErrCode.IgnoreWarning() );
// from 13.2.1997, new error handling:
// ATTENTION: nError can be set already even if !nErrCode
@@ -931,12 +931,6 @@ sal_Int32 SbiRuntime::translateErrorToVba( ErrCode nError, OUString& rMsg )
// we really need a new vba compatible error list
if ( rMsg.isEmpty() )
{
- // TEST, has to be vb here always
-#ifdef DBG_UTIL
- ErrCode nTmp = StarBASIC::GetSfxFromVBError( (sal_uInt16)nError );
- SAL_WARN_IF( nTmp == 0, "basic", "No VB error!" );
-#endif
-
StarBASIC::MakeErrorText( nError, rMsg );
rMsg = StarBASIC::GetErrorText();
if ( rMsg.isEmpty() ) // no message for err no, need localized resource here
@@ -946,7 +940,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( ErrCode nError, OUString& rMsg )
}
// no num? most likely then it *is* really a vba err
sal_uInt16 nVBErrorCode = StarBASIC::GetVBErrorCode( nError );
- sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? nError : nVBErrorCode;
+ sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? sal_uInt32(nError) : nVBErrorCode;
return nVBAErrorNumber;
}