summaryrefslogtreecommitdiff
path: root/examples/c
diff options
context:
space:
mode:
authorDon Anderson <dda@mongodb.com>2016-06-21 21:05:33 -0400
committerGitHub <noreply@github.com>2016-06-21 21:05:33 -0400
commitf782f62e9078fe158367f8e4c7f35a727c817bea (patch)
tree1b6acc12b264da7e28ffdc6c99b1d713112c6cad /examples/c
parent64fd6a0180704843febd5a46157d2b50eb80b0a2 (diff)
downloadmongo-f782f62e9078fe158367f8e4c7f35a727c817bea.tar.gz
WT-2691 Use wrappers for ctype functions to avoid sign extension errors (#2818)
* Cast arguments for ctype functions to avoid sign extension errors. Create __wt_* versions of all ctype functions, and use them whenever wt_internal.h is available. Add check to prevent direct use of ctype functions from core source. * Change wrappers to use u_char arguments, and return bool. Remove unused wrappers. * Use u_char in preference to unsigned char. * Examples do not have u_char defined on Windows.
Diffstat (limited to 'examples/c')
-rw-r--r--examples/c/ex_encrypt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/c/ex_encrypt.c b/examples/c/ex_encrypt.c
index a919148aff0..3b3323bc091 100644
--- a/examples/c/ex_encrypt.c
+++ b/examples/c/ex_encrypt.c
@@ -122,8 +122,8 @@ do_rotate(char *buf, size_t len, int rotn)
* Now rotate
*/
for (i = 0; i < len; i++)
- if (isalpha(buf[i])) {
- if (islower(buf[i]))
+ if (isalpha((unsigned char)buf[i])) {
+ if (islower((unsigned char)buf[i]))
buf[i] = ((buf[i] - 'a') + rotn) % 26 + 'a';
else
buf[i] = ((buf[i] - 'A') + rotn) % 26 + 'A';