summaryrefslogtreecommitdiffstats
path: root/tools/regression/lib/libc/locale/test-mblen.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-04-07 11:02:51 +0000
committertjr <tjr@FreeBSD.org>2004-04-07 11:02:51 +0000
commit04a9ef8e3fbaa5f28645a078a28882fab78528ff (patch)
tree67e8c26b7cb1d7d95825c7226845c70b275f8d91 /tools/regression/lib/libc/locale/test-mblen.c
parent54a18fa1d63375b790f3bf3157f6b64b294e5d16 (diff)
downloadFreeBSD-src-04a9ef8e3fbaa5f28645a078a28882fab78528ff.zip
FreeBSD-src-04a9ef8e3fbaa5f28645a078a28882fab78528ff.tar.gz
Reset internal conversion state after triggering conversion errors;
the state is undefined according to the standards, and our undefined behaviour has changed.
Diffstat (limited to 'tools/regression/lib/libc/locale/test-mblen.c')
-rw-r--r--tools/regression/lib/libc/locale/test-mblen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/regression/lib/libc/locale/test-mblen.c b/tools/regression/lib/libc/locale/test-mblen.c
index 9975e3d..236cbc7 100644
--- a/tools/regression/lib/libc/locale/test-mblen.c
+++ b/tools/regression/lib/libc/locale/test-mblen.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002 Tim J. Robbins
+ * Copyright (c) 2002-2004 Tim J. Robbins
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -69,6 +69,7 @@ main(int argc, char *argv[])
/* Incomplete character sequence. */
buf[0] = '\0';
assert(mblen(buf, 0) == -1);
+ assert(mblen(NULL, 0) == 0);
/*
* Japanese (EUC) locale.
@@ -92,12 +93,14 @@ main(int argc, char *argv[])
/* Incomplete character sequence. */
buf[0] = '\0';
assert(mblen(buf, 0) == -1);
+ assert(mblen(NULL, 0) == 0);
/* Incomplete character sequence (truncated double-byte). */
memset(buf, 0xcc, sizeof(buf));
buf[0] = 0xa3;
buf[1] = 0x00;
assert(mblen(buf, 1) == -1);
+ assert(mblen(NULL, 0) == 0);
/* Same as above, but complete. */
buf[1] = 0xc1;
OpenPOWER on IntegriCloud