Commit ccdd7183 authored by david's avatar david

Revision: cxml--devel--1.0--patch-49

Archive: david@knowledgetools.de--cxml
Creator: David Lichteblau <david@knowledgetools.de>
Date: Thu Feb  5 15:53:16 CET 2004
Standard-date: 2004-02-05 14:53:16 GMT
Modified-files: xml/dom-impl.lisp
New-patches: david@knowledgetools.de--cxml/cxml--devel--1.0--patch-49
Summary: bugfix: replace-data for count != (length arg)
Keywords:

replace-data bugfix: Argument COUNT kann sich durchaus von der Laenge
von ARG unterscheiden (sonst waere es ja auch ueberfluessig).

Testfall: characterdatareplacedataexceedslengthofarg.xml
parent 1d343207
......@@ -483,6 +483,8 @@
(values))
(defmethod dom:replace-data ((node character-data) offset count arg)
;; Although we could implement this by calling DELETE-DATA, then INSERT-DATA,
;; we implement this function directly to avoid creating temporary garbage.
(assert-writeable node)
(setf arg (rod arg))
(with-slots (value) node
......@@ -490,14 +492,19 @@
(dom-error :INDEX_SIZE_ERR "offset is invalid"))
(when (minusp count)
(dom-error :INDEX_SIZE_ERR "count is negative"))
(let ((end1 (+ offset count)))
(when (> end1 (length value))
(let ((new (make-array end1 :element-type (array-element-type value))))
(replace new value)
(setf count (min count (- (length value) offset)))
(if (= count (length arg))
(replace value arg
:start1 offset :end1 (+ offset count)
:start2 0 :end2 count)
(let ((new (make-array (+ (length value) (length arg) (- count))
:element-type (array-element-type value))))
(replace new value :end1 offset)
(replace new arg :start1 offset)
(replace new value
:start1 (+ offset (length arg))
:start2 (+ offset count))
(setf value new))))
(replace value arg
:start1 offset :end1 (+ offset count)
:start2 0 :end2 count))
(values))
(defmethod dom:insert-data ((node character-data) offset arg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment