File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ public enum BinaryHeaderMapEncoder {
18
18
static let encoding : String . Encoding = . utf8
19
19
20
20
public static func encode( _ headerMap: BinaryHeaderMap ) throws -> Data {
21
- let entries : [ BinaryHeaderMap . Entry ] = headerMap. entries. map { $0. value }
21
+ let entries : [ BinaryHeaderMap . Entry ] = headerMap. entries. map { $0. value } . sorted { $0 . key < $1 . key }
22
22
return try makeHeaderMapBinaryData ( withEntries: entries)
23
23
}
24
24
}
25
25
26
26
private func makeHeaderMapBinaryData( withEntries unsafeEntries: [ BinaryHeaderMap . Entry ] ) throws -> Data {
27
27
let safeEntries = sanitize ( headerEntries: unsafeEntries)
28
- let allStrings = Set ( safeEntries. flatMap { [ $0. key, $0. prefix, $0. suffix] } )
28
+ let allStrings = Set ( safeEntries. flatMap { [ $0. key, $0. prefix, $0. suffix] } ) . sorted ( )
29
29
let stringSection = try makeStringSection ( allStrings: allStrings)
30
30
let bucketSection = try makeBucketSection (
31
31
forEntries: safeEntries,
@@ -157,7 +157,7 @@ private struct StringSection {
157
157
let offsets : [ String : StringSectionOffset ]
158
158
}
159
159
160
- private func makeStringSection( allStrings: Set < String > ) throws -> StringSection {
160
+ private func makeStringSection( allStrings: [ String ] ) throws -> StringSection {
161
161
162
162
var buffer = Data ( )
163
163
var offsets : [ String : StringSectionOffset ] = [ : ]
You can’t perform that action at this time.
0 commit comments