Skip to content

Commit f596453

Browse files
committed
Misc warnings fixes
- Fixes for the following warnings: 'BidirectionalSlice' is deprecated: renamed to 'Slice' 'DefaultRandomAccessIndices' is deprecated: renamed to 'DefaultIndices' 'index(_:offsetBy:)' is deprecated: all index distances are now of type Int initializer for struct 'CFRange' must use "self.init(...)" or "self = ..." because the struct was imported from C deinitialize()' is deprecated: the default argument to deinitialize(count:) has been removed, please specify the count explicitly 'deallocate(capacity:)' is deprecated: Swift currently only supports freeing entire heap blocks, use deallocate() instead
1 parent 3206f9d commit f596453

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

Diff for: Foundation/IndexPath.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
3535
public typealias ReferenceType = NSIndexPath
3636
public typealias Element = Int
3737
public typealias Index = Array<Int>.Index
38-
public typealias Indices = DefaultRandomAccessIndices<IndexPath>
38+
public typealias Indices = DefaultIndices<IndexPath>
3939

4040
fileprivate enum Storage : ExpressibleByArrayLiteral {
4141
typealias Element = Int

Diff for: Foundation/IndexSet.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
114114
}
115115
}
116116

117-
public subscript(bounds: Range<Index>) -> BidirectionalSlice<RangeView> {
118-
return BidirectionalSlice(base: self, bounds: bounds)
117+
public subscript(bounds: Range<Index>) -> Slice<RangeView> {
118+
return Slice(base: self, bounds: bounds)
119119
}
120120

121121
public func index(after i: Index) -> Index {
@@ -273,8 +273,8 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
273273
return index.value
274274
}
275275

276-
public subscript(bounds: Range<Index>) -> BidirectionalSlice<IndexSet> {
277-
return BidirectionalSlice(base: self, bounds: bounds)
276+
public subscript(bounds: Range<Index>) -> Slice<IndexSet> {
277+
return Slice(base: self, bounds: bounds)
278278
}
279279

280280
// We adopt the default implementation of subscript(range: Range<Index>) from MutableCollection

Diff for: Foundation/NSIndexSet.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ open class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
396396
lock.unlock()
397397
if stop.boolValue { return }
398398

399-
let idx = rangeSequence.index(rangeSequence.startIndex, offsetBy: Int64(rangeIdx))
399+
let idx = rangeSequence.index(rangeSequence.startIndex, offsetBy: rangeIdx)
400400
let curRange = rangeSequence[idx]
401401
let intersection = NSIntersectionRange(curRange, range)
402402
if passRanges {

Diff for: Foundation/NSRange.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ extension NSRange {
342342

343343
extension CFRange {
344344
internal init(_ range: NSRange) {
345-
location = range.location == NSNotFound ? kCFNotFound : range.location
346-
length = range.length
345+
let _location = range.location == NSNotFound ? kCFNotFound : range.location
346+
self.init(location: _location, length: range.length)
347347
}
348348
}
349349

Diff for: Foundation/NSString.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ open class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSC
237237
let characters = UnsafeMutablePointer<unichar>.allocate(capacity: length)
238238
getCharacters(characters, range: NSRange(location: 0, length: length))
239239
let result = NSString(characters: characters, length: length)
240-
characters.deinitialize()
241-
characters.deallocate(capacity: length)
240+
characters.deinitialize(count: length)
241+
characters.deallocate()
242242
return result
243243
}
244244

0 commit comments

Comments
 (0)