summaryrefslogtreecommitdiffstats
path: root/byte.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:29 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:29 -0800
commit302e3218b7d487539ec305bf23881a6ee7d5be99 (patch)
treebf1adafe552a17b3b78522048bb7c24787696dd3 /byte.c
parentc7d035ae1a729232579a0fe41ed5affa131d3623 (diff)
downloadscm-302e3218b7d487539ec305bf23881a6ee7d5be99.tar.gz
scm-302e3218b7d487539ec305bf23881a6ee7d5be99.zip
Import Upstream version 5e1upstream/5e1
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;