CFPropertyList 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbBinaryCFPropertyList.rb +13 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d47e329300e952348ef2999d7df0ab8d67e54835
4
- data.tar.gz: a59f3e114e6deb519f0b8533187b7af42a95a901
3
+ metadata.gz: f2981869849555b1191a490d703cc2f79bb322a6
4
+ data.tar.gz: ffed3e7815aed638c812435432fa0a793af3d39d
5
5
  SHA512:
6
- metadata.gz: 4f3f08fea23ddcb0f0d407f9344853951929329cd6ea113d188d4b8a90f60d62edb8fcc1648778743ceaf69c6ee14a8148bbaede198207088f6cf333d830cd0c
7
- data.tar.gz: 38cbae8fa0cdd6d30d5c08cfa741d5dc9e523a9507b2f8e17ef87f545fc9c3ca01e71ac52e4d7636aa495211c852942be6663358ece253c2f02204609f341a68
6
+ metadata.gz: 95b2b7dcb15553efdd3d5dd80cb0f5d5ff28a0e0c8431a27bc6a896ddb74bd050516d4c58a8373a62302d9a124ccb2a6768562157f43c2276408cc2cc16ed8e5
7
+ data.tar.gz: a8e86273c778acdfe0335b481f8fed5f15002a6af6adba33908b9f979d21d075bc2d1249d52f8e4d5701395174359c36cf9416c4e3f7274c2025c62d7c09f1e4
@@ -258,6 +258,16 @@ module CFPropertyList
258
258
  end
259
259
  protected :read_binary_unicode_string
260
260
 
261
+ def unpack_with_size(nbytes, buff)
262
+ format = ["C*", "n*", "N*", "N*"][nbytes - 1];
263
+
264
+ if nbytes == 3
265
+ buff = "\0" + buff.scan(/.{1,3}/).join("\0")
266
+ end
267
+
268
+ return buff.unpack(format)
269
+ end
270
+
261
271
  # Read an binary array value, including contained objects
262
272
  def read_binary_array(fname,fd,length)
263
273
  ary = []
@@ -265,7 +275,7 @@ module CFPropertyList
265
275
  # first: read object refs
266
276
  if(length != 0)
267
277
  buff = fd.read(length * @object_ref_size)
268
- objects = buff.unpack(@object_ref_size == 1 ? "C*" : "n*")
278
+ objects = unpack_with_size(@object_ref_size, buff) #buff.unpack(@object_ref_size == 1 ? "C*" : "n*")
269
279
 
270
280
  # now: read objects
271
281
  0.upto(length-1) do |i|
@@ -285,11 +295,11 @@ module CFPropertyList
285
295
  # first: read keys
286
296
  if(length != 0) then
287
297
  buff = fd.read(length * @object_ref_size)
288
- keys = buff.unpack(@object_ref_size == 1 ? "C*" : "n*")
298
+ keys = unpack_with_size(@object_ref_size, buff) #buff.unpack(@object_ref_size == 1 ? "C*" : "n*")
289
299
 
290
300
  # second: read object refs
291
301
  buff = fd.read(length * @object_ref_size)
292
- objects = buff.unpack(@object_ref_size == 1 ? "C*" : "n*")
302
+ objects = unpack_with_size(@object_ref_size, buff) #buff.unpack(@object_ref_size == 1 ? "C*" : "n*")
293
303
 
294
304
  # read real keys and objects
295
305
  0.upto(length-1) do |i|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CFPropertyList
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kruse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-01 00:00:00.000000000 Z
11
+ date: 2013-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake