[PATCH 1/2] fix conflicting types (wint_t)

[email protected]
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
From: uchan-nos <[email protected]>

---
 newlib/libc/include/wchar.h  |  6 +++++-
 newlib/libc/string/wcwidth.c | 10 ++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index c04a6510e..a68cf5be6 100644
--- a/newlib/libc/include/wchar.h
+++ b/newlib/libc/include/wchar.h
@@ -179,8 +179,12 @@ extern size_t wcsxfrm_l (wchar_t *__restrict, const wchar_t *__restrict, size_t,
 #endif
 
 #if __XSI_VISIBLE
+# ifdef __CYGWIN__
+int	wcwidth (const wint_t);
+# else
 int	wcwidth (const wchar_t);
-#endif
+# endif
+#endif // __XSI_VISIBLE
 wchar_t	*wmemchr (const wchar_t *, wchar_t, size_t);
 int	wmemcmp (const wchar_t *, const wchar_t *, size_t);
 wchar_t	*wmemcpy (wchar_t *__restrict, const wchar_t *__restrict,
diff --git a/newlib/libc/string/wcwidth.c b/newlib/libc/string/wcwidth.c
index 62e76edc3..a4b520bbe 100644
--- a/newlib/libc/string/wcwidth.c
+++ b/newlib/libc/string/wcwidth.c
@@ -225,10 +225,16 @@ __wcwidth (const wint_t ucs)
 #endif /* _MB_CAPABLE */
 }
 
+#ifdef __CYGWIN__
+#define WCHAR_TYPE wint_t
+#else
+#define WCHAR_TYPE wchar_t
+#endif
+
 int
-wcwidth (const wint_t wc)
+wcwidth (const WCHAR_TYPE wc)
 {
-  wint_t wi = wc;
+  WCHAR_TYPE wi = wc;
 
 #ifdef _MB_CAPABLE
   wi = _jp2uc (wi);
-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.