From: Nikodemus Siivola Date: Mon, 1 Dec 2008 15:28:35 +0000 (+0000) Subject: 1.0.23.2: STRING->UTF8 did not handle the start argument correctly X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=d8ad375f27c0006f8896047686a065b8243c7e0f;p=sbcl.git 1.0.23.2: STRING->UTF8 did not handle the start argument correctly * Thank to Luis Oliveira. --- diff --git a/NEWS b/NEWS index 598227b..69e84d9 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ ;;;; -*- coding: utf-8; -*- * bug fix: lexical type declarations are now correctly reported by SB-CLTL2. (reported by Larry D'Anna) + * bug fix: STRING-TO-OCTETS did not handle :START properly when + using UTF-8 as external format. (thanks to Luis Oliveira) changes in sbcl-1.0.23 relative to 1.0.22: * enhancement: when disassembling method functions, disassembly diff --git a/src/code/octets.lisp b/src/code/octets.lisp index eb87cd1..32344cc 100644 --- a/src/code/octets.lisp +++ b/src/code/octets.lisp @@ -402,8 +402,9 @@ one-past-the-end" (macrolet ((ascii-bash () '(let ((array (make-array (+ null-padding (- send sstart)) :element-type '(unsigned-byte 8)))) - (loop for i from sstart below send - do (setf (aref array i) (char-code (char string i)))) + (loop for i from 0 + and j from sstart below send + do (setf (aref array i) (char-code (char string j)))) array))) (etypecase string ((simple-array character (*)) diff --git a/tests/octets.pure.lisp b/tests/octets.pure.lisp index f0d5dba..166d01b 100644 --- a/tests/octets.pure.lisp +++ b/tests/octets.pure.lisp @@ -219,3 +219,7 @@ ) ) + +;; regression test: STRING->UTF8 didn't properly handle a non-zero +;; START argument. +(assert (equalp #(50) (string-to-octets "42" :start 1 :external-format :utf-8))) diff --git a/version.lisp-expr b/version.lisp-expr index 08cc696..d4b8998 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.23.1" +"1.0.23.2"