diff options
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | configure.ac | 1 | ||||
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/engine-assuan.c | 8 | ||||
| -rw-r--r-- | src/engine-g13.c | 8 | ||||
| -rw-r--r-- | src/engine-gpg.c | 8 | ||||
| -rw-r--r-- | src/engine-gpgconf.c | 1 | ||||
| -rw-r--r-- | src/engine-gpgsm.c | 8 | ||||
| -rw-r--r-- | src/gpgme-tool.c | 5 | ||||
| -rw-r--r-- | src/gpgme.c | 6 | ||||
| -rw-r--r-- | src/op-support.c | 5 | 
11 files changed, 55 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2010-05-07  Marcus Brinkmann  <[email protected]> + +	* configure.ac: Check for locale.h. +  2010-05-06  Marcus Brinkmann  <[email protected]>  	* configure.ac: Detect Windows CE. diff --git a/configure.ac b/configure.ac index c0bcac1c..6ac1a5ea 100644 --- a/configure.ac +++ b/configure.ac @@ -203,6 +203,7 @@ AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")  # Checks for header files. +AC_CHECK_HEADERS([locale.h])  AC_CHECK_HEADERS(sys/select.h)  AC_CHECK_HEADERS([sys/uio.h]) diff --git a/src/ChangeLog b/src/ChangeLog index a2835016..4f1ca96e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@  2010-05-07  Marcus Brinkmann  <[email protected]> +	* engine-g13.c, gpgme.c, engine-gpgsm.c, engine-gpg.c, +	op-support.c, engine-assuan.c, gpgme-tool.c: Include <locale.h> +	only if available with HAVE_LOCALE_H and conditionalize use of +	LC_CTYPE on its definition. +	* engine-gpgconf.c: Do not include <locale.h>. +  	* engine-gpgsm.c (gpgsm_new, start): Cast between int and  	assuan_fd_t.  	* assuan-support.c (my_pipe, my_close, my_read, my_write): Likewise. diff --git a/src/engine-assuan.c b/src/engine-assuan.c index d8d30866..73ece80d 100644 --- a/src/engine-assuan.c +++ b/src/engine-assuan.c @@ -33,7 +33,9 @@  #include <sys/types.h>  #include <assert.h>  #include <unistd.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #include <errno.h>  #include "gpgme.h" @@ -358,7 +360,10 @@ llass_set_locale (void *engine, int category, const char *value)    /* FIXME: If value is NULL, we need to reset the option to default.       But we can't do this.  So we error out here.  gpg-agent needs       support for this.  */ -  if (category == LC_CTYPE) +  if (0) +    ; +#ifdef LC_CTYPE +  else if (category == LC_CTYPE)      {        catstr = "lc-ctype";        if (!value && llass->lc_ctype_set) @@ -366,6 +371,7 @@ llass_set_locale (void *engine, int category, const char *value)        if (value)  	llass->lc_ctype_set = 1;      } +#endif  #ifdef LC_MESSAGES    else if (category == LC_MESSAGES)      { diff --git a/src/engine-g13.c b/src/engine-g13.c index 208fb35c..8b2af4d7 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -28,7 +28,9 @@  #include <sys/types.h>  #include <assert.h>  #include <unistd.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #include <fcntl.h> /* FIXME */  #include <errno.h> @@ -354,7 +356,10 @@ g13_set_locale (void *engine, int category, const char *value)    /* FIXME: If value is NULL, we need to reset the option to default.       But we can't do this.  So we error out here.  G13 needs support       for this.  */ -  if (category == LC_CTYPE) +  if (0) +    ; +#ifdef LC_CTYPE +  else if (category == LC_CTYPE)      {        catstr = "lc-ctype";        if (!value && g13->lc_ctype_set) @@ -362,6 +367,7 @@ g13_set_locale (void *engine, int category, const char *value)        if (value)  	g13->lc_ctype_set = 1;      } +#endif  #ifdef LC_MESSAGES    else if (category == LC_MESSAGES)      { diff --git a/src/engine-gpg.c b/src/engine-gpg.c index a05fca28..da66d4d7 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -28,7 +28,9 @@  #include <assert.h>  #include <errno.h>  #include <unistd.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #include "gpgme.h"  #include "util.h" @@ -563,7 +565,10 @@ gpg_set_locale (void *engine, int category, const char *value)  {    engine_gpg_t gpg = engine; -  if (category == LC_CTYPE) +  if (0) +    ; +#ifdef LC_CTYPE +  else if (category == LC_CTYPE)      {        if (gpg->lc_ctype)          { @@ -577,6 +582,7 @@ gpg_set_locale (void *engine, int category, const char *value)  	    return gpg_error_from_syserror ();  	}      } +#endif  #ifdef LC_MESSAGES    else if (category == LC_MESSAGES)      { diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 6448b066..d3c47a75 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -27,7 +27,6 @@  #include <sys/types.h>  #include <assert.h>  #include <unistd.h> -#include <locale.h>  #include <fcntl.h> /* FIXME */  #include <errno.h> diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index fce46599..64189bf8 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -29,7 +29,9 @@  #include <sys/types.h>  #include <assert.h>  #include <unistd.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #include <fcntl.h> /* FIXME */  #include <errno.h> @@ -507,7 +509,10 @@ gpgsm_set_locale (void *engine, int category, const char *value)    /* FIXME: If value is NULL, we need to reset the option to default.       But we can't do this.  So we error out here.  GPGSM needs support       for this.  */ -  if (category == LC_CTYPE) +  if (0) +    ; +#ifdef LC_CTYPE +  else if (category == LC_CTYPE)      {        catstr = "lc-ctype";        if (!value && gpgsm->lc_ctype_set) @@ -515,6 +520,7 @@ gpgsm_set_locale (void *engine, int category, const char *value)        if (value)  	gpgsm->lc_ctype_set = 1;      } +#endif  #ifdef LC_MESSAGES    else if (category == LC_MESSAGES)      { diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 63df70d1..f102979d 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -28,7 +28,9 @@  #include <getopt.h>  #include <ctype.h>  #include <stdarg.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #ifdef HAVE_ARGP_H  #include <argp.h>  #endif @@ -2908,10 +2910,13 @@ main (int argc, char *argv[])    setlocale (LC_ALL, "");    gpgme_check_version (NULL); +#ifdef LC_CTYPE    gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); +#endif  #ifdef LC_MESSAGES    gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));  #endif +    args_init (&args);    argp_parse (&argp, argc, argv, 0, 0, &args); diff --git a/src/gpgme.c b/src/gpgme.c index fe601a09..b6a518ff 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -27,7 +27,9 @@  #include <string.h>  #include <assert.h>  #include <errno.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #include "util.h"  #include "context.h" @@ -600,7 +602,9 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)          failed = 1;						\      } +#ifdef LC_CTYPE    PREPARE_ONE_LOCALE (ctype, CTYPE); +#endif  #ifdef LC_MESSAGES    PREPARE_ONE_LOCALE (messages, MESSAGES);  #endif @@ -636,7 +640,9 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)    if (!ctx)      LOCK (def_lc_lock); +#ifdef LC_CTYPE    SET_ONE_LOCALE (ctype, CTYPE); +#endif  #ifdef LC_MESSAGES    SET_ONE_LOCALE (messages, MESSAGES);  #endif diff --git a/src/op-support.c b/src/op-support.c index 67385360..66e6849f 100644 --- a/src/op-support.c +++ b/src/op-support.c @@ -23,7 +23,9 @@  #include <stdlib.h>  #include <errno.h>  #include <string.h> +#ifdef HAVE_LOCALE_H  #include <locale.h> +#endif  #include "gpgme.h"  #include "context.h" @@ -114,7 +116,10 @@ _gpgme_op_reset (gpgme_ctx_t ctx, int type)    if (!reuse_engine)      { +      err = 0; +#ifdef LC_CTYPE        err = _gpgme_engine_set_locale (ctx->engine, LC_CTYPE, ctx->lc_ctype); +#endif  #ifdef LC_MESSAGES        if (!err)          err = _gpgme_engine_set_locale (ctx->engine,  | 
