From 54a18fa1d63375b790f3bf3157f6b64b294e5d16 Mon Sep 17 00:00:00 2001 From: tjr Date: Wed, 7 Apr 2004 10:48:19 +0000 Subject: Allow partial multibyte characters to accumulate in conversion state objects passed to mbrtowc(), mbsrtowcs(), and mbrlen(), as required by C99. --- lib/libc/locale/none.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/libc/locale/none.c') diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c index 3c4d8c7..a94d040 100644 --- a/lib/libc/locale/none.c +++ b/lib/libc/locale/none.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002, 2003 Tim J. Robbins. All rights reserved. + * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved. * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * @@ -51,11 +51,13 @@ __FBSDID("$FreeBSD$"); extern size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); +extern int (*__mbsinit)(const mbstate_t *); extern size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict); int _none_init(_RuneLocale *); size_t _none_mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); +int _none_mbsinit(const mbstate_t *); size_t _none_wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); int @@ -63,12 +65,24 @@ _none_init(_RuneLocale *rl) { __mbrtowc = _none_mbrtowc; + __mbsinit = _none_mbsinit; __wcrtomb = _none_wcrtomb; _CurrentRuneLocale = rl; __mb_cur_max = 1; return(0); } +int +_none_mbsinit(const mbstate_t *ps __unused) +{ + + /* + * Encoding is not state dependent - we are always in the + * initial state. + */ + return (1); +} + size_t _none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, mbstate_t * __restrict ps __unused) -- cgit v1.1