[git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-313-g0f38c87

by Werner Koch cvs at cvs.gnupg.org
Wed Feb 26 16:51:32 CET 2014


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 "The GNU Privacy Guard".

The branch, master has been updated
       via  0f38c87f427a155ab5684e18e3b73956f81edfab (commit)
       via  c72762f9acf3eef5c466ba76e895d7654df12ff7 (commit)
       via  556562086acd2bc2f8e3aa3126ebf155715e042b (commit)
       via  55c3e5f448c26360eda31e05b1f62249119f73d9 (commit)
       via  380a2aa18e0c048cfefa1cb4102dfbf902a1962b (commit)
      from  47e6b6bad1dff493f4102a5549a7bb54466684c2 (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 0f38c87f427a155ab5684e18e3b73956f81edfab
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Feb 26 16:50:59 2014 +0100

    common: Replace all macros in strusage() returned strings.
    
    * common/argparse.c (writechar): Remove.
    (writestrings): Simplify.
    (strusage): Use map_static_macro_string.

diff --git a/common/argparse.c b/common/argparse.c
index c9930ea..fb3dbb6 100644
--- a/common/argparse.c
+++ b/common/argparse.c
@@ -185,19 +185,6 @@ argparse_register_outfnc (int (*fnc)(int, const char *))
 }
 
 
-static void
-writechar (int is_error, int c)
-{
-  char tmp[2];
-
-  tmp[0] = c;
-  tmp[1] = 0;
-  if (custom_outfnc)
-    custom_outfnc (is_error? 2:1, tmp);
-  else
-    fputs (tmp, is_error? stderr : stdout);
-}
-
 /* Write STRING and all following const char * arguments either to
    stdout or, if IS_ERROR is set, to stderr.  The list of strings must
    be terminated by a NULL.  */
@@ -214,64 +201,11 @@ writestrings (int is_error, const char *string, ...)
       va_start (arg_ptr, string);
       do
         {
-          const char *s2, *s3;
-
-          /* Check whether to substitute a macro. */
-          if (s && (s2 = strchr (s, '@')) && s2[1] >= 'A' && s2[1] <= 'Z'
-              && (s3 = (strchr (s2+1, '@'))))
-            {
-              /* Might be.  */
-              static struct {
-                const char *name;
-                const char *value;
-              } macros[] = {
-#             ifdef PACKAGE_BUGREPORT
-                { "EMAIL", PACKAGE_BUGREPORT },
-#             else
-                { "EMAIL", "bug at example.org" },
-#             endif
-                { "GNUPG",     GNUPG_NAME },
-                { "GPG",       GPG_NAME },
-                { "GPGSM",     GPGSM_NAME },
-                { "GPG_AGENT", GPG_AGENT_NAME },
-                { "SCDAEMON",  SCDAEMON_NAME },
-                { "DIRMNGR",   DIRMNGR_NAME },
-                { "G13",       G13_NAME },
-                { "GPGCONF",   GPGCONF_NAME },
-                { "GPGTAR",    GPGTAR_NAME }
-              };
-              int idx;
-
-              s2++;
-              for (idx=0; idx < DIM (macros); idx++)
-                if (strlen (macros[idx].name) == (s3 - s2)
-                    && !memcmp (macros[idx].name, s2, (s3 - s2)))
-                  break;
-              s2--;
-              if (idx < DIM (macros)) /* Found.  Print and substitute.  */
-                {
-                  for (; s < s2; s++, count++)
-                    writechar (is_error, *s);
-                  count += writestrings (is_error, macros[idx].value, NULL);
-                  s3++;
-                }
-              else /* Not found.  Print macro as is. */
-                {
-                  for (; s < s3; s++, count++)
-                    writechar (is_error, *s);
-                }
-              /* Now recurse so that remaining macros are also
-                 substituted. */
-              count += writestrings (is_error, s3, NULL);
-            }
+          if (custom_outfnc)
+            custom_outfnc (is_error? 2:1, s);
           else
-            {
-              if (custom_outfnc)
-                custom_outfnc (is_error? 2:1, s);
-              else
-                fputs (s, is_error? stderr : stdout);
-              count += strlen (s);
-            }
+            fputs (s, is_error? stderr : stdout);
+          count += strlen (s);
         }
       while ((s = va_arg (arg_ptr, const char *)));
       va_end (arg_ptr);
@@ -1381,7 +1315,7 @@ strusage( int level )
   const char *p = strusage_handler? strusage_handler(level) : NULL;
 
   if ( p )
-    return p;
+    return map_static_macro_string (p);
 
   switch ( level )
     {

commit c72762f9acf3eef5c466ba76e895d7654df12ff7
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Feb 26 16:18:45 2014 +0100

    common: New function map_static_macro_string.
    
    * common/mapstrings.c: New.
    * common/t-mapstrings.c: New.
    * common/t-support.h (DIM, DIMof): Define if not defined.
    * common/Makefile.am: Add new files.

diff --git a/common/Makefile.am b/common/Makefile.am
index a777a34..21f779c 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -42,7 +42,7 @@ include $(top_srcdir)/am/cmacros.am
 jnlib_sources = \
 	libjnlib-config.h \
 	types.h host2net.h dynload.h w32help.h \
-	stringhelp.c stringhelp.h \
+	mapstrings.c stringhelp.c stringhelp.h \
 	strlist.c strlist.h \
 	utf8conv.c utf8conv.h \
 	argparse.c argparse.h \
@@ -165,7 +165,8 @@ if HAVE_W32_SYSTEM
 jnlib_tests += t-w32-reg
 endif
 module_tests = t-convert t-percent t-gettime t-sysutils t-sexputil \
-	       t-session-env t-openpgp-oid t-ssh-utils t-dns-cert
+	       t-session-env t-openpgp-oid t-ssh-utils t-dns-cert \
+	       t-mapstrings
 if !HAVE_W32CE_SYSTEM
 module_tests += t-exechelp
 endif
@@ -200,3 +201,4 @@ t_session_env_LDADD = $(t_common_ldadd)
 t_openpgp_oid_LDADD = $(t_common_ldadd)
 t_ssh_utils_LDADD = $(t_common_ldadd)
 t_dns_cert_LDADD = $(t_common_ldadd) $(DNSLIBS)
+t_mapstrings_LDADD = $(t_common_ldadd)
diff --git a/common/mapstrings.c b/common/mapstrings.c
new file mode 100644
index 0000000..91795d5
--- /dev/null
+++ b/common/mapstrings.c
@@ -0,0 +1,167 @@
+/* mapstrings.c - Static string mapping
+ * Copyright (C) 2014 Werner Koch
+ *
+ * This file is part of GnuPG.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either
+ *
+ *   - the GNU Lesser General Public License as published by the Free
+ *     Software Foundation; either version 3 of the License, or (at
+ *     your option) any later version.
+ *
+ * or
+ *
+ *   - the GNU General Public License as published by the Free
+ *     Software Foundation; either version 2 of the License, or (at
+ *     your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * This file 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "util.h"
+#include "stringhelp.h"
+#include "membuf.h"
+
+
+static struct {
+  const char *name;
+  const char *value;
+} macros[] = {
+#ifdef PACKAGE_BUGREPORT
+  { "EMAIL", PACKAGE_BUGREPORT },
+#else
+  { "EMAIL", "bug at example.org" },
+#endif
+  { "GNUPG",     GNUPG_NAME },
+  { "GPG",       GPG_NAME },
+  { "GPGSM",     GPGSM_NAME },
+  { "GPG_AGENT", GPG_AGENT_NAME },
+  { "SCDAEMON",  SCDAEMON_NAME },
+  { "DIRMNGR",   DIRMNGR_NAME },
+  { "G13",       G13_NAME },
+  { "GPGCONF",   GPGCONF_NAME },
+  { "GPGTAR",    GPGTAR_NAME }
+};
+
+
+
+/* A list to remember already done mappings.  */
+struct mapping_s
+{
+  struct mapping_s *next;
+  const char *key;
+  const char *value;
+};
+static struct mapping_s *mappings;
+
+
+/* If STRING has already been mapped, return the mapped string.  If
+   not return NULL.  */
+static const char *
+already_mapped (const char *string)
+{
+  struct mapping_s *m;
+
+  for (m=mappings; m; m = m->next)
+    if (m->key == string && !strcmp (m->key, string))
+      return m->value;
+  return NULL;
+}
+
+
+/* Store NEWSTRING under key STRING and return NEWSTRING.  */
+static const char *
+store_mapping (const char *string, char *newstring)
+{
+  struct mapping_s *m;
+
+  m = xmalloc (sizeof *m);
+  m->key = string;
+  m->value = newstring;
+  m->next = mappings;
+  mappings = m;
+  return newstring;
+}
+
+
+/* Find the first macro in STRING.  Return a pointer to the
+   replacement value, set BEGPTR to the leading '@', and set ENDPTR to
+   the terminating '@'.  If no macro is found return NULL.  */
+const char *
+find_macro (const char *string,  const char **begptr,
+            const char **endptr)
+{
+  const char *s, *s2, *s3;
+  int idx;
+
+  s = string;
+  if (!s)
+    return NULL;
+
+  for (; (s2 = strchr (s, '@')); s = s2)
+    {
+      s2++;
+      if (*s2 >= 'A' && *s2 <= 'Z' && (s3 = (strchr (s2, '@'))))
+        {
+          for (idx=0; idx < DIM (macros); idx++)
+            if (strlen (macros[idx].name) == (s3 - s2)
+                && !memcmp (macros[idx].name, s2, (s3 - s2)))
+              {
+                *begptr = s2 - 1;
+                *endptr = s3;
+                return macros[idx].value;
+              }
+        }
+    }
+  return NULL;
+}
+
+
+/* If STRING includes known @FOO@ macros, replace these macros and
+   return a new static string.  Warning: STRING must have been
+   allocated statically.  Note that this function allocated memory
+   which will not be released (similar to gettext).  */
+const char *
+map_static_macro_string (const char *string)
+{
+  const char *s, *s2, *s3, *value;
+  membuf_t mb;
+  char *p;
+
+  if ((s = already_mapped (string)))
+    return s;
+  s = string;
+  value = find_macro (s, &s2, &s3);
+  if (!value)
+    return string; /* No macros at all.  */
+
+  init_membuf (&mb, strlen (string) + 100);
+  do
+    {
+      put_membuf (&mb, s, s2 - s);
+      put_membuf_str (&mb, value);
+      s = s3 + 1;
+    }
+  while ((value = find_macro (s, &s2, &s3)));
+  put_membuf_str (&mb, s);
+  put_membuf (&mb, "", 1);
+
+  p = get_membuf_shrink (&mb, NULL);
+  if (!p)
+    log_fatal ("map_static_macro_string failed: %s\n", strerror (errno));
+
+  return store_mapping (string, p);
+}
diff --git a/common/stringhelp.h b/common/stringhelp.h
index c1f7ea1..21bb20d 100644
--- a/common/stringhelp.h
+++ b/common/stringhelp.h
@@ -34,6 +34,7 @@
 
 #include "types.h"
 
+/*-- stringhelp.c --*/
 char *has_leading_keyword (const char *string, const char *keyword);
 
 const char *memistr (const void *buf, size_t buflen, const char *sub);
@@ -145,5 +146,8 @@ char *strconcat (const char *s1, ...) GNUPG_GCC_A_SENTINEL(0);
 char *xstrconcat (const char *s1, ...) GNUPG_GCC_A_SENTINEL(0);
 
 
+/*-- mapstrings.c --*/
+const char *map_static_macro_string (const char *string);
+
 
 #endif /*LIBJNLIB_STRINGHELP_H*/
diff --git a/common/t-mapstrings.c b/common/t-mapstrings.c
new file mode 100644
index 0000000..14e4bb9
--- /dev/null
+++ b/common/t-mapstrings.c
@@ -0,0 +1,101 @@
+/* t-mapstrings.c - Regression tests for mapstrings.c
+ * Copyright (C) 2014 Werner Koch
+ *
+ * This file is part of GnuPG.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either
+ *
+ *   - the GNU Lesser General Public License as published by the Free
+ *     Software Foundation; either version 3 of the License, or (at
+ *     your option) any later version.
+ *
+ * or
+ *
+ *   - the GNU General Public License as published by the Free
+ *     Software Foundation; either version 2 of the License, or (at
+ *     your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * This file 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stringhelp.h"
+
+#include "t-support.h"
+
+static void
+test_map_static_macro_string (void)
+{
+  static struct {
+    const char *string;
+    const char *expected;
+    const char *lastresult;
+  } tests[] = {
+    { "@GPG@ (@GNUPG@)",
+      GPG_NAME " (" GNUPG_NAME ")" },
+    { "@GPG@(@GNUPG@)",
+      GPG_NAME "(" GNUPG_NAME ")" },
+    { "@GPG@@GNUPG@",
+      GPG_NAME  GNUPG_NAME },
+    { " @GPG@@GNUPG@",
+      " " GPG_NAME  GNUPG_NAME },
+    { " @GPG@@GNUPG@ ",
+      " " GPG_NAME  GNUPG_NAME " " },
+    { " @GPG at GNUPG@ ",
+      " " GPG_NAME "GNUPG@ " },
+    { " @ GPG at GNUPG@ ",
+      " @ GPG" GNUPG_NAME " " },
+    { "-- at GPGTAR@",
+      "--" GPGTAR_NAME }
+  };
+  int testno;
+  const char *result;
+
+  for (testno=0; testno < DIM(tests); testno++)
+    {
+      result = map_static_macro_string (tests[testno].string);
+      if (!result)
+        fail (testno);
+      if (strcmp (result, tests[testno].expected))
+        fail (testno);
+      if (!tests[testno].lastresult)
+        tests[testno].lastresult = result;
+    }
+
+  /* A second time to check that the same string is been returned.  */
+  for (testno=0; testno < DIM(tests); testno++)
+    {
+      result = map_static_macro_string (tests[testno].string);
+      if (!result)
+        fail (testno);
+      if (strcmp (result, tests[testno].expected))
+        fail (testno);
+      if (result != tests[testno].lastresult)
+        fail (testno);
+    }
+}
+
+
+int
+main (int argc, char **argv)
+{
+  (void)argc;
+  (void)argv;
+
+  test_map_static_macro_string ();
+
+  return 0;
+}
diff --git a/common/t-support.h b/common/t-support.h
index 8316909..0dfcc7a 100644
--- a/common/t-support.h
+++ b/common/t-support.h
@@ -44,6 +44,11 @@
 # define getenv(a)  (NULL)
 #endif
 
+#ifndef DIM
+# define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
+# define DIMof(type,member)   DIM(((type *)0)->member)
+#endif
+
 
 /* Replacement prototypes. */
 void *gcry_xmalloc (size_t n);

commit 556562086acd2bc2f8e3aa3126ebf155715e042b
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Feb 26 16:16:30 2014 +0100

    common: New function get_membuf_shrink.
    
    * common/membuf.c (get_membuf_shrink): New.

diff --git a/common/membuf.c b/common/membuf.c
index 02f1b27..884c08c 100644
--- a/common/membuf.c
+++ b/common/membuf.c
@@ -170,6 +170,31 @@ get_membuf (membuf_t *mb, size_t *len)
 }
 
 
+/* Same as get_membuf but shrinks the reallocated space to the
+   required size.  */
+void *
+get_membuf_shrink (membuf_t *mb, size_t *len)
+{
+  void *p, *pp;
+  size_t dummylen;
+
+  if (!len)
+    len = &dummylen;
+
+  p = get_membuf (mb, &len);
+  if (!p)
+    return NULL;
+  if (len)
+    {
+      pp = xtryrealloc (p, len);
+      if (pp)
+        p = pp;
+    }
+
+  return p;
+}
+
+
 /* Peek at the membuf MB.  On success a pointer to the buffer is
    returned which is valid until the next operation on MB.  If LEN is
    not NULL the current LEN of the buffer is stored there.  On error
diff --git a/common/membuf.h b/common/membuf.h
index bf4cf36..dfa236d 100644
--- a/common/membuf.h
+++ b/common/membuf.h
@@ -57,6 +57,7 @@ void put_membuf_str (membuf_t *mb, const char *string);
 void put_membuf_printf (membuf_t *mb, const char *format,
                         ...) JNLIB_GCC_A_PRINTF(2,3);
 void *get_membuf (membuf_t *mb, size_t *len);
+void *get_membuf_shrink (membuf_t *mb, size_t *len);
 const void *peek_membuf (membuf_t *mb, size_t *len);
 
 #endif /*GNUPG_COMMON_MEMBUF_H*/

commit 55c3e5f448c26360eda31e05b1f62249119f73d9
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Feb 19 11:03:31 2014 +0100

    agent: Fixed unresolved symbol under Windows.
    
    * agent/gpg-agent.c (main): s/ttyname/gnupg_ttyname/.
    --
    
    This was not triggered by the latest mingw runtime but that has other
    problems and thus I reverted to the same we used for gpg4win 2.1 which
    is Debian Wheezy.

diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 34f8ef3..c53566b 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -992,7 +992,7 @@ main (int argc, char **argv )
 
   /* Make sure that we have a default ttyname. */
   if (!default_ttyname && gnupg_ttyname (1))
-    default_ttyname = xstrdup (ttyname (1));
+    default_ttyname = xstrdup (gnupg_ttyname (1));
   if (!default_ttytype && getenv ("TERM"))
     default_ttytype = xstrdup (getenv ("TERM"));
 

commit 380a2aa18e0c048cfefa1cb4102dfbf902a1962b
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Feb 18 15:20:49 2014 +0100

    common: Require an installed libiconv.
    
    * common/utf8conv.c: Remove dynload.h.
    (load_libiconv): Remove.  Remove all calls to it.
    --
    
    The iconv functions are standard feature on most systems and in any
    case libiconv can be used to provide the functions.  The old code used
    to dlopen iconv.dll on Windows.  This goes back to GnuPG-1 which was
    designed as a one-binary program without any hard dependencies.
    GnuPG2 however demands a lot of libraries anyway and thus there is no
    more need for the fragile code to load a possible wrong version of
    iconv.dll at runtime.

diff --git a/common/utf8conv.c b/common/utf8conv.c
index a45bb63..fa08b04 100644
--- a/common/utf8conv.c
+++ b/common/utf8conv.c
@@ -38,13 +38,12 @@
 #include <langinfo.h>
 #endif
 #include <errno.h>
-#if !defined HAVE_W32_SYSTEM && !defined HAVE_ANDROID_SYSTEM
+#ifndef HAVE_ANDROID_SYSTEM
 # include <iconv.h>
 #endif
 
 #include "libjnlib-config.h"
 #include "stringhelp.h"
-#include "dynload.h"
 #include "utf8conv.h"
 
 #ifndef MB_LEN_MAX
@@ -53,7 +52,7 @@
 
 static const char *active_charset_name = "iso-8859-1";
 static int no_translation;     /* Set to true if we let simply pass through. */
-static int use_iconv;          /* iconv comversion fucntions required. */
+static int use_iconv;          /* iconv conversion functions required. */
 
 
 #ifdef HAVE_ANDROID_SYSTEM
@@ -87,70 +86,7 @@ iconv_close (iconv_t cd)
   (void)cd;
   return 0;
 }
-
-
-static int
-load_libiconv (void)
-{
-  return -1;
-}
-
-#elif defined HAVE_W32_SYSTEM
-/* Under W32 we dlopen the iconv dll and don't require any iconv
-   related headers at all.  However we need to define some stuff.  */
-typedef void *iconv_t;
-#ifndef ICONV_CONST
-#define ICONV_CONST
-#endif
-static iconv_t (* __stdcall iconv_open) (const char *tocode,
-                                         const char *fromcode);
-static size_t  (* __stdcall iconv) (iconv_t cd,
-                                    char **inbuf, size_t *inbytesleft,
-                                    char **outbuf, size_t *outbytesleft);
-static int     (* __stdcall iconv_close) (iconv_t cd);
-
-static int
-load_libiconv (void)
-{
-#ifdef HAVE_W32CE_SYSTEM
-  return -1; /* FIXME No libiconv yet - Need to investigate whether it
-                is at all required.  */
-#else
-  static int done;
-
-  if (!done)
-    {
-      void *handle;
-
-      done = 1; /* Do it right now because we might get called recursivly
-                   through gettext.  */
-
-      handle = dlopen ("iconv.dll", RTLD_LAZY);
-      if (handle)
-        {
-          iconv_open  = dlsym (handle, "libiconv_open");
-          if (iconv_open)
-            iconv = dlsym (handle, "libiconv");
-          if (iconv)
-            iconv_close = dlsym (handle, "libiconv_close");
-        }
-      if (!handle || !iconv_close)
-        {
-          log_info (_("error loading '%s': %s\n"),
-                     "iconv.dll",  dlerror ());
-          log_info (_("please see %s for more information\n"),
-                    "http://www.gnupg.org/download/iconv.html");
-          iconv_open = NULL;
-          iconv = NULL;
-          iconv_close = NULL;
-          if (handle)
-            dlclose (handle);
-        }
-    }
-  return iconv_open? 0: -1;
-#endif
-}
-#endif /*HAVE_W32_SYSTEM*/
+#endif /*HAVE_ANDROID_SYSTEM*/
 
 
 /* Error handler for iconv failures. This is needed to not clutter the
@@ -332,11 +268,6 @@ set_native_charset (const char *newset)
     {
       iconv_t cd;
 
-#if defined HAVE_W32_SYSTEM || defined HAVE_ANDROID_SYSTEM
-      if (load_libiconv ())
-        return -1;
-#endif /*HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM*/
-
       cd = iconv_open (full_newset, "utf-8");
       if (cd == (iconv_t)-1)
         {
@@ -758,11 +689,6 @@ utf8_to_native (const char *string, size_t length, int delim)
 jnlib_iconv_t
 jnlib_iconv_open (const char *tocode, const char *fromcode)
 {
-#if defined HAVE_W32_SYSTEM || defined HAVE_ANDROID_SYSTEM
-  if (load_libiconv ())
-    return (jnlib_iconv_t)(-1);
-#endif /*HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM*/
-
   return (jnlib_iconv_t)iconv_open (tocode, fromcode);
 }
 
@@ -774,12 +700,6 @@ jnlib_iconv (jnlib_iconv_t cd,
              const char **inbuf, size_t *inbytesleft,
              char **outbuf, size_t *outbytesleft)
 {
-
-#if defined HAVE_W32_SYSTEM || defined HAVE_ANDROID_SYSTEM
-  if (load_libiconv ())
-    return 0;
-#endif /*HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM*/
-
   return iconv ((iconv_t)cd, (char**)inbuf, inbytesleft, outbuf, outbytesleft);
 }
 
@@ -788,11 +708,6 @@ jnlib_iconv (jnlib_iconv_t cd,
 int
 jnlib_iconv_close (jnlib_iconv_t cd)
 {
-#if defined HAVE_W32_SYSTEM || defined HAVE_ANDROID_SYSTEM
-  if (load_libiconv ())
-    return 0;
-#endif /*HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM*/
-
   return iconv_close ((iconv_t)cd);
 }
 
@@ -867,4 +782,4 @@ utf8_to_wchar (const char *string)
     }
   return result;
 }
-#endif /*HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM*/
+#endif /*HAVE_W32_SYSTEM*/
diff --git a/configure.ac b/configure.ac
index 4abeeb0..dc4d1ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1168,6 +1168,7 @@ AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
 AM_ICONV
 
 
+
 #
 # Check for gettext
 #
@@ -1785,6 +1786,17 @@ if test "$have_npth" = "no"; then
 ***]])
 fi
 
+if test "$am_func_iconv" != yes; then
+    die=yes
+    AC_MSG_NOTICE([[
+***
+*** The system does not provide a working iconv function.  Please
+*** install a suitable library; for example GNU Libiconv which is
+*** available at:
+***   http://ftp.gnu.org/gnu/libiconv/
+***]])
+fi
+
 if test "$die" = "yes"; then
     AC_MSG_ERROR([[
 ***

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

Summary of changes:
 agent/gpg-agent.c     |    2 +-
 common/Makefile.am    |    6 +-
 common/argparse.c     |   76 ++--------------------
 common/mapstrings.c   |  167 +++++++++++++++++++++++++++++++++++++++++++++++++
 common/membuf.c       |   25 ++++++++
 common/membuf.h       |    1 +
 common/stringhelp.h   |    4 ++
 common/t-mapstrings.c |  101 ++++++++++++++++++++++++++++++
 common/t-support.h    |    5 ++
 common/utf8conv.c     |   93 ++-------------------------
 configure.ac          |   12 ++++
 11 files changed, 329 insertions(+), 163 deletions(-)
 create mode 100644 common/mapstrings.c
 create mode 100644 common/t-mapstrings.c


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list