chiark
/
gitweb
/
~mdw
/
clg
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d32ee07
)
ENCODE-UTF8-STRING now works with zero length string
author
espen
<espen>
Wed, 6 Sep 2006 09:45:26 +0000
(09:45 +0000)
committer
espen
<espen>
Wed, 6 Sep 2006 09:45:26 +0000
(09:45 +0000)
gffi/basic-types.lisp
patch
|
blob
|
blame
|
history
diff --git
a/gffi/basic-types.lisp
b/gffi/basic-types.lisp
index d1da957f8e120b25d75225c76a32d5c82a43ed51..b2b0a893bde9131b9b8b2fb4020e2989c98167c0 100644
(file)
--- a/
gffi/basic-types.lisp
+++ b/
gffi/basic-types.lisp
@@
-20,7
+20,7
@@
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-;; $Id: basic-types.lisp,v 1.
2 2006-06-08 13:24:25
espen Exp $
+;; $Id: basic-types.lisp,v 1.
3 2006-09-06 09:45:26
espen Exp $
(in-package "GFFI")
(in-package "GFFI")
@@
-580,7
+580,8
@@
(defun utf8-length (string)
((< char-code #x1FFFFF) 4)))))
(defun encode-utf8-string (string &optional location)
((< char-code #x1FFFFF) 4)))))
(defun encode-utf8-string (string &optional location)
- (let ((location (or location (allocate-memory (utf8-length string)))))
+ (let* ((len (utf8-length string))
+ (location (or location (allocate-memory len))))
(loop
for char across string
for i from 0
(loop
for char across string
for i from 0
@@
-599,8
+600,8
@@
(defun encode-utf8-string (string &optional location)
((< char-code #x80) (setf (ref-byte location i) char-code))
((< char-code #x800) (encode 11))
((< char-code #x10000) (encode 16))
((< char-code #x80) (setf (ref-byte location i) char-code))
((< char-code #x800) (encode 11))
((< char-code #x10000) (encode 16))
- ((< char-code #x200000) (encode 21))))
-
finally (setf (ref-byte location (1+ i)) 0)
)
+ ((< char-code #x200000) (encode 21))))
)
+
(setf (ref-byte location len) 0
)
location))
(defun decode-utf8-string (c-string)
location))
(defun decode-utf8-string (c-string)