Subject: bad diagassert in UTF8 module
To: None <tech-userlevel@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-userlevel
Date: 03/11/2005 22:52:46
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi all,
the ei != NULL assertions in UTF8 are bogus, since
sizeof(UTF8EncodingInfo) == 0 and the encoding being state-indepent.
The attached patch removes that assertions, but I'm not 100% sure
if that is the solution.
Joerg
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="citrus_utf8.c.diff"
Index: citrus_utf8.c
===================================================================
RCS file: /home/joerg/wd/repository/netbsd/src/lib/libc/citrus/modules/citrus_utf8.c,v
retrieving revision 1.11
diff -u -r1.11 citrus_utf8.c
--- citrus_utf8.c 21 Dec 2004 11:25:43 -0000 1.11
+++ citrus_utf8.c 11 Mar 2005 21:41:22 -0000
@@ -200,7 +200,6 @@
int chlenbak;
_DIAGASSERT(nresult != 0);
- _DIAGASSERT(ei != NULL);
_DIAGASSERT(s != NULL);
_DIAGASSERT(psenc != NULL);
@@ -293,7 +292,6 @@
int cnt, i, ret;
wchar_t c;
- _DIAGASSERT(ei != NULL);
_DIAGASSERT(nresult != 0);
_DIAGASSERT(s != NULL);
@@ -370,8 +368,6 @@
_citrus_UTF8_encoding_module_init(_UTF8EncodingInfo * __restrict ei,
const void * __restrict var, size_t lenvar)
{
- _DIAGASSERT(ei != NULL);
-
_UTF8_init_count();
memset((void *)ei, 0, sizeof(*ei));
--zYM0uCDKw75PZbzx--