aboutsummaryrefslogtreecommitdiffstats
path: root/src/init.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2024-08-02 07:42:57 +0000
committerWerner Koch <[email protected]>2024-08-02 07:42:57 +0000
commit7f36440d90964ffe809064365cb16033ba1dda69 (patch)
tree81484b41aa661c378560c6606d19a420e8438d52 /src/init.c
parentUpdate version date of autogen.sh (diff)
downloadlibgpg-error-7f36440d90964ffe809064365cb16033ba1dda69.tar.gz
libgpg-error-7f36440d90964ffe809064365cb16033ba1dda69.zip
w32: Allow initialization of new threads to utf8 mode.
* src/init.c (utf8_for_new_threads): New var. (_gpgrt_w32_utf8_for_new_threads): New func. (get_tls): Init the TLS utf8 flag from the new var. * src/w32-gettext.c (_gpg_w32_gettext_use_utf8): Implement new flag. -- GnuPG-bug-id: 7185
Diffstat (limited to '')
-rw-r--r--src/init.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/init.c b/src/init.c
index c4b7e56..8a5e651 100644
--- a/src/init.c
+++ b/src/init.c
@@ -39,6 +39,8 @@
static int tls_index = TLS_OUT_OF_INDEXES; /* Index for the TLS functions. */
+static volatile int utf8_for_new_threads;
+
static char *get_locale_dir (void);
static void drop_locale_dir (char *locale_dir);
@@ -549,6 +551,14 @@ _gpgrt_internal_trace_end (void)
******** Below is only Windows code. ****
*****************************************/
+/* This function can be called to force utf8 for new threads. */
+void
+_gpgrt_w32_utf8_for_new_threads (void)
+{
+ utf8_for_new_threads = 1;
+}
+
+
static char *
get_locale_dir (void)
{
@@ -645,7 +655,7 @@ get_tls (void)
/* No way to continue - commit suicide. */
_gpgrt_abort ();
}
- tls->gt_use_utf8 = 0;
+ tls->gt_use_utf8 = utf8_for_new_threads;
TlsSetValue (tls_index, tls);
}
@@ -677,7 +687,7 @@ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
tls = LocalAlloc (LPTR, sizeof *tls);
if (!tls)
return FALSE;
- tls->gt_use_utf8 = 0;
+ tls->gt_use_utf8 = utf8_for_new_threads;
TlsSetValue (tls_index, tls);
if (reason == DLL_PROCESS_ATTACH)
{