@@ -1999,8 +1999,11 @@ internal class _RawNativeDictionaryStorage
1999
1999
}
2000
2000
2001
2001
@inlinable // FIXME(sil-serialize-all)
2002
- internal func getObjects( _ objects: UnsafeMutablePointer < AnyObject > ? ,
2003
- andKeys keys: UnsafeMutablePointer < AnyObject > ? ) {
2002
+ @objc ( getObjects: andKeys: count: )
2003
+ internal func getObjects(
2004
+ _ objects: UnsafeMutablePointer < AnyObject > ? ,
2005
+ andKeys keys: UnsafeMutablePointer < AnyObject > ? ,
2006
+ count: Int ) {
2004
2007
// Do nothing, we're empty
2005
2008
}
2006
2009
#endif
@@ -2168,28 +2171,33 @@ final internal class _HashableTypedNativeDictionaryStorage<Key: Hashable, Value>
2168
2171
2169
2172
// We also override the following methods for efficiency.
2170
2173
@inlinable // FIXME(sil-serialize-all)
2171
- @objc
2172
- override func getObjects( _ objects: UnsafeMutablePointer < AnyObject > ? ,
2173
- andKeys keys: UnsafeMutablePointer < AnyObject > ? ) {
2174
+ @objc ( getObjects: andKeys: count: )
2175
+ override func getObjects(
2176
+ _ objects: UnsafeMutablePointer < AnyObject > ? ,
2177
+ andKeys keys: UnsafeMutablePointer < AnyObject > ? ,
2178
+ count: Int ) {
2174
2179
// The user is expected to provide a storage of the correct size
2175
2180
if let unmanagedKeys = _UnmanagedAnyObjectArray ( keys) {
2176
2181
if let unmanagedObjects = _UnmanagedAnyObjectArray ( objects) {
2177
2182
// keys nonnull, objects nonnull
2178
2183
for (offset: i, element: ( key: key, value: val) ) in full. enumerated ( ) {
2179
2184
unmanagedObjects [ i] = _bridgeAnythingToObjectiveC ( val)
2180
2185
unmanagedKeys [ i] = _bridgeAnythingToObjectiveC ( key)
2186
+ guard i < count else { break }
2181
2187
}
2182
2188
} else {
2183
2189
// keys nonnull, objects null
2184
2190
for (offset: i, element: ( key: key, value: _) ) in full. enumerated ( ) {
2185
2191
unmanagedKeys [ i] = _bridgeAnythingToObjectiveC ( key)
2192
+ guard i < count else { break }
2186
2193
}
2187
2194
}
2188
2195
} else {
2189
2196
if let unmanagedObjects = _UnmanagedAnyObjectArray ( objects) {
2190
2197
// keys null, objects nonnull
2191
2198
for (offset: i, element: ( key: _, value: val) ) in full. enumerated ( ) {
2192
2199
unmanagedObjects [ i] = _bridgeAnythingToObjectiveC ( val)
2200
+ guard i < count else { break }
2193
2201
}
2194
2202
} else {
2195
2203
// do nothing, both are null
@@ -2862,12 +2870,13 @@ final internal class _SwiftDeferredNSDictionary<Key: Hashable, Value>
2862
2870
}
2863
2871
2864
2872
@inlinable // FIXME(sil-serialize-all)
2865
- @objc
2873
+ @objc ( getObjects : andKeys : count : )
2866
2874
internal func getObjects(
2867
2875
_ objects: UnsafeMutablePointer < AnyObject > ? ,
2868
- andKeys keys: UnsafeMutablePointer < AnyObject > ?
2876
+ andKeys keys: UnsafeMutablePointer < AnyObject > ? ,
2877
+ count: Int
2869
2878
) {
2870
- bridgedAllKeysAndValues ( objects, keys)
2879
+ bridgedAllKeysAndValues ( objects, keys, count )
2871
2880
}
2872
2881
2873
2882
@inlinable // FIXME(sil-serialize-all)
@@ -2957,7 +2966,8 @@ final internal class _SwiftDeferredNSDictionary<Key: Hashable, Value>
2957
2966
@nonobjc
2958
2967
internal func bridgedAllKeysAndValues(
2959
2968
_ objects: UnsafeMutablePointer < AnyObject > ? ,
2960
- _ keys: UnsafeMutablePointer < AnyObject > ?
2969
+ _ keys: UnsafeMutablePointer < AnyObject > ? ,
2970
+ _ count: Int
2961
2971
) {
2962
2972
bridgeEverything ( )
2963
2973
// The user is expected to provide a storage of the correct size
@@ -2972,6 +2982,7 @@ final internal class _SwiftDeferredNSDictionary<Key: Hashable, Value>
2972
2982
unmanagedObjects [ i] = bridgedBuffer. value ( at: position)
2973
2983
unmanagedKeys [ i] = bridgedBuffer. key ( at: position)
2974
2984
i += 1
2985
+ guard i < count else { break }
2975
2986
}
2976
2987
}
2977
2988
} else {
@@ -2980,6 +2991,7 @@ final internal class _SwiftDeferredNSDictionary<Key: Hashable, Value>
2980
2991
if bridgedBuffer. isInitializedEntry ( at: position) {
2981
2992
unmanagedKeys [ i] = bridgedBuffer. key ( at: position)
2982
2993
i += 1
2994
+ guard i < count else { break }
2983
2995
}
2984
2996
}
2985
2997
}
@@ -2990,6 +3002,7 @@ final internal class _SwiftDeferredNSDictionary<Key: Hashable, Value>
2990
3002
if bridgedBuffer. isInitializedEntry ( at: position) {
2991
3003
unmanagedObjects [ i] = bridgedBuffer. value ( at: position)
2992
3004
i += 1
3005
+ guard i < count else { break }
2993
3006
}
2994
3007
}
2995
3008
} else {
0 commit comments