[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx |4 1 file changed, 4 insertions(+) New commits: commit 4fe407485f7c42f27101794594635ecf13d13826 Author: Tor Lillqvist AuthorDate: Wed Jun 12 12:27:12 2019 +0300 Commit: Tor Lillqvist CommitDate: Wed Jun 12 12:31:06 2019 +0300 Add some more SAL_INFOs Change-Id: I5b50df5ea6b99164d150f99ae4fd36cddde22a60 diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 7df511f0016d..bdd527cb1ecf 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -149,9 +149,11 @@ public: // XTerminateListener void SAL_CALL queryTermination( const EventObject& ) override { +SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: count=" << mnCount); // Always veto termination while an OLE object is active if (mnCount > 0) { +SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: Throwing!"); throw css::frame::TerminationVetoException(); } } @@ -187,6 +189,7 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference const m_defaultValueType( 0) { TerminationVetoer::get()->mnCount++; +SAL_INFO("extensions.olebridge", "InterfaceOleWrapper CTOR, count=" << TerminationVetoer::get()->mnCount); } InterfaceOleWrapper::~InterfaceOleWrapper() @@ -198,6 +201,7 @@ InterfaceOleWrapper::~InterfaceOleWrapper() UnoObjToWrapperMap.erase(it); TerminationVetoer::get()->mnCount--; +SAL_INFO("extensions.olebridge", "InterfaceOleWrapper DTOR, count=" << TerminationVetoer::get()->mnCount); } STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppv) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 16 1 file changed, 12 insertions(+), 4 deletions(-) New commits: commit a11cdfd392dfcfe0117893e1fc4ca18c3bc69f66 Author: Tor Lillqvist AuthorDate: Tue Jun 11 08:12:14 2019 +0300 Commit: Tor Lillqvist CommitDate: Tue Jun 11 08:26:48 2019 +0300 It is not a good idea to allocate a UNO object statically I should have known that. But sometimes you subconsciously just want things to be easy for change. But no. This fixes a problem that showed up in CppunitTest_services. Change-Id: Iaefcbe4a07716f4d1b2c269627a99d43e3738af3 diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 78254a834040..7df511f0016d 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -121,6 +121,7 @@ class TerminationVetoer : public WeakImplHelper public: int mnCount; +private: TerminationVetoer() : mnCount(0) { @@ -136,6 +137,15 @@ public: } } +public: +static Reference< TerminationVetoer > get() +{ +static TerminationVetoer* pInstance = new TerminationVetoer; +static Reference< TerminationVetoer > aInstance( pInstance ); + +return aInstance; +} + // XTerminateListener void SAL_CALL queryTermination( const EventObject& ) override { @@ -158,8 +168,6 @@ public: } }; -static TerminationVetoer aTerminationVetoer; - /* Does not throw any exceptions. Param pInfo can be NULL. */ @@ -178,7 +186,7 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference const UnoConversionUtilities( xFactory, unoWrapperClass, comWrapperClass), m_defaultValueType( 0) { -aTerminationVetoer.mnCount++; +TerminationVetoer::get()->mnCount++; } InterfaceOleWrapper::~InterfaceOleWrapper() @@ -189,7 +197,7 @@ InterfaceOleWrapper::~InterfaceOleWrapper() if(it != UnoObjToWrapperMap.end()) UnoObjToWrapperMap.erase(it); -aTerminationVetoer.mnCount--; +TerminationVetoer::get()->mnCount--; } STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppv) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/macosx/spotlight/OOoContentDataParser.m |4 1 file changed, 4 insertions(+) New commits: commit e6212862e3ace07136d4c68ee813696f3c6a2aef Author: Tomaž Vajngerl AuthorDate: Mon Apr 15 13:14:53 2019 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Apr 18 14:50:31 2019 +0900 tdf#122172 set textContent to nil in OOoContentDataProvider This should prevent the crash - at least it did for me AFAICS. Change-Id: I489264d8054e6577b948b0ab307c863d3140788a Reviewed-on: https://gerrit.libreoffice.org/70755 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 9f392d0c09bd946e4660ccc2d48ee3ae1367343c) diff --git a/extensions/source/macosx/spotlight/OOoContentDataParser.m b/extensions/source/macosx/spotlight/OOoContentDataParser.m index d394115a3010..89d92a8c126a 100644 --- a/extensions/source/macosx/spotlight/OOoContentDataParser.m +++ b/extensions/source/macosx/spotlight/OOoContentDataParser.m @@ -98,6 +98,7 @@ [textContent appendString:[NSString stringWithString:runningTextContent]]; [runningTextContent release]; +runningTextContent = nil; } shouldReadCharacters = NO; } @@ -125,9 +126,11 @@ if (runningTextContent != nil) { [runningTextContent release]; +runningTextContent = nil; } if (textContent != nil) { [textContent release]; +textContent = nil; } } @@ -137,6 +140,7 @@ if (textContent != nil && [textContent length] > 0) { [mdiValues setObject:[NSString stringWithString:textContent] forKey:(NSString*)kMDItemTextContent]; [textContent release]; +textContent = nil; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoconversionutilities.hxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 6d54ce9155c73b6b97c437234f97f4558166b69d Author: Tor Lillqvist AuthorDate: Mon Apr 15 15:53:09 2019 +0300 Commit: Tor Lillqvist CommitDate: Mon Apr 15 15:53:09 2019 +0300 Turn an incoming VT_NULL when a STRING is wanted into an empty BSTR Might help in some cases in the customer application. Change-Id: Icdc13780d4623e9df8bc057760c1295d7d6ffd61 diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 771a15cc48b7..83066f338ea5 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -433,6 +433,8 @@ void UnoConversionUtilities::variantToAny( const VARIANTARG* pArg, Any& rAny, bFail = true; break; case TypeClass_STRING: // UString +if(var.vt == VT_NULL) +var = CComBSTR(""); if(SUCCEEDED(hr = VariantChangeType( & var, , 0, VT_BSTR))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) New commits: commit e188baafd0ee6e6d6764b5c8b6a87d8946b6465f Author: Tor Lillqvist Date: Mon Jun 11 20:10:48 2018 +0300 Show also args in the SAL_INFO in InterfaceOleWrapper::Invoke() Change-Id: I8d1d3273fcafe1ce750e66e55712eac607722717 Reviewed-on: https://gerrit.libreoffice.org/55655 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 08095e923eeb..fdc3a85a64e2 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -1767,7 +1768,20 @@ STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMember, { comphelper::Automation::AutomationInvokedZone aAutomationActive; -SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::Invoke(" << dispidMember << ")"); +OUString sParams; +#if defined SAL_LOG_INFO +sParams += "["; +for (unsigned int i = 0; i < pdispparams->cArgs; ++i) +{ +if (i > 0) +sParams += ","; +std::stringstream aStringStream; +aStringStream << pdispparams->rgvarg[i]; +sParams += OUString::createFromAscii(aStringStream.str().c_str()); +} +sParams += "]"; +#endif +SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::Invoke(" << dispidMember << "," << sParams << ")"); comphelper::ProfileZone aZone("COM Bridge"); HRESULT ret = S_OK; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 61 +++--- 1 file changed, 50 insertions(+), 11 deletions(-) New commits: commit 9517923c581c2c7be79a6838959a60ed66a4c34b Author: Tor Lillqvist Date: Fri Jun 8 18:30:33 2018 +0300 Start of work on supporting named arguments In InterfaceOleWrapper::GetIDsOfNames(), look up also the parameter names, if present (if cNames > 1, rgszNames entries after the first). Return S_OK only if *all* the names were found, i.e. both the first (method or property) name, *and* all the parameter names. Change-Id: Ie04bc0558a7e2044ef527fc18f99230c71985a22 Reviewed-on: https://gerrit.libreoffice.org/55481 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index fdc3a85a64e2..213f2521b56f 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -1075,10 +1075,15 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, { comphelper::Automation::AutomationInvokedZone aAutomationActive; +if( ! rgdispid) +return E_POINTER; + OUString sNames; sNames += "["; for (unsigned int i = 0; i < cNames; ++i) { +// Intialise returned rgdispid values. +rgdispid[i] = DISPID_UNKNOWN; if (i > 0) sNames += ","; sNames += "\"" + OUString(o3tl::toU(rgszNames[i])) + "\""; @@ -1091,8 +1096,6 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, try { MutexGuard guard( getBridgeMutex()); -if( ! rgdispid) -return E_POINTER; // FIXME: Handle the cNames > 1 case? Note that the rest of the names mean the names of *arguments*. @@ -1119,20 +1122,18 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, OUString name(o3tl::toU(rgszNames[0])); NameToIdMap::iterator iter = m_nameToDispIdMap.find(name); +bool bIsMethod = false; + +OUString exactName = name; + if (iter == m_nameToDispIdMap.end()) { -OUString exactName; - if (m_xExactName.is()) { exactName = m_xExactName->getExactName(name); if (exactName.isEmpty()) exactName = name; } -else -{ -exactName = name; -} MemberInfo d(0, exactName); @@ -1146,6 +1147,7 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, if (m_xInvocation->hasMethod(exactName)) { d.flags |= DISPATCH_METHOD; +bIsMethod = true; } if (d.flags != 0) @@ -1167,9 +1169,46 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, } else { -*rgdispid = (*iter).second; -SAL_INFO("extensions.olebridge", " " << name << ": " << *rgdispid); -ret = S_OK; +rgdispid[0] = (*iter).second; +SAL_INFO("extensions.olebridge", " " << name << ": " << rgdispid[0]); + +if (bIsMethod && cNames > 1) +{ +Reference xIdlMethod; +Reference xIntrospectionAccess = m_xInvocation->getIntrospection(); +try +{ +if (xIntrospectionAccess.is()) +xIdlMethod = xIntrospectionAccess->getMethod(exactName, MethodConcept::ALL); +} +catch (const NoSuchMethodException&) +{ +} +if (xIdlMethod.is()) +{ +auto aParamInfos = xIdlMethod->getParameterInfos(); +for (unsigned int i = 1; i < cNames; ++i) +{ +for (int j = 0; j < aParamInfos.getLength(); ++j) +{ +if (aParamInfos[j].aName.equalsIgnoreAsciiCase(OUString(o3tl::toU(rgszNames[i] +{ +rgdispid[i] = j; +SAL_INFO("extensions.olebridge", " " << OUString(o3tl::toU(rgszNames[i])) << ": " << rgdispid[i]); +break; +} +} +} +} +} + +// Return value should be S_OK only if *all* the names were found. +unsigned int i; +for (i = 0; i < cNames; ++i) +if (rgdispid[i] == DISPID_UNKNOWN) +break; +
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 97 +++--- 1 file changed, 91 insertions(+), 6 deletions(-) New commits: commit d431f1b1137d5e99941926c772ee9af88c98e5c0 Author: Tor Lillqvist Date: Mon Jun 11 19:53:06 2018 +0300 Support named arguments in InterfaceOleWrapper::Invoke() Convert a DISPPARAMS with named arguments into one with just positional ones. If there are gaps, pass markers for them (VARIANTs with VT_ERROR:DISP_E_PARAMNOTFOUND). Those will be passed on as empty UNO Anys. Change-Id: Iad1197ba2559567a9c0eca4524e76389c2048fec Reviewed-on: https://gerrit.libreoffice.org/55654 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 14020457e5bd..08095e923eeb 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -1188,6 +1188,10 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, return ret; } +// Note: What the comments here say about JScript possibly holds for Automation clients in general, +// like VBScript ones, too. Or not. Hard to say. What is the relevance of JScript nowadays anyway, +// and can LO really be used from JScript code on web pages any longer? + // "convertDispparamsArgs" converts VARIANTS to their respecting Any counterparts // The parameters "id", "wFlags" and "pdispparams" equal those as used in // IDispatch::Invoke. The function handles special JavaScript @@ -1294,6 +1298,16 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id, if (i < countIncomingArgs) { +// A missing (and hopefully optional) arg (in the middle of the argument list) is passed +// as an empty Any. +if (pdispparams->rgvarg[i].vt == VT_ERROR && pdispparams->rgvarg[i].scode == DISP_E_PARAMNOTFOUND) +{ +Any aEmpty; +pParams[ outgoingArgIndex ] = aEmpty; +outgoingArgIndex++; +continue; +} + if(convertValueObject( & pdispparams->rgvarg[i], anyParam)) { //a param is a ValueObject and could be converted pParams[ outgoingArgIndex ] = anyParam; @@ -1775,17 +1789,88 @@ STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMember, { if ((flags & DISPATCH_METHOD) != 0) { +std::unique_ptr pNewDispParams; +std::vector vNewArgs; + if (pdispparams->cNamedArgs > 0) -ret = DISP_E_NONAMEDARGS; -else { -Sequence params; +// Convert named arguments to positional ones. + +// An example: +// +// Function declaration (in pseudo-code): +// int foo(int A, int B, optional int C, optional int D, optional int E, optional int F, optional int G) +// +// Corresponding parameter numbers (DISPIDs): +// 0 1 2 3 4 5 6 +// +// Actual call: +// foo(10, 20, E:=50, D:=40, F:=60) +// +// That is, A and B are pased positionally, D, E, and F as named arguments, +// and the optional C and G parameters are left out. +// +// Incoming DISPPARAMS: +// cArgs=5, cNamedArgs=3 +// rgvarg: [60, 40, 50, 20, 10] +// rgdispidNamedArgs: [5, 3, 4] +// +// We calculate nLowestNamedArgDispid = 3 and nHighestNamedArgDispid = 5. +// +// Result of conversion, no named args: +// cArgs=6, cNamedArgs=0 +// rgvarg: [60, 50, 40, DISP_E_PARAMNOTFOUND, 20, 10] + +// First find the lowest and highest DISPID of the named arguments. +DISPID nLowestNamedArgDispid = 100; +DISPID nHighestNamedArgDispid = -1; +for (unsigned int i = 0; i < pdispparams->cNamedArgs; ++i) +{ +if (pdispparams->rgdispidNamedArgs[i] < nLowestNamedArgDispid) +nLowestNamedArgDispid = pdispparams->rgdispidNamedArgs[i]; +if (pdispparams->rgdispidNamedArgs[i] > nHighestNamedArgDispid) +nHighestNamedArgDispid = pdispparams->rgdispidNamedArgs[i]; +
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 435 ++ 1 file changed, 209 insertions(+), 226 deletions(-) New commits: commit 5ea0d9dfc3319c37fd5505f6504640de96386ce8 Author: Stephan Bergmann Date: Fri Jun 1 14:59:01 2018 +0200 Various clang-cl/loplugin errors in extensions/source/ole/unoobjw.cxx -Werror,-Wnon-virtual-dtor: made various dtors virtual -Werror,-Winconsistent-missing-override in END_COM_MAP: silenced the same way as in other places across the code base loplugin:unreffun in BEGIN_COM_MAP and END_COM_MAP: silence with -Wunused-function various -Werror in atlbase.h and atlcom.h: silenced the same way as in e.g. embedserv/source/inc/stdafx.h -Werror,-Wshadow -Werror,-Wunused-function loplugin:casttovoid loplugin:cstylecast loplugin:nullptr loplugin:salbool loplugin:subtlezeroinit Change-Id: Ifefdc930a1d3ecf5366523dea509bfaca1f4e001 Reviewed-on: https://gerrit.libreoffice.org/55186 Reviewed-by: Tor Lillqvist Tested-by: Jenkins Reviewed-by: Stephan Bergmann Reviewed-on: https://gerrit.libreoffice.org/55426 Tested-by: Tor Lillqvist diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 7033f5c9eddc..df8932374896 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -32,8 +32,27 @@ #include #include +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wall" +#pragma clang diagnostic ignored "-Wattributes" +#pragma clang diagnostic ignored "-Wdelete-incomplete" +#pragma clang diagnostic ignored "-Wdynamic-class-memaccess" +#pragma clang diagnostic ignored "-Wextra" +#pragma clang diagnostic ignored "-Wint-to-pointer-cast" +#pragma clang diagnostic ignored "-Winvalid-noreturn" +#pragma clang diagnostic ignored "-Wmicrosoft" +#pragma clang diagnostic ignored "-Wnon-pod-varargs" +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#pragma clang diagnostic ignored "-Wnonportable-include-path" +#pragma clang diagnostic ignored "-Wsequence-point" +#pragma clang diagnostic ignored "-Wtypename-missing" +#endif #include #include +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif #include #include @@ -92,73 +111,6 @@ static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource); static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource); static HRESULT mapCannotConvertException(const CannotConvertException , unsigned int * puArgErr); -static std::string DumpTypeInfo(ITypeInfo *pTypeInfo, int indentLevel) -{ -std::ostringstream os; -os << std::string(indentLevel, ' ') << "ITypeInfo@" << std::hex << (void*) pTypeInfo; - -BSTR sName; -if (SUCCEEDED(pTypeInfo->GetDocumentation(MEMBERID_NIL, , NULL, NULL, NULL))) -{ -os << ":" << std::wstring_convert, wchar_t>().to_bytes(sName); -} - -return os.str(); -} - -static std::string DumpDispatch(IDispatch *pDispatch, int indentLevel) -{ -std::ostringstream os; -os << std::string(indentLevel, ' ') << "IDispatch@" << (void*) pDispatch; -#if 0 // Doesn't work anyway, see comment "Sadly" below -// We "know" that we call this on the IUnknown passed to IConnectionPoint::Advise(), so check -// the event names we "know" are used in my Events.vbs test script. I.e. this is debug code very -// specific to the author's arbitrary transient development environment. -LPOLESTR vNames[] = { -L"DocumentOpen", -L"DocumentChange", -L"DocumentBeforeClose", -L"Foobar" -L"Quit", -L"WindowActivate" -}; -for (int i = 0; i < SAL_N_ELEMENTS(vNames); i++) -{ -DISPID nDispId; -HRESULT hr; -// Sadly it turns out that the IUnknown passed to IConnectionPoint::Advise does have an -// IDispatch, but its GetIDsOfNames() returns E_NOTIMPL?! How is the COM object supposed to -// be able to invoke events in the outgoing interface when it can't look them up by name? -// Need to google harder for informative articles from the early 2000s. -hr = pDispatch->GetIDsOfNames(IID_NULL, vNames+i, 1, LOCALE_USER_DEFAULT, ); -if (SUCCEEDED(hr)) -{ -os << "\n" << std::string(indentLevel+2, ' ') - << std::wstring_convert, wchar_t>().to_bytes(vNames[i]) - << ": " << nDispId; -} -else if (hr == DISP_E_UNKNOWNNAME) -{ -os << "\n" << std::string(indentLevel+2, ' ') - << std::wstring_convert, wchar_t>().to_bytes(vNames[i]) - << ": unknown"; -} -} -#endif - -UINT nTypeInfoCount = 0; -if (SUCCEEDED(pDispatch->GetTypeInfoCount()) && nTypeInfoCount == 1) -{ -ITypeInfo *pTypeInfo = NULL; -if (SUCCEEDED(pDispatch->GetTypeInfo(0,
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 9d4195b437b2a3a63a91380c36702fd2e2f43287 Author: Tor Lillqvist Date: Thu Jun 7 10:31:46 2018 +0300 The XCollection loop index is one-based Change-Id: I2de9e53b2a0d923d4136ee5e093baa955c8301da Reviewed-on: https://gerrit.libreoffice.org/55409 Reviewed-by: Michael Meeks Tested-by: Michael Meeks diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 81c7a124df6b..7033f5c9eddc 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -2119,7 +2119,7 @@ public: ULONG nReturned = 0; while (nLeft > 0) { -if (mnIndex >= mxCollection->getCount()) +if (mnIndex > mxCollection->getCount()) { SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): got " << nReturned << ": S_FALSE"); return S_FALSE; @@ -2154,7 +2154,7 @@ public: ULONG nSkipped = 0; while (celt > 0) { -if (mnIndex >= mxCollection->getCount()) +if (mnIndex > mxCollection->getCount()) { SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Skip(" << celt << "): skipped " << nSkipped << ": S_FALSE"); return S_FALSE; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) New commits: commit 9a809384f6210e15f90e131a15b88b105c912092 Author: Tor Lillqvist Date: Thu Jun 7 09:47:51 2018 +0300 Improve logging in CXEnumVariant Change-Id: Ia0c3f9f1e95980b14415a030fc40268629ae06f3 Reviewed-on: https://gerrit.libreoffice.org/55408 Reviewed-by: Michael Meeks Tested-by: Michael Meeks diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 4f0747259183..81c7a124df6b 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -2087,10 +2087,11 @@ public: virtual HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT **ppEnum) override { (void) ppEnum; +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Clone: E_NOTIMPL"); return E_NOTIMPL; } -virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, +virtual HRESULT STDMETHODCALLTYPE Next(ULONG const celt, VARIANT *rgVar, ULONG *pCeltFetched) override { @@ -2100,19 +2101,29 @@ public: *pCeltFetched = 0; if (celt == 0) +{ +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): E_INVALIDARG"); return E_INVALIDARG; +} if (rgVar == NULL || (celt != 1 && pCeltFetched == NULL)) +{ +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): E_FAIL"); return E_FAIL; +} for (ULONG i = 0; i < celt; i++) VariantInit([i]); -while (celt > 0) +ULONG nLeft = celt; +ULONG nReturned = 0; +while (nLeft > 0) { if (mnIndex >= mxCollection->getCount()) +{ +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): got " << nReturned << ": S_FALSE"); return S_FALSE; - +} Any aIndex; aIndex <<= mnIndex; Any aElement = mxCollection->Item(aIndex, Any()); @@ -2121,14 +2132,17 @@ public: if (pCeltFetched) (*pCeltFetched)++; rgVar++; +nReturned++; mnIndex++; -celt--; +nLeft--; } +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): S_OK"); return S_OK; } virtual HRESULT STDMETHODCALLTYPE Reset() override { +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Reset: S_OK"); mnIndex = 1; return S_OK; } @@ -2137,13 +2151,18 @@ public: { comphelper::Automation::AutomationInvokedZone aAutomationActive; +ULONG nSkipped = 0; while (celt > 0) { if (mnIndex >= mxCollection->getCount()) +{ +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Skip(" << celt << "): skipped " << nSkipped << ": S_FALSE"); return S_FALSE; +} mnIndex++; celt--; } +SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Skip(" << celt << "): S_OK"); return S_OK; } @@ -2284,6 +2303,8 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) SAL_INFO("extensions.olebridge", "Sink::Call(" << Method << "): Calling Invoke(" << nMemId << ")"); nResult = pDispatch->Invoke(nMemId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, , , NULL, ); +SAL_INFO("extensions.olebridge", "Sink::Call(" << Method << "): Invoke() returned"); + SAL_WARN_IF(!SUCCEEDED(nResult), "extensions.olebridge", "Call to " << Method << " failed: " << WindowsErrorStringFromHRESULT(nResult)); // Undo VT_BYREF magic done above. Copy out parameters back to the Anys in Arguments @@ -2393,7 +2414,7 @@ public: if (pcFetched && cConnections != 1) { SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Next(" << cConnections << "): E_INVALIDARG"); -return E_POINTER; +return E_INVALIDARG; } ULONG nFetched = 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
extensions/source/ole/unoobjw.cxx | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) New commits: commit e5a730e7f0c8b6244536b87f54757ebe15fe2213 Author: Tor Lillqvist Date: Wed Jun 6 18:53:35 2018 +0300 tdf#118026: Use ooo::vba::XCollection instead of css::container::XEnumeration An object returned by XCollection::Item() is of the right "VBA" kind that we want. One returned by XEnumeration::nextElement() is not. Change-Id: I26132a7d0f2638a61f2711b941386a889fabea72 Reviewed-on: https://gerrit.libreoffice.org/55391 Reviewed-by: Michael Meeks Reviewed-by: Tor Lillqvist Tested-by: Tor Lillqvist diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index ac6873be9300..4f0747259183 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -1214,6 +1215,7 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/, if (iter == m_nameToDispIdMap.end()) { ret = DISP_E_UNKNOWNNAME; +SAL_INFO("extensions.olebridge", " " << name << ": UNKNOWN"); } else { @@ -2059,6 +2061,7 @@ class CXEnumVariant : public IEnumVARIANT, { public: CXEnumVariant() +: mnIndex(1)// ooo::vba::XCollection index starts at one { } @@ -2074,10 +2077,10 @@ public: // Creates and intializes the enumerator void Init(InterfaceOleWrapper* pInterfaceOleWrapper, - const Reference< XEnumeration > xEnumeration) + const Reference xCollection) { mpInterfaceOleWrapper = pInterfaceOleWrapper; -mxEnumeration = xEnumeration; +mxCollection = xCollection; } // IEnumVARIANT @@ -2107,14 +2110,18 @@ public: while (celt > 0) { - if (!mxEnumeration->hasMoreElements()) +if (mnIndex >= mxCollection->getCount()) return S_FALSE; -Any aElement = mxEnumeration->nextElement(); + +Any aIndex; +aIndex <<= mnIndex; +Any aElement = mxCollection->Item(aIndex, Any()); mpInterfaceOleWrapper->anyToVariant(rgVar, aElement); // rgVar->pdispVal->AddRef(); ?? if (pCeltFetched) (*pCeltFetched)++; rgVar++; +mnIndex++; celt--; } return S_OK; @@ -2122,7 +2129,8 @@ public: virtual HRESULT STDMETHODCALLTYPE Reset() override { -return E_NOTIMPL; +mnIndex = 1; +return S_OK; } virtual HRESULT STDMETHODCALLTYPE STDMETHODCALLTYPE Skip(ULONG celt) override @@ -2131,9 +2139,9 @@ public: while (celt > 0) { -if (!mxEnumeration->hasMoreElements()) +if (mnIndex >= mxCollection->getCount()) return S_FALSE; -mxEnumeration->nextElement(); +mnIndex++; celt--; } return S_OK; @@ -2141,7 +2149,8 @@ public: private: InterfaceOleWrapper* mpInterfaceOleWrapper; -Reference mxEnumeration; +Reference mxCollection; +sal_Int32 mnIndex; }; class Sink : public cppu::WeakImplHelper @@ -2682,12 +2691,10 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short if( !pvarResult) return E_POINTER; -Reference< XEnumerationAccess > xEnumerationAccess(m_xOrigin, UNO_QUERY_THROW); -if (!xEnumerationAccess.is()) +Reference< ooo::vba::XCollection> xCollection(m_xOrigin, UNO_QUERY); +if (!xCollection.is()) return DISP_E_MEMBERNOTFOUND; -Reference< XEnumeration > xEnumeration = xEnumerationAccess->createEnumeration(); - CComObject* pEnumVar; ret = CComObject::CreateInstance(); @@ -2696,7 +2703,7 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short pEnumVar->AddRef(); -pEnumVar->Init(this, xEnumeration); +pEnumVar->Init(this, xCollection); pvarResult->vt = VT_UNKNOWN; pvarResult->punkVal = NULL; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits