diff options
Diffstat (limited to 'byte.c')
-rw-r--r-- | byte.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |