Implementation of btowc.c and wctob.c is same for all CRTs except the
mbstate_t structure. Define __LARGE_MBSTATE_T for btowc.c and wctob.c in
the same way as it is used in mingw_pformat.c, mingw_sformat.c and
mingw_swformat.c files to make code compatible with all CRT libs.

This change allows to move btowc.c and wctob.c files back to libmingwex and
compile them only once, like it was before commit 9d00799905c3 ("crt:
always use replacements for btowc and wctob").
---
 mingw-w64-crt/Makefile.am       | 5 +----
 mingw-w64-crt/misc/btowc.c      | 3 +++
 mingw-w64-crt/misc/ucrt_btowc.c | 9 ---------
 mingw-w64-crt/misc/ucrt_wctob.c | 9 ---------
 mingw-w64-crt/misc/wctob.c      | 3 +++
 5 files changed, 7 insertions(+), 22 deletions(-)
 delete mode 100644 mingw-w64-crt/misc/ucrt_btowc.c
 delete mode 100644 mingw-w64-crt/misc/ucrt_wctob.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index afb8aa10ed73..d7e5867404ea 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -168,7 +168,6 @@ src_libws2_32=libsrc/ws2_32.c \
 # Files included in all libmsvcr*.a
 src_msvcrt_common=\
   misc/_onexit.c \
-  misc/btowc.c \
   misc/mbrlen.c \
   misc/mbrtowc.c \
   misc/mbsinit.c \
@@ -177,7 +176,6 @@ src_msvcrt_common=\
   misc/register_tls_atexit.c \
   misc/wcrtomb.c \
   misc/wcsrtombs.c \
-  misc/wctob.c \
   stdio/_getc_nolock.c \
   stdio/_getwc_nolock.c \
   stdio/_putc_nolock.c \
@@ -427,8 +425,6 @@ src_ucrtbase=\
   misc/_onexit.c \
   misc/output_format.c \
   misc/ucrt-access.c \
-  misc/ucrt_btowc.c \
-  misc/ucrt_wctob.c \
   stdio/ucrt___local_stdio_printf_options.c \
   stdio/ucrt___local_stdio_scanf_options.c \
   stdio/ucrt__scprintf.c \
@@ -1138,6 +1134,7 @@ src_libmingwex=\
   misc/wcstof.c \
   misc/wcstold.c \
   misc/wdirent.c         misc/winbs_uint64.c        misc/winbs_ulong.c      
misc/winbs_ushort.c    \
+  misc/btowc.c           misc/wctob.c \
   misc/wmemchr.c         misc/wmemcmp.c             misc/wmemcpy.c          
misc/wmemmove.c              misc/wmempcpy.c        \
   misc/wmemset.c         misc/mingw-access.c \
   misc/ftw32.c           misc/ftw32i64.c            misc/ftw64.c            
misc/ftw64i32.c \
diff --git a/mingw-w64-crt/misc/btowc.c b/mingw-w64-crt/misc/btowc.c
index 2029edc2c7f5..a707abcfae9d 100644
--- a/mingw-w64-crt/misc/btowc.c
+++ b/mingw-w64-crt/misc/btowc.c
@@ -3,6 +3,9 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
+
+#define __LARGE_MBSTATE_T
+
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
diff --git a/mingw-w64-crt/misc/ucrt_btowc.c b/mingw-w64-crt/misc/ucrt_btowc.c
deleted file mode 100644
index 2424f6e90f1d..000000000000
--- a/mingw-w64-crt/misc/ucrt_btowc.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-
-#undef __MSVCRT_VERSION__
-#define _UCRT
-#include "btowc.c"
diff --git a/mingw-w64-crt/misc/ucrt_wctob.c b/mingw-w64-crt/misc/ucrt_wctob.c
deleted file mode 100644
index 4e7a1ac9b7ba..000000000000
--- a/mingw-w64-crt/misc/ucrt_wctob.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-
-#undef __MSVCRT_VERSION__
-#define _UCRT
-#include "wctob.c"
diff --git a/mingw-w64-crt/misc/wctob.c b/mingw-w64-crt/misc/wctob.c
index 57f6170bbfd2..df209be03686 100644
--- a/mingw-w64-crt/misc/wctob.c
+++ b/mingw-w64-crt/misc/wctob.c
@@ -3,6 +3,9 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
+
+#define __LARGE_MBSTATE_T
+
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to