summaryrefslogtreecommitdiffstats
path: root/byte.c
diff options
context:
space:
mode:
Diffstat (limited to 'byte.c')
-rw-r--r--byte.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/byte.c b/byte.c
index 1ef014f..457d878 100644
--- a/byte.c
+++ b/byte.c
@@ -119,7 +119,7 @@ SCM scm_bytes_reverse(str)
ASRTER(NIMP(str) && STRINGP(str), str, ARG1, s_bt_reverse);
len = LENGTH(str);
dst = CHARS(str);
- for(k = len/2;k >= 0;k--) {
+ for(k = (len - 1)/2;k >= 0;k--) {
int tmp = dst[k];
dst[k] = dst[len - k - 1];
dst[len - k - 1] = tmp;
@@ -187,7 +187,7 @@ SCM scm_substring_read(sstr, start, args)
}
else {
long idx = start;
- while (end <= idx) {
+ while (end < idx) {
int chr = lgetc(port);
if (EOF==chr) return MAKINUM(start - idx);
CHARS(sstr)[--idx] = chr;