Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/lib/libc/citrus Pull up revision 1.16 (requested by yam...



details:   https://anonhg.NetBSD.org/src/rev/7ad04448c8ee
branches:  netbsd-1-6
changeset: 530243:7ad04448c8ee
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 02 15:00:28 2003 +0000

description:
Pull up revision 1.16 (requested by yamt in ticket #1202):
when s==0, wctomb should initialize its internal state and return if
encodings have state dependency or not.
a patch provided with PR 18269 by wurlitzer.
modified by me.
fix part of PR 18269.

diffstat:

 lib/libc/citrus/citrus_ctype_template.h |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 9db79a9dae8e -r 7ad04448c8ee lib/libc/citrus/citrus_ctype_template.h
--- a/lib/libc/citrus/citrus_ctype_template.h   Mon Jun 02 14:59:39 2003 +0000
+++ b/lib/libc/citrus/citrus_ctype_template.h   Mon Jun 02 15:00:28 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_ctype_template.h,v 1.13.2.2 2003/06/02 14:59:39 tron Exp $      */
+/*     $NetBSD: citrus_ctype_template.h,v 1.13.2.3 2003/06/02 15:00:28 tron Exp $      */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -602,18 +602,22 @@
 _FUNCNAME(ctype_wctomb)(void * __restrict cl, char * __restrict s, wchar_t wc,
                        int * __restrict nresult)
 {
+       _ENCODING_STATE *psenc;
        size_t nr;
        int err = 0;
-       char s0[MB_LEN_MAX];
 
        _DIAGASSERT(cl != NULL);
 
-       if (s==NULL)
-               s = s0;
+       psenc = &_CEI_TO_STATE(_TO_CEI(cl), wctomb);
+       if (s == NULL) {
+               _FUNCNAME(init_state)(_CEI_TO_EI(_TO_CEI(cl)), psenc);
+               *nresult = _ENCODING_IS_STATE_DEPENDENT;
+               return 0;
+       }
 
        err = _FUNCNAME(wcrtomb_priv)(cl, s,
                      _ENCODING_MB_CUR_MAX(_CEI_TO_EI(_TO_CEI(cl))),
-                     wc, &_CEI_TO_STATE(_TO_CEI(cl), wctomb), &nr);
+                     wc, psenc, &nr);
        *nresult = (int)nr;
 
        return 0;



Home | Main Index | Thread Index | Old Index