Raymond Toy pushed to branch issue-367-count-octets-for-encoding at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/extfmts.lisp
    ... ... @@ -1155,15 +1155,18 @@ character and illegal outputs are replaced by a question mark.")
    1155 1155
           (values (if stringp string (lisp::shrink-vector string pos)) (- pos s-start) last-octet new-state))))
    
    1156 1156
     
    
    1157 1157
     
    
    1158
    -(def-ef-macro ef-octet-count (extfmt lisp::lisp +ef-max+ +ef-oc+)
    
    1158
    +(def-ef-macro ef-string-octet-count (extfmt lisp::lisp +ef-max+ +ef-oc+)
    
    1159 1159
       `(lambda (string start end error &aux (total 0) (state nil))
    
    1160 1160
          (dotimes (i (- end start) total)
    
    1161 1161
            (incf total
    
    1162 1162
     	     (octet-count ,extfmt (schar string (+ start i)) state error)))))
    
    1163 1163
     
    
    1164 1164
     (defun string-octet-count (string &key (start 0) end  (external-format :default) error)
    
    1165
    +  "Compute the number of octets needed to convert String using the
    
    1166
    +  specified External-format.  The string is bound by Start (defaulting
    
    1167
    +  to 0) and End (defaulting to the end of the string)."
    
    1165 1168
       (lisp::with-array-data ((string string) (start start) (end end))
    
    1166
    -    (funcall (ef-octet-count external-format)
    
    1169
    +    (funcall (ef-string-octet-count external-format)
    
    1167 1170
     	     string start end error)))
    
    1168 1171
     
    
    1169 1172
     (def-ef-macro ef-encode (extfmt lisp::lisp +ef-max+ +ef-en+)