diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2014-09-19 13:54:11 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-09-19 15:31:07 +0100 |
commit | 01e14011e5b38fbfa713f4dcd8ca5bf2ed75c436 (patch) | |
tree | dfa1e31e6065a134c03f9ec0394a2be785183651 /basic/source/runtime/dllmgr-none.cxx | |
parent | 19ee058a21747efd36a91a5aaa2231fefe1e7fa4 (diff) |
vba: add a different variant of the same compatibility function.
Change-Id: I92bc1dbceea2f10cbb055d97f68b33e575d9be11
Diffstat (limited to 'basic/source/runtime/dllmgr-none.cxx')
-rw-r--r-- | basic/source/runtime/dllmgr-none.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx index 10079d65bbd9..426b2b156a4f 100644 --- a/basic/source/runtime/dllmgr-none.cxx +++ b/basic/source/runtime/dllmgr-none.cxx @@ -39,8 +39,8 @@ struct SbiDllMgr::Impl {}; namespace { // Overcome the mess of Currency vs. custom types etc. -SbError returnInt64(SbxArray *pArgs, SbxVariable &rRetVal, - sal_Int64 nValue) +SbError returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal, + sal_Int64 nValue) { if (!rRetVal.PutLong(true) && !rRetVal.PutInteger(true)) return ERRCODE_BASIC_BAD_ARGUMENT; @@ -54,7 +54,26 @@ SbError returnInt64(SbxArray *pArgs, SbxVariable &rRetVal, pOut->PutCurrency(nValue); return ERRCODE_NONE; } - // FIXME: tolerate custom type bits ... + if (pOut->IsObject()) + { + // FIXME: should we clone this and use pOut->PutObject ? + SbxObject* pObj = PTR_CAST(SbxObject,pOut->GetObject()); + if (!pObj) + return ERRCODE_BASIC_BAD_ARGUMENT; + + // We expect two Longs but other mappings could be possible too. + SbxArray* pProps = pObj->GetProperties(); + if (pProps->Count32() != 2) + return ERRCODE_BASIC_BAD_ARGUMENT; + SbxVariable* pLow = pProps->Get32( 0 ); + SbxVariable* pHigh = pProps->Get32( 1 ); + if (!pLow || !pLow->IsLong() || + !pHigh || !pHigh->IsLong()) + return ERRCODE_BASIC_BAD_ARGUMENT; + pLow->PutLong(nValue & 0xffffffff); + pHigh->PutLong(nValue >> 32); + return ERRCODE_NONE; + } return ERRCODE_BASIC_BAD_ARGUMENT; } @@ -63,14 +82,14 @@ SbError builtin_kernel32(const OUString &aFuncName, SbxArray *pArgs, { sal_Int64 nNanoSecsPerSec = 1000.0*1000*1000; if (aFuncName == "QueryPerformanceFrequency") - return returnInt64(pArgs, rRetVal, nNanoSecsPerSec); + return returnInt64InOutArg(pArgs, rRetVal, nNanoSecsPerSec); else if (aFuncName == "QueryPerformanceCounter") { TimeValue aNow; osl_getSystemTime( &aNow ); sal_Int64 nStamp = aNow.Nanosec + aNow.Seconds * nNanoSecsPerSec; - return returnInt64(pArgs, rRetVal, nStamp); + return returnInt64InOutArg(pArgs, rRetVal, nStamp); } return ERRCODE_BASIC_NOT_IMPLEMENTED; } |