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.20 (requested by yam...



details:   https://anonhg.NetBSD.org/src/rev/24ee99f28fda
branches:  netbsd-1-6
changeset: 530248:24ee99f28fda
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 02 15:06:10 2003 +0000

description:
Pull up revision 1.20 (requested by yamt in ticket #1202):
- handle s==NULL case of wcrtomb.
- add a comment about it.
fix rest of PR 18269 by wurlitzer.

diffstat:

 lib/libc/citrus/citrus_ctype_template.h |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r 00b3df6b29fd -r 24ee99f28fda lib/libc/citrus/citrus_ctype_template.h
--- a/lib/libc/citrus/citrus_ctype_template.h   Mon Jun 02 15:04:57 2003 +0000
+++ b/lib/libc/citrus/citrus_ctype_template.h   Mon Jun 02 15:06:10 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_ctype_template.h,v 1.13.2.6 2003/06/02 15:04:57 tron Exp $      */
+/*     $NetBSD: citrus_ctype_template.h,v 1.13.2.7 2003/06/02 15:06:10 tron Exp $      */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -163,6 +163,8 @@
  *   - additional 6th parameter is the storage to be stored
  *     the return value in the real mbrtowc context.
  *   - return value means "errno" in the real wcrtomb context.
+ *   - caller should ensure that 2nd parameter isn't NULL.
+ *     (XXX inconsist with mbrtowc_priv)
  */
 
 static int _FUNCNAME(wcrtomb_priv)(_ENCODING_INFO * __restrict,
@@ -566,10 +568,19 @@
                         void * __restrict pspriv, size_t * __restrict nresult)
 {
        _ENCODING_STATE *psenc;
+       char buf[MB_LEN_MAX];
        int err = 0;
 
        _DIAGASSERT(cl != NULL);
 
+       if (s == NULL) {
+               /*
+                * use internal buffer.
+                */
+               s = buf;
+               wc = L'\0'; /* SUSv3 */
+       }
+
        _RESTART_BEGIN(wcrtomb, _TO_CEI(cl), pspriv, psenc);
        err = _FUNCNAME(wcrtomb_priv)(_CEI_TO_EI(_TO_CEI(cl)), s,
                            _ENCODING_MB_CUR_MAX(_CEI_TO_EI(_TO_CEI(cl))),



Home | Main Index | Thread Index | Old Index