aboutsummaryrefslogtreecommitdiffstats
path: root/stptolower.c
diff options
context:
space:
mode:
Diffstat (limited to 'stptolower.c')
-rw-r--r--stptolower.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/stptolower.c b/stptolower.c
index 61108ad..db63bf0 100644
--- a/stptolower.c
+++ b/stptolower.c
@@ -1,5 +1,5 @@
/* See LICENSE file for copyright and license details. */
-#include "libsimple.h"
+#include "common.h"
#ifndef TEST
@@ -10,18 +10,18 @@ libsimple_stptolower(char *d, const char *s)
char *ret;
if (d == s) {
for (; *d; d++)
- *d = tolower(*d);
+ *d = (char)tolower(*d);
return d;
} else if (d < s) {
for (; *s; d++, s++)
- *d = tolower(*s);
+ *d = (char)tolower(*s);
*d = '\0';
return d;
} else {
for (n = 0; s[n]; n++);
ret = &d[n];
do {
- d[n] = tolower(s[n]);
+ d[n] = (char)tolower(s[n]);
} while (n--);
return ret;
}
@@ -45,15 +45,6 @@ main(void)
stpcpy(buf, "ABCDEabcde12345");
assert(!strcmpnul(libsimple_stptolower(&buf[0], &buf[0]), ""));
assert(!strcmp(buf, "abcdeabcde12345"));
- stpcpy(buf, "ABCDEabcde12345");
- assert(!strcmpnul(libsimple_strtolower(&buf[3], &buf[0]), "abcdeabcde12345"));
- assert(!strcmp(buf, "ABCabcdeabcde12345"));
- stpcpy(buf, "ABCDEabcde12345");
- assert(!strcmpnul(libsimple_strtolower(&buf[0], &buf[3]), "deabcde12345"));
- assert(!strcmp(buf, "deabcde12345"));
- stpcpy(buf, "ABCDEabcde12345");
- assert(!strcmpnul(libsimple_strtolower(&buf[0], &buf[0]), "abcdeabcde12345"));
- assert(!strcmp(buf, "abcdeabcde12345"));
return 0;
}