Adjust libroot to invoke internal (__...) mbs-functions.
This commit is contained in:
parent
8703b5fdf5
commit
5de93d5b1f
@ -85,9 +85,9 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <errno_private.h>
|
||||
#include <wchar_private.h>
|
||||
|
||||
#ifndef __HAIKU__
|
||||
# include "collate.h"
|
||||
@ -200,7 +200,7 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *
|
||||
if (flags & GLOB_NOESCAPE) {
|
||||
memset(&mbs, 0, sizeof(mbs));
|
||||
while (bufend - bufnext >= MB_CUR_MAX) {
|
||||
clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
|
||||
clen = __mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
|
||||
if (clen == (size_t)-1 || clen == (size_t)-2)
|
||||
return (GLOB_NOMATCH);
|
||||
else if (clen == 0)
|
||||
@ -220,7 +220,7 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *
|
||||
prot = M_PROTECT;
|
||||
} else
|
||||
prot = 0;
|
||||
clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
|
||||
clen = __mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
|
||||
if (clen == (size_t)-1 || clen == (size_t)-2)
|
||||
return (GLOB_NOMATCH);
|
||||
else if (clen == 0)
|
||||
@ -662,7 +662,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
|
||||
dc = pathend;
|
||||
sc = dp->d_name;
|
||||
while (dc < pathend_last) {
|
||||
clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs);
|
||||
clen = __mbrtowc(&wc, sc, MB_LEN_MAX, &mbs);
|
||||
if (clen == (size_t)-1 || clen == (size_t)-2) {
|
||||
wc = *sc;
|
||||
clen = 1;
|
||||
@ -893,7 +893,7 @@ g_Ctoc(const Char *str, char *buf, size_t len)
|
||||
|
||||
memset(&mbs, 0, sizeof(mbs));
|
||||
while (len >= MB_CUR_MAX) {
|
||||
clen = wcrtomb(buf, *str, &mbs);
|
||||
clen = __wcrtomb(buf, *str, &mbs);
|
||||
if (clen == (size_t)-1)
|
||||
return (1);
|
||||
if (*str == L'\0')
|
||||
|
@ -30,9 +30,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <errno_private.h>
|
||||
#include <wchar_private.h>
|
||||
|
||||
|
||||
/*
|
||||
@ -68,13 +68,13 @@ wcsftime(wchar_t *wcs, size_t maxsize, const wchar_t *format,
|
||||
*/
|
||||
mbs = initial;
|
||||
formatp = format;
|
||||
sflen = wcsrtombs(NULL, &formatp, 0, &mbs);
|
||||
sflen = __wcsrtombs(NULL, &formatp, 0, &mbs);
|
||||
if (sflen == (size_t)-1)
|
||||
goto error;
|
||||
if ((sformat = malloc(sflen + 1)) == NULL)
|
||||
goto error;
|
||||
mbs = initial;
|
||||
wcsrtombs(sformat, &formatp, sflen + 1, &mbs);
|
||||
__wcsrtombs(sformat, &formatp, sflen + 1, &mbs);
|
||||
|
||||
/*
|
||||
* Allocate memory for longest multibyte sequence that will fit
|
||||
@ -93,7 +93,7 @@ wcsftime(wchar_t *wcs, size_t maxsize, const wchar_t *format,
|
||||
goto error;
|
||||
dstp = dst;
|
||||
mbs = initial;
|
||||
n = mbsrtowcs(wcs, &dstp, maxsize, &mbs);
|
||||
n = __mbsrtowcs(wcs, &dstp, maxsize, &mbs);
|
||||
if (n == (size_t)-2 || n == (size_t)-1 || dstp != NULL)
|
||||
goto error;
|
||||
|
||||
|
@ -20,7 +20,7 @@ __btowc(int c)
|
||||
return L'\0';
|
||||
|
||||
{
|
||||
int byteCount = mbrtowc(&wc, &character, 1, &internalMbState);
|
||||
int byteCount = __mbrtowc(&wc, &character, 1, &internalMbState);
|
||||
|
||||
if (byteCount != 1)
|
||||
return WEOF;
|
||||
|
@ -11,7 +11,7 @@ __mbstowcs(wchar_t* pwc, const char* s, size_t n)
|
||||
{
|
||||
static mbstate_t internalMbState;
|
||||
|
||||
return mbsrtowcs(pwc, &s, n, &internalMbState);
|
||||
return __mbsrtowcs(pwc, &s, n, &internalMbState);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ __mbtowc(wchar_t* pwc, const char* s, size_t n)
|
||||
{
|
||||
static mbstate_t internalMbState;
|
||||
|
||||
int result = mbrtowc(pwc, s, n, &internalMbState);
|
||||
int result = __mbrtowc(pwc, s, n, &internalMbState);
|
||||
if (result == -2) {
|
||||
__set_errno(EILSEQ);
|
||||
result = -1;
|
||||
|
@ -13,7 +13,7 @@ __wctob(wint_t c)
|
||||
{
|
||||
char internalBuffer[MB_LEN_MAX];
|
||||
|
||||
int32_t byteCount = wcrtomb(internalBuffer, c, NULL);
|
||||
int32_t byteCount = __wcrtomb(internalBuffer, c, NULL);
|
||||
if (byteCount != 1)
|
||||
return EOF;
|
||||
|
||||
|
@ -11,7 +11,7 @@ __wctomb(char* s, wchar_t wc)
|
||||
{
|
||||
static mbstate_t internalMbState;
|
||||
|
||||
return wcrtomb(s, wc, &internalMbState);
|
||||
return __wcrtomb(s, wc, &internalMbState);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user