[git] GpgOL - branch, master, updated. gpgol-2.2.0-49-g42a0424

by Andre Heinecke cvs at cvs.gnupg.org
Tue Jul 10 14:41:42 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  42a0424b7cf2b7d3ebb80c8d70eadb21c67b620d (commit)
       via  fd411b524fd1d4617682f416d937be8ace410a6f (commit)
      from  7e6e15a8650ec232a1e07624b20bed9a4475fc50 (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 42a0424b7cf2b7d3ebb80c8d70eadb21c67b620d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jul 10 14:26:12 2018 +0200

    Convert common to cpp and clean it up
    
    * src/Makefile.am: Remove config-dialog.c
    * src/common.c, src/common.cpp: Cppify, cleanup.
    * src/config-dialog.c: Remove it.
    * src/gpgoladdin.cpp (GetCustomUI_MIME): Use normal utf8_to_wchar.

diff --git a/src/Makefile.am b/src/Makefile.am
index 500e286..d3d8b19 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,9 +30,8 @@ gpgol_SOURCES = \
     addin-options.cpp addin-options.h \
     application-events.cpp \
     attachment.h attachment.cpp \
-    common.h common.c \
+    common.h common.cpp \
     common_indep.h common_indep.c \
-    config-dialog.c \
     cpphelp.cpp cpphelp.h \
     cryptcontroller.cpp cryptcontroller.h \
     dialogs.h \
diff --git a/src/common.c b/src/common.cpp
similarity index 61%
rename from src/common.c
rename to src/common.cpp
index a9ac04b..629690d 100644
--- a/src/common.c
+++ b/src/common.cpp
@@ -37,9 +37,10 @@
 #include <ctype.h>
 
 #include "common.h"
-
 #include "dialogs.h"
 
+#include <string>
+
 HINSTANCE glob_hinst = NULL;
 
 void
@@ -48,202 +49,6 @@ set_global_hinstance (HINSTANCE hinst)
     glob_hinst = hinst;
 }
 
-/* Center the given window with the desktop window as the
-   parent window. */
-void
-center_window (HWND childwnd, HWND style)
-{
-    HWND parwnd;
-    RECT rchild, rparent;
-    HDC hdc;
-    int wchild, hchild, wparent, hparent;
-    int wscreen, hscreen, xnew, ynew;
-    int flags = SWP_NOSIZE | SWP_NOZORDER;
-
-    parwnd = GetDesktopWindow ();
-    GetWindowRect (childwnd, &rchild);
-    wchild = rchild.right - rchild.left;
-    hchild = rchild.bottom - rchild.top;
-
-    GetWindowRect (parwnd, &rparent);
-    wparent = rparent.right - rparent.left;
-    hparent = rparent.bottom - rparent.top;
-
-    hdc = GetDC (childwnd);
-    wscreen = GetDeviceCaps (hdc, HORZRES);
-    hscreen = GetDeviceCaps (hdc, VERTRES);
-    ReleaseDC (childwnd, hdc);
-    xnew = rparent.left + ((wparent - wchild) / 2);
-    if (xnew < 0)
-	xnew = 0;
-    else if ((xnew+wchild) > wscreen)
-	xnew = wscreen - wchild;
-    ynew = rparent.top  + ((hparent - hchild) / 2);
-    if (ynew < 0)
-	ynew = 0;
-    else if ((ynew+hchild) > hscreen)
-	ynew = hscreen - hchild;
-    if (style == HWND_TOPMOST || style == HWND_NOTOPMOST)
-	flags = SWP_NOMOVE | SWP_NOSIZE;
-    SetWindowPos (childwnd, style? style : NULL, xnew, ynew, 0, 0, flags);
-}
-
-
-/* Return the system's bitmap of the check bar used which check boxes.
-   If CHECKED is set, this check mark is returned; if it is not set,
-   the one used for not-checked is returned.  May return NULL on
-   error.  Taken from an example in the platform reference. 
-
-   Not used as of now. */
-HBITMAP
-get_system_check_bitmap (int checked)
-{
-  COLORREF bg_color;
-  HBRUSH bg_brush, saved_dst_brush;
-  HDC src_dc, dst_dc;
-  WORD xsize, ysize;
-  HBITMAP result, saved_dst_bitmap, saved_src_bitmap, checkboxes;
-  BITMAP bitmap;
-  RECT rect;
-
-  bg_color = GetSysColor (COLOR_MENU);
-  bg_brush = CreateSolidBrush (bg_color);
-
-  src_dc = CreateCompatibleDC (NULL);
-  dst_dc = CreateCompatibleDC (src_dc);
-
-  xsize = GetSystemMetrics (SM_CXMENUCHECK);
-  ysize = GetSystemMetrics (SM_CYMENUCHECK);
-  result = CreateCompatibleBitmap(src_dc, xsize, ysize);
-
-  saved_dst_brush  = SelectObject (dst_dc, bg_brush);
-  saved_dst_bitmap = SelectObject (dst_dc, result);
-
-  PatBlt (dst_dc, 0, 0, xsize, ysize, PATCOPY);
-
-  checkboxes = LoadBitmap (NULL, (LPTSTR)OBM_CHECKBOXES);
-
-  saved_src_bitmap = SelectObject (src_dc, checkboxes);
-
-  GetObject (checkboxes, sizeof (BITMAP), &bitmap);
-  rect.top = 0;
-  rect.bottom = (bitmap.bmHeight / 3);
-  if (checked)
-    {
-      /* Select row 1, column 1.  */
-      rect.left  = 0;
-      rect.right = (bitmap.bmWidth / 4);
-    }
-  else
-    {
-      /* Select row 1, column 2. */ 
-      rect.left  = (bitmap.bmWidth / 4);
-      rect.right = (bitmap.bmWidth / 4) * 2;
-    }
-
-  if ( ((rect.right - rect.left) > (int)xsize)
-       || ((rect.bottom - rect.top) > (int)ysize) )
-    StretchBlt (dst_dc, 0, 0, xsize, ysize, src_dc, rect.left, rect.top,
-                rect.right - rect.left, rect.bottom - rect.top, SRCCOPY);
-  else
-    BitBlt (dst_dc, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
-            src_dc, rect.left, rect.top, SRCCOPY);
-
-  SelectObject (src_dc, saved_src_bitmap);
-  SelectObject (dst_dc, saved_dst_brush);
-  result = SelectObject (dst_dc, saved_dst_bitmap);
-
-  DeleteObject (bg_brush);
-  DeleteObject (src_dc);
-  DeleteObject (dst_dc);
-  return result;
-}
-
-/* Return the path to a file that should be worked with.
-   Returns a malloced string (UTF-8) on success.
-   HWND is the current Window.
-   Title is a UTF-8 encoded string containing the
-   dialog title and may be NULL.
-   On error (i.e. cancel) NULL is returned. */
-char *
-get_open_filename (HWND root, const char *title)
-{
-  OPENFILENAMEW ofn;
-  wchar_t fname[MAX_PATH+1];
-  wchar_t *wTitle = NULL;
-
-  if (title)
-    {
-      wTitle = utf8_to_wchar2 (title, strlen(title));
-    }
-  memset (fname, 0, sizeof (fname));
-
-  /* Set up the ofn structure */
-  memset (&ofn, 0, sizeof (ofn));
-  ofn.lStructSize = sizeof (ofn);
-  ofn.hwndOwner = root;
-  ofn.lpstrFile = fname;
-  ofn.nMaxFile = MAX_PATH;
-  ofn.lpstrTitle = wTitle;
-  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
-
-  if (GetOpenFileNameW (&ofn))
-    {
-      xfree (wTitle);
-      return wchar_to_utf8_2 (fname, MAX_PATH);
-    }
-  xfree (wTitle);
-  return NULL;
-}
-
-
-/* Return a filename to be used for saving an attachment. Returns a
-   malloced string on success. HWND is the current Window and SRCNAME
-   the filename to be used as suggestion.  On error (i.e. cancel) NULL
-   is returned. */
-char *
-get_save_filename (HWND root, const char *srcname)
-{
-  char filter[21] = "All Files (*.*)\0*.*\0\0";
-  char fname[MAX_PATH+1];
-  char filterBuf[32];
-  char* extSep;
-  OPENFILENAME ofn;
-
-  memset (fname, 0, sizeof (fname));
-  memset (filterBuf, 0, sizeof (filterBuf));
-  strncpy (fname, srcname, MAX_PATH-1);
-  fname[MAX_PATH] = 0;
-
-  if ((extSep = strrchr (srcname, '.')) && strlen (extSep) <= 4)
-    {
-      /* Windows removes the file extension by default so we
-         need to set the first filter to the file extension.
-      */
-      strcpy (filterBuf, extSep);
-      strcpy (filterBuf + strlen (filterBuf) + 1, extSep);
-      memcpy (filterBuf + strlen (extSep) * 2 + 2, filter, 21);
-    }
-  else
-    memcpy (filterBuf, filter, 21);
-
-
-  memset (&ofn, 0, sizeof (ofn));
-  ofn.lStructSize = sizeof (ofn);
-  ofn.hwndOwner = root;
-  ofn.lpstrFile = fname;
-  ofn.nMaxFile = MAX_PATH;
-  ofn.lpstrFileTitle = NULL;
-  ofn.nMaxFileTitle = 0;
-  ofn.Flags |= OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
-  ofn.lpstrTitle = _("GpgOL - Save attachment");
-  ofn.lpstrFilter = filterBuf;
-
-  if (GetSaveFileName (&ofn))
-    return xstrdup (fname);
-  return NULL;
-}
-
 void
 bring_to_front (HWND wid)
 {
@@ -278,97 +83,6 @@ fatal_error (const char *format, ...)
 }
 
 
-/* This is a helper function to load a Windows function from either of
-   one DLLs. */
-static HRESULT
-w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e)
-{
-  static int initialized;
-  static HRESULT (WINAPI * func)(HWND,int,HANDLE,DWORD,LPSTR);
-
-  if (!initialized)
-    {
-      static char *dllnames[] = { "shell32.dll", "shfolder.dll", NULL };
-      void *handle;
-      int i;
-
-      initialized = 1;
-
-      for (i=0, handle = NULL; !handle && dllnames[i]; i++)
-        {
-          handle = LoadLibrary (dllnames[i]);
-          if (handle)
-            {
-              func = (HRESULT (WINAPI *)(HWND,int,HANDLE,DWORD,LPSTR))
-                     GetProcAddress (handle, "SHGetFolderPathA");
-              if (!func)
-                {
-                  FreeLibrary (handle);
-                  handle = NULL;
-                }
-            }
-        }
-    }
-
-  if (func)
-    return func (a,b,c,d,e);
-  else
-    return -1;
-}
-
-
-
-/* Same as above, but only convert the first LEN wchars.  */
-char *
-wchar_to_utf8_2 (const wchar_t *string, size_t len)
-{
-  int n;
-  char *result;
-
-  /* Note, that CP_UTF8 is not defined in Windows versions earlier
-     than NT.*/
-  n = WideCharToMultiByte (CP_UTF8, 0, string, len, NULL, 0, NULL, NULL);
-  if (n < 0)
-    return NULL;
-
-  result = xmalloc (n+1);
-  n = WideCharToMultiByte (CP_UTF8, 0, string, len, result, n, NULL, NULL);
-  if (n < 0)
-    {
-      xfree (result);
-      return NULL;
-    }
-  return result;
-}
-
-
-/* Same as above but convert only the first LEN characters.  STRING
-   must be at least LEN characters long. */
-wchar_t *
-utf8_to_wchar2 (const char *string, size_t len)
-{
-  int n;
-  wchar_t *result;
-
-  n = MultiByteToWideChar (CP_UTF8, 0, string, len, NULL, 0);
-  if (n < 0)
-    return NULL;
-
-  result = xmalloc ((n+1) * sizeof *result);
-  n = MultiByteToWideChar (CP_UTF8, 0, string, len, result, n);
-  if (n < 0)
-    {
-      xfree (result);
-      return NULL;
-    }
-  result[n] = 0;
-  return result;
-}
-
-
-
-
-
 /* Helper for read_w32_registry_string(). */
 static HKEY
 get_root_key(const char *root)
@@ -394,167 +108,97 @@ get_root_key(const char *root)
   return root_key;
 }
 
-/* Return a string from the Win32 Registry or NULL in case of error.
-   Caller must release the return value.  A NULL for root is an alias
-   for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn.  NOTE: The value
-   is allocated with a plain malloc() - use free() and not the usual
-   xfree(). */
-char *
-read_w32_registry_string (const char *root, const char *dir, const char *name)
+static std::string
+readRegStr (const char *root, const char *dir, const char *name)
 {
-  HKEY root_key, key_handle;
-  DWORD n1, nbytes, type;
-  char *result = NULL;
+#ifndef _WIN32
+    (void)root; (void)dir; (void)name;
+    return std::string();
+#else
 
-  if ( !(root_key = get_root_key(root) ) )
-    return NULL;
-
-  if( RegOpenKeyEx( root_key, dir, 0, KEY_READ, &key_handle ) )
-    {
-      if (root)
-	return NULL; /* no need for a RegClose, so return direct */
-      /* It seems to be common practise to fall back to HKLM. */
-      if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
-	return NULL; /* still no need for a RegClose, so return direct */
-    }
+    HKEY root_key, key_handle;
+    DWORD n1, nbytes, type;
+    std::string ret;
 
-  nbytes = 1;
-  if( RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes ) ) {
-    if (root)
-      goto leave;
-    /* Try to fallback to HKLM also vor a missing value.  */
-    RegCloseKey (key_handle);
-    if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
-      return NULL; /* Nope.  */
-    if (RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes))
-      goto leave;
-  }
-  result = malloc( (n1=nbytes+1) );
-  if( !result )
-    goto leave;
-  if( RegQueryValueEx( key_handle, name, 0, &type, result, &n1 ) ) {
-    free(result); result = NULL;
-    goto leave;
-  }
-  result[nbytes] = 0; /* make sure it is really a string  */
-  if (type == REG_EXPAND_SZ && strchr (result, '%')) {
-    char *tmp;
-
-    n1 += 1000;
-    tmp = malloc (n1+1);
-    if (!tmp)
-      goto leave;
-    nbytes = ExpandEnvironmentStrings (result, tmp, n1);
-    if (nbytes && nbytes > n1) {
-      free (tmp);
-      n1 = nbytes;
-      tmp = malloc (n1 + 1);
-      if (!tmp)
-	goto leave;
-      nbytes = ExpandEnvironmentStrings (result, tmp, n1);
-      if (nbytes && nbytes > n1) {
-	free (tmp); /* oops - truncated, better don't expand at all */
-	goto leave;
-      }
-      tmp[nbytes] = 0;
-      free (result);
-      result = tmp;
-    }
-    else if (nbytes) { /* okay, reduce the length */
-      tmp[nbytes] = 0;
-      free (result);
-      result = malloc (strlen (tmp)+1);
-      if (!result)
-	result = tmp;
-      else {
-	strcpy (result, tmp);
-	free (tmp);
-      }
-    }
-    else {  /* error - don't expand */
-      free (tmp);
+    if (!(root_key = get_root_key(root))) {
+        return ret;
     }
-  }
-
- leave:
-  RegCloseKey( key_handle );
-  return result;
-}
-
-
-/* Get the standard home directory.  In general this function should
-   not be used as it does not consider a registry value or the
-   GNUPGHOME environment variable.  Please use default_homedir(). */
-static const char *
-standard_homedir (void)
-{
-  static char *dir;
-
-  if (!dir)
-    {
-      char path[MAX_PATH];
-
-      /* It might be better to use LOCAL_APPDATA because this is
-         defined as "non roaming" and thus more likely to be kept
-         locally.  For private keys this is desired.  However, given
-         that many users copy private keys anyway forth and back,
-         using a system roaming services might be better than to let
-         them do it manually.  A security conscious user will anyway
-         use the registry entry to have better control.  */
-      if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
-                               NULL, 0, path) >= 0)
-        {
-          char *tmp = malloc (strlen (path) + 6 + 1);
 
-	  strcpy (tmp, path);
-	  strcat (tmp, "\\gnupg");
+    if (RegOpenKeyExA(root_key, dir, 0, KEY_READ, &key_handle)) {
+        if (root) {
+            /* no need for a RegClose, so return direct */
+            return ret;
+        }
+        /* Fallback to HKLM */
 
-          dir = tmp;
+        if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle)) {
+            return ret;
+        }
+    }
 
-          /* Try to create the directory if it does not yet exists.  */
-          if (access (dir, F_OK))
-            CreateDirectory (dir, NULL);
+    nbytes = 1;
+    if (RegQueryValueExA(key_handle, name, 0, nullptr, nullptr, &nbytes)) {
+        if (root) {
+            RegCloseKey (key_handle);
+            return ret;
+        }
+        /* Try to fallback to HKLM also vor a missing value.  */
+        RegCloseKey (key_handle);
+        if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle)) {
+            return ret;
+        }
+        if (RegQueryValueExA(key_handle, name, 0, nullptr, nullptr, &nbytes)) {
+            RegCloseKey(key_handle);
+            return ret;
         }
-      else
-        dir = xstrdup ("C:\\gnupg");
     }
-  return dir;
+    n1 = nbytes+1;
+    char result[n1];
+    if (RegQueryValueExA(key_handle, name, 0, &type, (LPBYTE)result, &n1)) {
+        RegCloseKey(key_handle);
+        return ret;
+    }
+    RegCloseKey(key_handle);
+    result[nbytes] = 0; /* make sure it is really a string  */
+    ret = result;
+    if (type == REG_EXPAND_SZ && strchr (result, '%')) {
+        n1 += 1000;
+        char tmp[n1 +1];
+
+        nbytes = ExpandEnvironmentStringsA(ret.c_str(), tmp, n1);
+        if (nbytes && nbytes > n1) {
+            n1 = nbytes;
+            char tmp2[n1 +1];
+            nbytes = ExpandEnvironmentStringsA(result, tmp2, n1);
+            if (nbytes && nbytes > n1) {
+                /* oops - truncated, better don't expand at all */
+                return ret;
+            }
+            tmp2[nbytes] = 0;
+            ret = tmp2;
+        } else if (nbytes) { /* okay, reduce the length */
+            tmp[nbytes] = 0;
+            ret = tmp;
+        }
+    }
+    return ret;
+#endif
 }
 
-
-/* Retrieve the default home directory.  */
-const char *
-default_homedir (void)
+/* Return a string from the Win32 Registry or NULL in case of error.
+   Caller must release the return value.  A NULL for root is an alias
+   for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn.  NOTE: The value
+   is allocated with a plain malloc() - use free() and not the usual
+   xfree(). */
+char *
+read_w32_registry_string (const char *root, const char *dir, const char *name)
 {
-  static char *dir;
-
-  if (!dir)
+  const auto ret = readRegStr (root, dir, name);
+  if (ret.empty())
     {
-      dir = getenv ("GNUPGHOME");
-      if (!dir || !*dir)
-        {
-          char *tmp;
-
-          tmp = read_w32_registry_string (NULL, GPG4WIN_REGKEY_3, "HomeDir");
-          if (!tmp)
-            {
-              tmp = read_w32_registry_string (NULL, GPG4WIN_REGKEY_2, "HomeDir");
-            }
-          if (tmp && !*tmp)
-            {
-              free (tmp);
-              tmp = NULL;
-            }
-          if (tmp)
-            dir = tmp;
-          else
-            dir = xstrdup (standard_homedir ());
-        }
-      else
-        dir = xstrdup (dir);
+      return nullptr;
     }
-
-  return dir;
+  return strdup (ret.c_str ());
 }
 
 /* Return the data dir used for forms etc.   Returns NULL on error. */
@@ -568,10 +212,10 @@ get_data_dir (void)
   instdir = get_gpg4win_dir();
   if (!instdir)
     return NULL;
-  
+
   /* Build the key: "<instdir>/share/gpgol".  */
 #define SDDIR "\\share\\gpgol"
-  dname = malloc (strlen (instdir) + strlen (SDDIR) + 1);
+  dname = (char*) malloc (strlen (instdir) + strlen (SDDIR) + 1);
   if (!dname)
     {
       free (instdir);
@@ -581,9 +225,9 @@ get_data_dir (void)
   strcpy (p, instdir);
   p += strlen (instdir);
   strcpy (p, SDDIR);
-  
+
   free (instdir);
-  
+
 #undef SDDIR
   return dname;
 }
@@ -914,7 +558,7 @@ get_uiserver_name (void)
     }
   if (uiserver)
     {
-      name = xmalloc (strlen (dir) + strlen (uiserver) + extra_arglen + 2);
+      name = (char*) xmalloc (strlen (dir) + strlen (uiserver) + extra_arglen + 2);
       strcpy (stpcpy (stpcpy (name, dir), "\\"), uiserver);
       for (p = name; *p; p++)
         if (*p == '/')
@@ -934,7 +578,7 @@ get_uiserver_name (void)
         {
           xfree (name);
         }
-      name = xmalloc (strlen (dir) + strlen (*tmp) + extra_arglen + 2);
+      name = (char *) xmalloc (strlen (dir) + strlen (*tmp) + extra_arglen + 2);
       strcpy (stpcpy (stpcpy (name, dir), "\\"), *tmp);
       for (p = name; *p; p++)
         if (*p == '/')
@@ -1087,7 +731,7 @@ expand_path (const char *path)
       return NULL;
     }
   len += 1;
-  p = xcalloc (1, len+1);
+  p = (char *) xcalloc (1, len+1);
   if (!p)
     {
       return NULL;
@@ -1133,7 +777,7 @@ load_config_value (HKEY hk, const char *path, const char *key, char **val)
     }
   else
     {
-      *val = xcalloc(1, size+1);
+      *val = (char *) xcalloc(1, size+1);
       ec = RegQueryValueEx (h, key, NULL, &type, (BYTE*)*val, &size);
       if (ec != ERROR_SUCCESS)
         {
diff --git a/src/common.h b/src/common.h
index 265955c..52099fd 100644
--- a/src/common.h
+++ b/src/common.h
@@ -33,6 +33,12 @@
 
 #include <windows.h>
 
+/* i18n stuff */
+#include "w32-gettext.h"
+#define _(a) gettext (a)
+#define N_(a) gettext_noop (a)
+
+
 /* Registry path to store plugin settings */
 #define GPGOL_REGPATH "Software\\GNU\\GpgOL"
 
@@ -47,13 +53,7 @@ extern UINT      this_dll;
 
 /*-- common.c --*/
 void set_global_hinstance (HINSTANCE hinst);
-void center_window (HWND childwnd, HWND style);
-HBITMAP get_system_check_bitmap (int checked);
-char *get_save_filename (HWND root, const char *srcname);
-char *get_open_filename (HWND root, const char *title);
-char *utf8_to_wincp (const char *string);
 
-const char *default_homedir (void);
 char *get_data_dir (void);
 char *get_gpg4win_dir (void);
 
@@ -68,22 +68,6 @@ wchar_t *get_tmp_outfile (wchar_t *name, HANDLE *outHandle);
 wchar_t *get_pretty_attachment_name (wchar_t *path, protocol_t protocol,
                                      int signature);
 
-/*-- recipient-dialog.c --*/
-unsigned int recipient_dialog_box (gpgme_key_t **ret_rset);
-unsigned int recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown,
-                                    gpgme_key_t **ret_rset);
-
-/*-- passphrase-dialog.c --*/
-int signer_dialog_box (gpgme_key_t *r_key, char **r_passwd, int encrypting);
-gpgme_error_t passphrase_callback_box (void *opaque, const char *uid_hint,
-			     const char *pass_info,
-			     int prev_was_bad, int fd);
-void free_decrypt_key (struct passphrase_cb_s *ctx);
-const char *get_pubkey_algo_str (gpgme_pubkey_algo_t id);
-
-/*-- config-dialog.c --*/
-void config_dialog_box (HWND parent);
-
 /*-- verify-dialog.c --*/
 int verify_dialog_box (gpgme_protocol_t protocol,
                        gpgme_verify_result_t res,
@@ -100,18 +84,10 @@ int initialize_inspectors (void);
 #endif
 
 
-/* i18n stuff */
-#include "w32-gettext.h"
-#define _(a) gettext (a)
-#define N_(a) gettext_noop (a)
-
-
 /*-- common.c --*/
 
 void fatal_error (const char *format, ...);
 
-char *wchar_to_utf8_2 (const wchar_t *string, size_t len);
-wchar_t *utf8_to_wchar2 (const char *string, size_t len);
 char *read_w32_registry_string (const char *root, const char *dir,
                                 const char *name);
 char *percent_escape (const char *str, const char *extra);
@@ -128,18 +104,11 @@ char *get_uiserver_name (void);
 int is_elevated (void);
 
 /*-- main.c --*/
-const void *get_128bit_session_key (void);
-const void *get_64bit_session_marker (void);
-void *create_initialization_vector (size_t nbytes);
-
 void read_options (void);
 int write_options (void);
 
 extern int g_ol_version_major;
 
-void log_window_hierarchy (HWND window, const char *fmt,
-                           ...) __attribute__ ((format (printf,2,3)));
-
 void bring_to_front (HWND wid);
 
 int gpgol_message_box (HWND parent, const char *utf8_text,
diff --git a/src/config-dialog.c b/src/config-dialog.c
deleted file mode 100644
index b2663f7..0000000
--- a/src/config-dialog.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* config-dialog.c
- * Copyright (C) 2005, 2008 g10 Code GmbH
- * Copyright (C) 2003 Timo Schulz
- *
- * This file is part of GpgOL.
- * 
- * GpgOL 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.
- * 
- * GpgOL 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 this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include <windows.h>
-#include <shellapi.h>
-#include <shlobj.h>
-
-#include "common.h"
-#include "gpgol-ids.h"
-#include "dialogs.h"
-
-/* To avoid writing a dialog template for each language we use gettext
-   for the labels and hope that there is enough space in the dialog to
-   fit teh longest translation.  */
-static void
-config_dlg_set_labels (HWND dlg)
-{
-  static struct { int itemid; const char *label; } labels[] = {
-    { IDC_T_DEBUG_LOGFILE,  N_("Debug output (for analysing problems)")},
-    { 0, NULL}
-  };
-  int i;
-
-  for (i=0; labels[i].itemid; i++)
-    SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
-
-}
-
-static BOOL CALLBACK
-config_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
-{
-  char name[MAX_PATH+1];
-  int n;
-  const char *s;
-
-  (void)lparam;
-
-  switch (msg) 
-    {
-    case WM_INITDIALOG:
-      center_window (dlg, 0);
-      s = get_log_file ();
-      SetDlgItemText (dlg, IDC_DEBUG_LOGFILE, s? s:"");
-      config_dlg_set_labels (dlg);
-      break;
-
-    case WM_COMMAND:
-      switch (LOWORD (wparam)) 
-        {
-        case IDOK:
-          n = GetDlgItemText (dlg, IDC_DEBUG_LOGFILE, name, MAX_PATH-1);
-          set_log_file (n>0?name:NULL);
-          EndDialog (dlg, TRUE);
-          break;
-        }
-      break;
-    }
-  return FALSE;
-}
-
-/* Display GPG configuration dialog. */
-void
-config_dialog_box (HWND parent)
-{
-#ifndef _WIN64
-  int resid;
-
-  resid = IDD_EXT_OPTIONS;
-
-  if (!parent)
-    parent = GetDesktopWindow ();
-  DialogBoxParam (glob_hinst, (LPCTSTR)resid, parent, config_dlg_proc, 0);
-#else
-  (void)parent;
-  (void)config_dlg_proc;
-#endif
-}
diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index b43ef6f..15fb475 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -1061,7 +1061,7 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml)
 
   if (buffer)
     {
-      wchar_t *wbuf = utf8_to_wchar2 (buffer, strlen(buffer));
+      wchar_t *wbuf = utf8_to_wchar (buffer);
       xfree (buffer);
       *RibbonXml = SysAllocString (wbuf);
       xfree (wbuf);

commit fd411b524fd1d4617682f416d937be8ace410a6f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jul 10 13:47:52 2018 +0200

    Remove accidentally commited dev debug
    
    --

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 7884752..a5822b5 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -2265,7 +2265,6 @@ get_ol_ui_language ()
 
   int result = var.intVal;
 
-  log_debug ("XXXXX %i", result);
   VariantClear (&var);
   return result;
 }

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

Summary of changes:
 src/Makefile.am              |   3 +-
 src/{common.c => common.cpp} | 530 +++++++------------------------------------
 src/common.h                 |  43 +---
 src/config-dialog.c          |  96 --------
 src/gpgoladdin.cpp           |   2 +-
 src/oomhelp.cpp              |   1 -
 6 files changed, 95 insertions(+), 580 deletions(-)
 rename src/{common.c => common.cpp} (61%)
 delete mode 100644 src/config-dialog.c


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




More information about the Gnupg-commits mailing list