Skip to content

Commit

Permalink
Fix error when reading/writing pathnames on LispWorks
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulu-Inuoe committed Oct 19, 2023
1 parent d7d517e commit 2b7eb97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Changes relative to [v1.1.2](#v112)

* LispWorks 8 Structure Serialization
* Fix error when reading/writing from/to pathnames on LispWorks (https://github.com/Zulu-Inuoe/jzon/issues/56)

## v1.1.2

Expand Down
7 changes: 4 additions & 3 deletions src/jzon.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ see `close-parser'"
(multiple-value-bind (input close-action)
(typecase in
(pathname
(let ((f (open in :direction :input :external-format :utf-8)))
(let ((f (open in :direction :input :external-format :utf-8 :element-type 'character)))
(values f (lambda () (close f)))))
(t (values in (lambda ()))))
(let ((parser (make-instance 'parser))
Expand Down Expand Up @@ -1125,7 +1125,7 @@ see `close-parser'"

(typecase in
(pathname
(with-open-file (in in :direction :input :external-format :utf-8)
(with-open-file (in in :direction :input :external-format :utf-8 :element-type 'character)
(parse in :max-depth max-depth :allow-comments allow-comments :allow-trailing-comma allow-trailing-comma :allow-multiple-content allow-multiple-content :max-string-length max-string-length :key-fn key-fn)))
(t
(multiple-value-bind (%step %read-string %pos) (%make-fns in max-string-length)
Expand Down Expand Up @@ -1305,7 +1305,8 @@ Example return value:
(let ((stream (open stream :direction :output
:if-does-not-exist :create
:if-exists :supersede
:external-format :utf-8)))
:external-format :utf-8
:element-type 'character)))
(values stream (lambda () (close stream)))))
((streamp stream)
(unless (output-stream-p stream)
Expand Down

0 comments on commit 2b7eb97

Please sign in to comment.