>From 63ef97fabd1e5f3a908195748935a1ed69fc46bf Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 28 Jun 2012 10:46:03 -0300 Subject: [PATCH] Avoid using / in xsubstring and string-xcopy!, since srfi-13 is compiled with (declare (fixnum)) This patch fixes #869 --- srfi-13.scm | 26 +++++++++++++++++++------- 1 files changed, 19 insertions(+), 7 deletions(-) diff --git a/srfi-13.scm b/srfi-13.scm index e4a0509..3dbc2ca 100644 --- a/srfi-13.scm +++ b/srfi-13.scm @@ -1766,10 +1766,16 @@ ((= 1 slen) ; Fast path for 1-char replication. (make-string anslen (string-ref s start))) + ;; CHICKEN compiles this file with (declare (fixnum)), so + ;; flonum operations are not reliable. Since this clause + ;; just provides a shorter path to avoid calling + ;; %multispan-repcopy!, we comment it out and leave the + ;; fixnum declaration. + ;; ;; Selected text falls entirely within one span. - ((= (floor (/ from slen)) (floor (/ to slen))) - (##sys#substring s (+ start (modulo from slen)) - (+ start (modulo to slen)))) + ;; ((= (floor (/ from slen)) (floor (/ to slen))) + ;; (##sys#substring s (+ start (modulo from slen)) + ;; (+ start (modulo to slen)))) ;; Selected text requires multiple spans. (else (let ((ans (make-string anslen))) @@ -1813,11 +1819,17 @@ ((= 1 slen) ; Fast path for 1-char replication. (##srfi13#string-fill! target (string-ref s start) tstart tend)) + ;; CHICKEN compiles this file with (declare (fixnum)), so + ;; flonum operations are not reliable. Since this clause + ;; just provides a shorter path to avoid calling + ;; %multispan-repcopy!, we comment it out and leave the + ;; fixnum declaration. + ;; ;; Selected text falls entirely within one span. - ((= (floor (/ sfrom slen)) (floor (/ sto slen))) - (%string-copy! target tstart s - (+ start (modulo sfrom slen)) - (+ start (modulo sto slen)))) + ;; ((= (floor (/ sfrom slen)) (floor (/ sto slen))) + ;; (%string-copy! target tstart s + ;; (+ start (modulo sfrom slen)) + ;; (+ start (modulo sto slen)))) ;; Multi-span copy. (else (%multispan-repcopy! target tstart s sfrom sto start end)))))) -- 1.7.2.5