From d405c8a191688c3f9caf5bab821d79ab31a94200 Mon Sep 17 00:00:00 2001 From: Dave MacLachlan Date: Thu, 15 Dec 2016 19:29:07 +0000 Subject: Pulls in two changes from github for the dd_plist library. https://github.com/3breadt/dd-plist/commit/3fa1fa56c82df169e06079feb54ba281ad41cae6 which stabilizes the ordering of items in the plist and is equivalent to what happens in Apple's reference code. https://github.com/3breadt/dd-plist/commit/a5fb37384d4ca7a3b5039a7605ca0e9ca926a6ec which outputs ids in the plist equivalent to Apple's reference code. We still differ from Apple's code in that we de-dupe booleans, arrays, and dictionaries which produces smaller binaries. Via testing I have determined that the tooling that was having trouble with our "bad" plists, appears to be happy with our output if we continue our de-duping so I left it in there. Fixing it so that it was exactly equivalent to Apple's output would be a significantly larger engineering effort. -- PiperOrigin-RevId: 142166474 MOS_MIGRATED_REVID=142166474 --- third_party/java/dd_plist/README | 7 +++++++ .../java/dd_plist/java/com/dd/plist/BinaryPropertyListWriter.java | 4 ++-- third_party/java/dd_plist/java/com/dd/plist/NSDictionary.java | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'third_party/java') diff --git a/third_party/java/dd_plist/README b/third_party/java/dd_plist/README index a2df2f881b..6646f9cf57 100644 --- a/third_party/java/dd_plist/README +++ b/third_party/java/dd_plist/README @@ -31,3 +31,10 @@ Local Modifications: - Allow \ escaping of characters that need not be escaped in ASCIIPropertyListParser.java. - Make PropertyListParser.determineType handle an empty bytes array properly. +- https://github.com/3breadt/dd-plist/commit/3fa1fa56c82df169e06079feb54ba281ad41cae6 +which stabilizes ordering and is required for plists to be parsed by some Apple +plist parsers. +- https://github.com/3breadt/dd-plist/commit/a5fb37384d4ca7a3b5039a7605ca0e9ca926a6ec +which causes dictionaries to generate ids for values the same way the Apple +implementation does it. + diff --git a/third_party/java/dd_plist/java/com/dd/plist/BinaryPropertyListWriter.java b/third_party/java/dd_plist/java/com/dd/plist/BinaryPropertyListWriter.java index c7b5315fb7..21645befcc 100644 --- a/third_party/java/dd_plist/java/com/dd/plist/BinaryPropertyListWriter.java +++ b/third_party/java/dd_plist/java/com/dd/plist/BinaryPropertyListWriter.java @@ -29,7 +29,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -143,7 +143,7 @@ public class BinaryPropertyListWriter { private long count; // map from object to its ID - private Map idMap = new HashMap(); + private Map idMap = new LinkedHashMap(); private int idSizeInBytes; /** diff --git a/third_party/java/dd_plist/java/com/dd/plist/NSDictionary.java b/third_party/java/dd_plist/java/com/dd/plist/NSDictionary.java index a193a80e0c..9beedbc75c 100644 --- a/third_party/java/dd_plist/java/com/dd/plist/NSDictionary.java +++ b/third_party/java/dd_plist/java/com/dd/plist/NSDictionary.java @@ -406,6 +406,8 @@ public class NSDictionary extends NSObject implements Map { super.assignIDs(out); for (Map.Entry entry : dict.entrySet()) { new NSString(entry.getKey()).assignIDs(out); + } + for (Map.Entry entry : dict.entrySet()) { entry.getValue().assignIDs(out); } } -- cgit v1.2.3