[Libreoffice-commits] core.git: extensions/source

Tor Lillqvist tml at collabora.com
Thu Jun 7 08:41:02 UTC 2018


 extensions/source/ole/unoobjw.cxx |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

New commits:
commit 99bbed5cd87af8ff1b7e3d197d937fb17af021e6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jun 7 09:47:51 2018 +0300

    Improve logging in CXEnumVariant
    
    Change-Id: Ia0c3f9f1e95980b14415a030fc40268629ae06f3
    Reviewed-on: https://gerrit.libreoffice.org/55399
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 8b78f1df5beb..aa160fa1141a 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -2037,10 +2037,11 @@ public:
     // IEnumVARIANT
     virtual HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT **) override
     {
+        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
     {
@@ -2050,19 +2051,29 @@ public:
             *pCeltFetched = 0;
 
         if (celt == 0)
+        {
+            SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): E_INVALIDARG");
             return E_INVALIDARG;
+        }
 
         if (rgVar == nullptr || (celt != 1 && pCeltFetched == nullptr))
+        {
+            SAL_INFO("extensions.olebridge", this << "@CXEnumVariant::Next(" << celt << "): E_FAIL");
             return E_FAIL;
+        }
 
         for (ULONG i = 0; i < celt; i++)
             VariantInit(&rgVar[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());
@@ -2071,14 +2082,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;
     }
@@ -2087,13 +2101,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;
     }
 
@@ -2234,6 +2253,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, &aDispParams, &aVarResult, nullptr, &uArgErr);
+            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
@@ -2358,7 +2379,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;


More information about the Libreoffice-commits mailing list