diff options
author | Dave MacLachlan <dmaclach@google.com> | 2016-12-15 19:29:07 +0000 |
---|---|---|
committer | John Cater <jcater@google.com> | 2016-12-15 20:39:46 +0000 |
commit | d405c8a191688c3f9caf5bab821d79ab31a94200 (patch) | |
tree | 1aff4a3e7727727a9d5879a81a9326481b2a7259 /third_party/java | |
parent | 9e008b958ca87da2903db7f168165917a51b4d9b (diff) |
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
Diffstat (limited to 'third_party/java')
3 files changed, 11 insertions, 2 deletions
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<NSObject, Integer> idMap = new HashMap<NSObject, Integer>(); + private Map<NSObject, Integer> idMap = new LinkedHashMap<NSObject, Integer>(); 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<String, NSObject> { super.assignIDs(out); for (Map.Entry<String, NSObject> entry : dict.entrySet()) { new NSString(entry.getKey()).assignIDs(out); + } + for (Map.Entry<String, NSObject> entry : dict.entrySet()) { entry.getValue().assignIDs(out); } } |