summaryrefslogtreecommitdiff
path: root/test/test_add_wchstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_add_wchstr.c')
-rw-r--r--test/test_add_wchstr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/test_add_wchstr.c b/test/test_add_wchstr.c
index e2c8b66..b1d320b 100644
--- a/test/test_add_wchstr.c
+++ b/test/test_add_wchstr.c
@@ -1,6 +1,6 @@
/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
- * Copyright 2009-2016,2017 Free Software Foundation, Inc. *
+ * Copyright 2020,2021 Thomas E. Dickey *
+ * Copyright 2009-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -27,7 +27,7 @@
* authorization. *
****************************************************************************/
/*
- * $Id: test_add_wchstr.c,v 1.27 2020/02/02 23:34:34 tom Exp $
+ * $Id: test_add_wchstr.c,v 1.29 2021/05/08 20:04:10 tom Exp $
*
* Demonstrate the waddwchstr() and wadd_wch functions.
* Thomas Dickey - 2009/9/12
@@ -132,10 +132,11 @@ ChWLen(const wchar_t *source)
if (!pass_ctls) {
size_t adjust = 0;
size_t n;
- const char *s;
- for (n = 0; n < result; ++n) {
- if (source[n] < 256 && (s = unctrl((chtype) source[n])) != 0) {
+ for (n = 0; source[n] != 0; ++n) {
+ const char *s;
+
+ if ((source[n] < 256) && (s = unctrl((chtype) source[n])) != 0) {
adjust += (strlen(s) - 1);
}
}