Skip to content

Commit 700128f

Browse files
committed
change flag name to :compatibility-mode
1 parent 5873e76 commit 700128f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/msgpack/core.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@
142142

143143
java.lang.String
144144
(packable-pack
145-
[str ^java.io.DataOutput s {:keys [raw]}]
145+
[str ^java.io.DataOutput s {:keys [compatibility-mode]}]
146146
(let [bytes (.getBytes ^String str msgpack-charset)]
147-
(if raw
147+
(if compatibility-mode
148148
(pack-raw bytes s)
149149
(pack-str bytes s))))
150150

@@ -199,16 +199,16 @@
199199
(extend (class (java.lang.reflect.Array/newInstance Byte 0))
200200
Packable
201201
{:packable-pack
202-
(fn [bytes ^java.io.DataOutput s {:keys [raw]}]
203-
(if raw
202+
(fn [bytes ^java.io.DataOutput s {:keys [compatibility-mode]}]
203+
(if compatibility-mode
204204
(pack-raw bytes s)
205205
(pack-bytes bytes s)))})
206206

207207
(extend (Class/forName "[B")
208208
Packable
209209
{:packable-pack
210-
(fn [bytes ^java.io.DataOutput s {:keys [raw]}]
211-
(if raw
210+
(fn [bytes ^java.io.DataOutput s {:keys [compatibility-mode]}]
211+
(if compatibility-mode
212212
(pack-raw bytes s)
213213
(pack-bytes bytes s)))})
214214

@@ -248,9 +248,9 @@
248248
bytes)))
249249

250250
(defn- read-str
251-
[n ^java.io.DataInput data-input {:keys [raw]}]
251+
[n ^java.io.DataInput data-input {:keys [compatibility-mode]}]
252252
(let [bytes (read-bytes n data-input)]
253-
(if raw bytes
253+
(if compatibility-mode bytes
254254
(String. ^bytes bytes msgpack-charset))))
255255

256256
(defmulti refine-ext

test/msgpack/core_test.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
`(let [obj# ~obj
4747
packed-bytes# (unsigned-bytes ~packed-bytes)
4848
unpacked-obj# ~unpacked-obj]
49-
(is (= packed-bytes# (seq (msg/pack obj# {:raw true}))))
50-
(is (= (normalize unpacked-obj#) (normalize (msg/unpack packed-bytes# {:raw true}))))))
49+
(is (= packed-bytes# (seq (msg/pack obj# {:compatibility-mode true}))))
50+
(is (= (normalize unpacked-obj#) (normalize (msg/unpack packed-bytes# {:compatibility-mode true}))))))
5151

5252
(deftest nil-test
5353
(testing "nil"
@@ -218,8 +218,8 @@
218218
(deftest map-test
219219
(testing "fixmap"
220220
(round-trip {} [0x80])
221-
(round-trip-raw {(byte-array 0) [{"key" (byte-array 0)}]}
222-
[0x81 0xa0 0x91 0x81 0xa3 0x6b 0x65 0x79 0xa0]
221+
(round-trip-raw {(byte-array 0) [{"key" (byte-array 0)}]}
222+
[0x81 0xa0 0x91 0x81 0xa3 0x6b 0x65 0x79 0xa0]
223223
{nil [{(.getBytes "key") nil}]})
224224
(round-trip {1 true 2 "abc" 3 (unsigned-byte-array [0x80])}
225225
[0x83 0x01 0xc3 0x02 0xa3 0x61 0x62 0x63 0x03 0xc4 0x01 0x80])

0 commit comments

Comments
 (0)