Don't sign extend characters when they get converted to wide characters in

mbtowc. Otherwise you are not going to be able to wctomb them. Added
regression test. From kim, many thanks.
This commit is contained in:
christos 2005-03-27 18:51:19 +00:00
parent 16339a29a1
commit bc0c808b3b
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: citrus_none.c,v 1.12 2004/01/18 03:57:30 yamt Exp $ */
/* $NetBSD: citrus_none.c,v 1.13 2005/03/27 18:51:19 christos Exp $ */
/*-
* Copyright (c)2002 Citrus Project,
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: citrus_none.c,v 1.12 2004/01/18 03:57:30 yamt Exp $");
__RCSID("$NetBSD: citrus_none.c,v 1.13 2005/03/27 18:51:19 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
@ -216,7 +216,7 @@ _citrus_NONE_ctype_mbtowc(void * __restrict cl, wchar_t * __restrict pwc,
return (0);
}
*pwc = (wchar_t)*s;
*pwc = (wchar_t)(unsigned char)*s;
*nresult = *s == '\0' ? 0 : 1;
return (0);