[git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-67-gc50e22b

by Andre Heinecke cvs at cvs.gnupg.org
Fri Oct 7 14:16:02 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, nomapi has been updated
       via  c50e22b8d996be374905e977deaaaacce040b15c (commit)
       via  9c4c7cdebd018a2e4bcb4fb519ba06cc0c6550ed (commit)
       via  f0b818676f11d0c7395f6cf11a24e6a6ad6940a5 (commit)
      from  037b2aa3cba5d354586c1c7d311e86775ebb341e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c50e22b8d996be374905e977deaaaacce040b15c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Oct 7 14:14:38 2016 +0200

    Clean up set_pa_info and add comment
    
    * src/oomhelp.cpp (set_pa_variant): Cleanup.
    * src/oomhelp.h (set_pa_variant): Document painful experiments.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 3296637..562582c 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -811,7 +811,8 @@ get_oom_context_window (LPDISPATCH context)
   return ret;
 }
 
-int set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value)
+int
+set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value)
 {
   LPDISPATCH propertyAccessor;
   VARIANT cVariant[2];
@@ -824,6 +825,8 @@ int set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value)
   wchar_t *w_property;
   unsigned int argErr = 0;
 
+  init_excepinfo (&execpinfo);
+
   log_oom ("%s:%s: Looking up property: %s;",
              SRCNAME, __func__, dasl_id);
 
@@ -849,9 +852,12 @@ int set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value)
   b_property = SysAllocString (w_property);
   xfree (w_property);
 
+  /* Variant 0 carries the data. */
+  VariantCopy (&cVariant[0], value);
+
+  /* Variant 1 is the DASL as found out by experiments. */
   cVariant[1].vt = VT_BSTR;
   cVariant[1].bstrVal = b_property;
-  VariantCopy (&cVariant[0], value);
   dispparams.rgvarg = cVariant;
   dispparams.cArgs = 2;
   dispparams.cNamedArgs = 0;
@@ -861,6 +867,7 @@ int set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value)
                                  DISPATCH_METHOD, &dispparams,
                                  &rVariant, &execpinfo, &argErr);
   SysFreeString (b_property);
+  VariantClear (&cVariant[0]);
   gpgol_release (propertyAccessor);
   if (hr != S_OK)
     {
diff --git a/src/oomhelp.h b/src/oomhelp.h
index d352a8f..0859d17 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -163,7 +163,24 @@ get_pa_string (LPDISPATCH pDisp, const char *property);
 int
 get_pa_int (LPDISPATCH pDisp, const char *property, int *rInt);
 
-/* Set a variant with the propertyAccessor interface */
+/* Set a variant with the propertyAccessor interface.
+
+   This is tested to work at least vor BSTR variants. Trying
+   to set PR_ATTACH_DATA_BIN_DASL with this failed with
+   hresults 0x80020005 type mismatch or 0x80020008 vad
+   variable type for:
+   VT_ARRAY | VT_UI1 | VT_BYREF
+   VT_SAFEARRAY | VT_UI1 | VT_BYREF
+   VT_BSTR | VT_BYREF
+   VT_BSTR
+   VT_ARRAY | VT_UI1
+   VT_SAFEARRAY | VT_UI1
+
+   No idea whats wrong there. Needs more experiments. The
+   Type is only documented as "Binary". Outlookspy also
+   fails with the same error when trying to modify the
+   property.
+*/
 int
 set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value);
 

commit 9c4c7cdebd018a2e4bcb4fb519ba06cc0c6550ed
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Oct 7 14:13:10 2016 +0200

    Add excepinfo init helper
    
    * src/oomhelp.cpp (init_excepinfo): New. Init the struct.
    
    --
    Some invocation calls do not set excepinfo on failure this avoids
    that unitialized pointers in excepinfo are used in that case.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 2a286e9..3296637 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -107,6 +107,24 @@ lookup_oom_dispid (LPDISPATCH pDisp, const char *name)
   return dispid;
 }
 
+static void
+init_excepinfo (EXCEPINFO *err)
+{
+  if (!err)
+    {
+      return;
+    }
+  err->wCode = 0;
+  err->wReserved = 0;
+  err->bstrSource = nullptr;
+  err->bstrDescription = nullptr;
+  err->bstrHelpFile = nullptr;
+  err->dwHelpContext = 0;
+  err->pvReserved = nullptr;
+  err->pfnDeferredFillIn = nullptr;
+  err->scode = 0;
+}
+
 void
 dump_excepinfo (EXCEPINFO err)
 {
@@ -121,7 +139,9 @@ dump_excepinfo (EXCEPINFO err)
              "              scode: 0x%x\n",
              SRCNAME, __func__, (unsigned int) err.wCode,
              (unsigned int) err.wReserved,
-             err.bstrSource, err.bstrDescription, err.bstrHelpFile,
+             err.bstrSource ? err.bstrSource : L"null",
+             err.bstrDescription ? err.bstrDescription : L"null",
+             err.bstrHelpFile ? err.bstrDescription : L"null",
              (unsigned int) err.dwHelpContext,
              err.pfnDeferredFillIn,
              (unsigned int) err.scode);

commit f0b818676f11d0c7395f6cf11a24e6a6ad6940a5
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Oct 7 14:04:07 2016 +0200

    Simplify Attachment code by using just Data
    
    * src/attachment.cpp (Attachment::get_data): Direct access
    to the underlying data structure.
    * src/attachment.h, src/mimedataprovider.cpp: Update accordingly.
    
    --
    The plan was initially to use a MAPI Stream to hold the data
    now with the testing on GNU/Linux it's better to use a platform
    independent data structure and that simplifies the code.

diff --git a/src/attachment.cpp b/src/attachment.cpp
index 2dac020..fc528c7 100644
--- a/src/attachment.cpp
+++ b/src/attachment.cpp
@@ -51,34 +51,8 @@ Attachment::set_attach_type(attachtype_t type)
   m_type = type;
 }
 
-bool
-Attachment::isSupported(GpgME::DataProvider::Operation op) const
+GpgME::Data &
+Attachment::get_data()
 {
-  return op == GpgME::DataProvider::Read ||
-         op == GpgME::DataProvider::Write ||
-         op == GpgME::DataProvider::Seek ||
-         op == GpgME::DataProvider::Release;
-}
-
-ssize_t
-Attachment::read(void *buffer, size_t bufSize)
-{
-  return m_data.read (buffer, bufSize);
-}
-
-ssize_t
-Attachment::write(const void *data, size_t size)
-{
-  return m_data.write (data, size);
-}
-
-off_t Attachment::seek(off_t offset, int whence)
-{
-  return m_data.seek (offset, whence);
-}
-
-void Attachment::release()
-{
-  /* No op. */
-  log_debug ("%s:%s", SRCNAME, __func__);
+  return m_data;
 }
diff --git a/src/attachment.h b/src/attachment.h
index f2ba143..47c536e 100644
--- a/src/attachment.h
+++ b/src/attachment.h
@@ -22,11 +22,10 @@
 
 #include <string>
 
-#include <gpgme++/interfaces/dataprovider.h>
 #include <gpgme++/data.h>
 
 /** Helper class for attachment actions. */
-class Attachment : public GpgME::DataProvider
+class Attachment
 {
 public:
   /** Creates and opens a new in memory attachment. */
@@ -39,12 +38,8 @@ public:
 
   void set_attach_type(attachtype_t type);
 
-  /* Dataprovider interface */
-  bool isSupported(Operation) const;
-  ssize_t read(void *buffer, size_t bufSize);
-  ssize_t write(const void *buffer, size_t bufSize);
-  off_t seek(off_t offset, int whence);
-  void release();
+  /* get the underlying data structure */
+  GpgME::Data& get_data();
 
 private:
   GpgME::Data m_data;
diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp
index 59fcd38..a4aea43 100644
--- a/src/mimedataprovider.cpp
+++ b/src/mimedataprovider.cpp
@@ -662,10 +662,10 @@ MimeDataProvider::collect_input_lines(const char *input, size_t insize)
                 }
               else if (m_mime_ctx->current_attachment && len)
                 {
-                  m_mime_ctx->current_attachment->write(linebuf, len);
+                  m_mime_ctx->current_attachment->get_data().write(linebuf, len);
                   if (!m_mime_ctx->is_base64_encoded && !slbrk)
                     {
-                      m_mime_ctx->current_attachment->write("\r\n", 2);
+                      m_mime_ctx->current_attachment->get_data().write("\r\n", 2);
                     }
                 }
               else

-----------------------------------------------------------------------

Summary of changes:
 src/attachment.cpp       | 32 +++-----------------------------
 src/attachment.h         | 11 +++--------
 src/mimedataprovider.cpp |  4 ++--
 src/oomhelp.cpp          | 33 ++++++++++++++++++++++++++++++---
 src/oomhelp.h            | 19 ++++++++++++++++++-
 5 files changed, 56 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list