From 84dc917720ff12a741bf87824bef1e6c31c9e1f2 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 7 Jul 2015 02:49:51 +0200 Subject: Link statically against musl --- fgetwc_fix.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 fgetwc_fix.c (limited to 'fgetwc_fix.c') diff --git a/fgetwc_fix.c b/fgetwc_fix.c deleted file mode 100644 index 76cf52b..0000000 --- a/fgetwc_fix.c +++ /dev/null @@ -1,35 +0,0 @@ - -/* This file contains a fixed implementation of fgetwc since glibc's one is a little segfaulty when used on fmemopen'ed files. */ - -#include -#include -#include -#include -#include - -#include "fgetwc_fix.h" - -/* code blatantly ripped from newlib. If you are from newlib: newlib rocks, keep going! */ -wint_t _fgetwc_fixed(FILE *fp) { - wchar_t wc; - size_t res; - size_t nconv = 0; - char buf[MB_CUR_MAX]; - mbstate_t mbstate; - memset(&mbstate, 0, sizeof(mbstate)); - - while((buf[nconv++] = fgetc(fp)) != EOF){ - res = mbrtowc(&wc, buf, nconv, &mbstate); - if (res == (size_t)-1) /* invalid sequence */ - break; - else if (res == (size_t)-2) /* incomplete sequence */ - continue; - else if (res == 0) - return L'\0'; - else - return wc; - } - - errno = EILSEQ; - return WEOF; -} -- cgit