]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/fgetws.c.patch
Libc-825.24.tar.gz
[apple/libc.git] / stdio / FreeBSD / fgetws.c.patch
diff --git a/stdio/FreeBSD/fgetws.c.patch b/stdio/FreeBSD/fgetws.c.patch
deleted file mode 100644 (file)
index b16f5a7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
---- fgetws.c.bsdnew    2009-11-30 16:15:32.000000000 -0800
-+++ fgetws.c   2009-11-30 16:15:32.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetws.c,v 1.8 2009/11/25 04:45:45 wollman Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <stdio.h>
-@@ -38,13 +40,18 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- #include "mblocal.h"
- wchar_t *
--fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
-+fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t loc)
- {
-       wchar_t *wsp;
-       size_t nconv;
-       const char *src;
-       unsigned char *nl;
-+      struct __xlocale_st_runelocale *rl;
-+      size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, size_t, size_t, __darwin_mbstate_t * __restrict, locale_t);
-+      NORMALIZE_LOCALE(loc);
-+      rl = loc->__lc_ctype;
-+      __mbsnrtowcs = rl->__mbsnrtowcs;
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-@@ -58,11 +65,11 @@ fgetws(wchar_t * __restrict ws, int n, F
-               goto error;
-       wsp = ws;
-       do {
--              src = fp->_p;
-+              src = (const char *)fp->_p;
-               nl = memchr(fp->_p, '\n', fp->_r);
-               nconv = __mbsnrtowcs(wsp, &src,
-                   nl != NULL ? (nl - fp->_p + 1) : fp->_r,
--                  n - 1, &fp->_mbstate);
-+                  n - 1, &fp->_mbstate, loc);
-               if (nconv == (size_t)-1)
-                       /* Conversion error */
-                       goto error;
-@@ -86,7 +93,7 @@ fgetws(wchar_t * __restrict ws, int n, F
-       if (wsp == ws)
-               /* EOF */
-               goto error;
--      if (!__mbsinit(&fp->_mbstate))
-+      if (!rl->__mbsinit(&fp->_mbstate, loc))
-               /* Incomplete character */
-               goto error;
-       *wsp = L'\0';
-@@ -98,3 +105,9 @@ error:
-       FUNLOCKFILE(fp);
-       return (NULL);
- }
-+
-+wchar_t *
-+fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
-+{
-+      return fgetws_l(ws, n, fp, __current_locale());
-+}