[git] GpgOL - branch, master, updated. gpgol-2.2.0-44-gc29f79c

by Andre Heinecke cvs at cvs.gnupg.org
Tue Jul 10 10:31:34 CEST 2018


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, master has been updated
       via  c29f79c0d24c99227ba490cc0192ed97d6120d16 (commit)
       via  d7bfab741b3aa7e0c734f4255c9d9f45c0f90fea (commit)
      from  db282a59ab661e0060e244d55f7bc1d807f76102 (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 c29f79c0d24c99227ba490cc0192ed97d6120d16
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jul 10 10:30:51 2018 +0200

    Use unique ptr for parser context
    
    * src/parsecontroller.cpp (ParseController::parse): Use unique
    ptr for GpgME Context.
    
    --
    Wherever I see it I tend to change it. Makes the code
    easier.

diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index a984b6d..29e5b30 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -282,7 +282,7 @@ ParseController::parse()
     {
       protocol = Protocol::OpenPGP;
     }
-  auto ctx = Context::createForProtocol (protocol);
+  auto ctx = std::unique_ptr<Context> (Context::createForProtocol (protocol));
   if (!ctx)
     {
       log_error ("%s:%s:Failed to create context. Installation broken.",
@@ -417,8 +417,7 @@ ParseController::parse()
               if (utf8)
                 {
                   // Try again after conversion.
-                  delete ctx;
-                  ctx = Context::createForProtocol (protocol);
+                  ctx = std::unique_ptr<Context> (Context::createForProtocol (protocol));
                   ctx->setArmor (true);
                   if (!m_sender.empty())
                     {
@@ -445,7 +444,6 @@ ParseController::parse()
 #endif
         }
     }
-  delete ctx;
   log_debug ("%s:%s:%p: decrypt err: %i verify err: %i",
              SRCNAME, __func__, this, m_decrypt_result.error().code(),
              m_verify_result.error().code());

commit d7bfab741b3aa7e0c734f4255c9d9f45c0f90fea
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jul 10 10:27:50 2018 +0200

    Use c++ linkage for oomhelp and conv w32getttext
    
    * src/mapihelp.h: Don't include oomhelp with c linkage.
    * src/oomhelp.h: Use C++ linkage.
    * src/Makefile.am: Update accordingly.
    * src/w32-gettext.c, src/w32-gettext.cpp: Renamed. Added
    casts for c++ and removed trailing whitespace.
    * src/w32-gettext.h: Use C linkage for gettext.
    
    --
    We have some few C only files like common and main but
    mostly we are fully c++. Using C++ linkage will allow
    us to change oomhelp functions to work with C++ data
    types for better memory management.

diff --git a/src/Makefile.am b/src/Makefile.am
index 161bd88..500e286 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -67,7 +67,7 @@ gpgol_SOURCES = \
     rfc2047parse.h rfc2047parse.c \
     rfc822parse.c rfc822parse.h \
     ribbon-callbacks.cpp ribbon-callbacks.h \
-    w32-gettext.c w32-gettext.h \
+    w32-gettext.cpp w32-gettext.h \
     windowmessages.h windowmessages.cpp \
     wks-helper.cpp wks-helper.h \
     xmalloc.h
diff --git a/src/mapihelp.h b/src/mapihelp.h
index 43074f6..ede2cbf 100644
--- a/src/mapihelp.h
+++ b/src/mapihelp.h
@@ -20,18 +20,15 @@
 #ifndef MAPIHELP_H
 #define MAPIHELP_H
 
-#ifdef __cplusplus
-extern "C" {
-#if 0
-}
-#endif
-#endif
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #include <oomhelp.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 /* The filename of the attachment we create as the result of sign or
    encrypt operations.  Don't change this name as some tests rely on
    it.  */
diff --git a/src/oomhelp.h b/src/oomhelp.h
index d4fd0f5..1136992 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -123,13 +123,6 @@ DEFINE_OLEGUID(IID_IOleWindow,                0x00000114, 0, 0);
 #define PR_BLOCK_STATUS_DASL \
   "http://schemas.microsoft.com/mapi/proptag/0x10960003"
 
-#ifdef __cplusplus
-extern "C" {
-#if 0
-}
-#endif
-#endif
-
 /* Return the malloced name of an COM+ object.  */
 char *get_object_name (LPUNKNOWN obj);
 
@@ -358,8 +351,5 @@ int get_ex_major_version_for_addr (const char *mbox);
 /* Get the language code used for Outlooks UI */
 int get_ol_ui_language (void);
 
-#ifdef __cplusplus
 char *get_sender_SendUsingAccount (LPDISPATCH mailitem, bool *r_is_GSuite);
-}
-#endif
 #endif /*OOMHELP_H*/
diff --git a/src/w32-gettext.c b/src/w32-gettext.cpp
similarity index 98%
rename from src/w32-gettext.c
rename to src/w32-gettext.cpp
index 081f050..0f67673 100644
--- a/src/w32-gettext.c
+++ b/src/w32-gettext.cpp
@@ -3,17 +3,17 @@
    Copyright (C) 2005, 2007 g10 Code GmbH
 
    This file is part of libgpg-error.
- 
+
    libgpg-error is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public License
    as published by the Free Software Foundation; either version 2.1 of
    the License, or (at your option) any later version.
- 
+
    libgpg-error is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
- 
+
    You should have received a copy of the GNU Lesser General Public
    License along with libgpg-error; if not, write to the Free
    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -743,7 +743,7 @@ _nl_locale_name (int category, const char *categoryname)
      On some systems this can be done by the 'setlocale' function itself.  */
 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
   retval = setlocale (category, NULL);
-# else 
+# else
   /* Setting of LC_ALL overwrites all other.  */
   retval = getenv ("LC_ALL");
   if (retval == NULL || retval[0] == '\0')
@@ -1303,7 +1303,7 @@ free_domain (struct loaded_domain *domain)
   free (domain);
 }
 
-  
+
 /* The gettext implementation; support functions.  */
 static struct loaded_domain *
 load_domain (const char *filename)
@@ -1315,7 +1315,7 @@ load_domain (const char *filename)
   struct loaded_domain *domain = NULL;
   size_t to_read;
   char *read_ptr;
-  
+
   fp = fopen (filename, "rb");
   if (!fp)
     return NULL;
@@ -1329,7 +1329,7 @@ load_domain (const char *filename)
       return NULL;
     }
 
-  data = malloc (size);
+  data = (mo_file_header*) malloc (size);
   if (!data)
     {
       fclose (fp);
@@ -1362,7 +1362,7 @@ load_domain (const char *filename)
       return NULL;
     }
 
-  domain = calloc (1, sizeof *domain);
+  domain = (loaded_domain *) calloc (1, sizeof *domain);
   if (!domain)
     {
       free (data);
@@ -1370,12 +1370,12 @@ load_domain (const char *filename)
     }
   domain->data = (char *) data;
   domain->must_swap = data->magic != MAGIC;
-  
+
   /* Fill in the information about the available tables.  */
   switch (SWAPIT (domain->must_swap, data->revision))
     {
     case 0:
-      
+
       domain->nstrings = SWAPIT (domain->must_swap, data->nstrings);
       domain->orig_tab = (struct string_desc *)
 	((char *) data + SWAPIT (domain->must_swap, data->orig_tab_offset));
@@ -1394,7 +1394,7 @@ load_domain (const char *filename)
     }
 
   /* Allocate an array to keep track of code page mappings.  */
-  domain->mapped = calloc (1, domain->nstrings);
+  domain->mapped = (char *) calloc (1, domain->nstrings);
   if (!domain->mapped)
     {
       free (data);
@@ -1421,7 +1421,7 @@ wchar_to_native (const wchar_t *string)
   if (n < 0)
     return NULL;
 
-  result = malloc (n+1);
+  result = (char*) malloc (n+1);
   if (!result)
     return NULL;
 
@@ -1445,7 +1445,7 @@ native_to_wchar (const char *string)
   if (n < 0)
     return NULL;
 
-  result = malloc ((n+1) * sizeof *result);
+  result = (wchar_t *) malloc ((n+1) * sizeof *result);
   if (!result)
     return NULL;
 
@@ -1474,7 +1474,7 @@ utf8_to_wchar (const char *string)
   if (n < 0)
     return NULL;
 
-  result = malloc ((n+1) * sizeof *result);
+  result = (wchar_t *) malloc ((n+1) * sizeof *result);
   if (!result)
     return NULL;
 
@@ -1505,7 +1505,7 @@ wchar_to_utf8 (const wchar_t *string)
   if (n < 0)
     return NULL;
 
-  result = xmalloc (n+1);
+  result = (char *) xmalloc (n+1);
   n = WideCharToMultiByte (CP_UTF8, 0, string, -1, result, n, NULL, NULL);
   if (n < 0)
     {
@@ -1544,7 +1544,7 @@ utf8_to_native (const char *string)
 char *
 native_to_utf8 (const char *string)
 {
-  char *result; 
+  char *result;
   wchar_t *wstring;
 
   wstring = native_to_wchar (string);
@@ -1568,7 +1568,7 @@ get_string (struct loaded_domain *domain, u32 idx, int utf8)
   char *p;
 
   p = domain->data + SWAPIT (domain->must_swap, domain->trans_tab[idx].offset);
-  if (!domain->mapped[idx]) 
+  if (!domain->mapped[idx])
     {
       size_t plen, buflen;
       char *buf;
@@ -1586,7 +1586,7 @@ get_string (struct loaded_domain *domain, u32 idx, int utf8)
              in the overflow_space else and mark that in the mapped
              array.  Because we expect that this won't happen too
              often, we use a simple linked list.  */
-          os = malloc (sizeof *os + buflen);
+          os = (overflow_space_s *) malloc (sizeof *os + buflen);
           if (os)
             {
               os->idx = idx;
@@ -1596,17 +1596,17 @@ get_string (struct loaded_domain *domain, u32 idx, int utf8)
               p = os->d;
             }
           else
-            p = "ERROR in GETTEXT MALLOC";
+            p = (char *) "ERROR in GETTEXT MALLOC";
         }
       free (buf);
     }
-  else if (domain->mapped[idx] == 2) 
+  else if (domain->mapped[idx] == 2)
     {
       /* We need to get the string from the overflow_space.  */
       for (os=domain->overflow_space; os; os = os->next)
         if (os->idx == idx)
           return (const char*) os->d;
-      p = "ERROR in GETTEXT\n";
+      p = (char *) "ERROR in GETTEXT\n";
     }
   return (const char*) p;
 }
@@ -1645,7 +1645,7 @@ bindtextdomain (const char *domainname, const char *dirname)
     {
       char *p;
 
-      catval = malloc (strlen (catval_full) + 1);
+      catval = (char *)malloc (strlen (catval_full) + 1);
       if (catval)
 	{
 	  strcpy (catval, catval_full);
@@ -1664,7 +1664,7 @@ bindtextdomain (const char *domainname, const char *dirname)
       + strlen (domainname) + 3 + 1;
     char *p;
 
-    fname = malloc (len);
+    fname = (char*) malloc (len);
     if (!fname)
       {
 	free (catval);
diff --git a/src/w32-gettext.h b/src/w32-gettext.h
index 9ef5525..cf72888 100644
--- a/src/w32-gettext.h
+++ b/src/w32-gettext.h
@@ -25,6 +25,13 @@
 # define LC_MESSAGES 1729
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#if 0
+}
+#endif
+#endif
+
 /* Specify that the DOMAINNAME message catalog will be found
    in DIRNAME rather than in the system locale data base.  */
 char *bindtextdomain (const char *domainname, const char *dirname);
@@ -64,4 +71,6 @@ wchar_t *utf8_to_wchar (const char *string);
 char *utf8_to_native (const char *string);
 char *native_to_utf8 (const char *string);
 
-
+#ifdef __cplusplus
+}
+#endif

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

Summary of changes:
 src/Makefile.am                        |  2 +-
 src/mapihelp.h                         |  9 +++----
 src/oomhelp.h                          | 10 --------
 src/parsecontroller.cpp                |  6 ++---
 src/{w32-gettext.c => w32-gettext.cpp} | 46 +++++++++++++++++-----------------
 src/w32-gettext.h                      | 11 +++++++-
 6 files changed, 39 insertions(+), 45 deletions(-)
 rename src/{w32-gettext.c => w32-gettext.cpp} (98%)


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




More information about the Gnupg-commits mailing list