Skip to content

Commit 51bb354

Browse files
authored
Merge pull request #3148 from compnerd/revert
Revert a set of changes increasing visibility.
2 parents 2ab55d9 + 7fb374b commit 51bb354

File tree

7 files changed

+43
-43
lines changed

7 files changed

+43
-43
lines changed

Sources/Foundation/NSCharacterSet.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ fileprivate extension String {
6262

6363
open class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
6464
typealias CFType = CFCharacterSet
65-
internal var _base = _CFInfo(typeID: CFCharacterSetGetTypeID())
66-
internal var _hashValue = UInt(0) // CFHashCode
67-
internal var _buffer: UnsafeMutableRawPointer? = nil
68-
internal var _length = Int(0) // CFIndex
69-
internal var _annex: UnsafeMutableRawPointer? = nil
65+
private var _base = _CFInfo(typeID: CFCharacterSetGetTypeID())
66+
private var _hashValue = UInt(0) // CFHashCode
67+
private var _buffer: UnsafeMutableRawPointer? = nil
68+
private var _length = Int(0) // CFIndex
69+
private var _annex: UnsafeMutableRawPointer? = nil
7070

7171
internal var _cfObject: CFType {
7272
return unsafeBitCast(self, to: CFType.self)

Sources/Foundation/NSCoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ open class NSCoder : NSObject {
745745
_hasFailed = true
746746
}
747747

748-
internal var _hasFailed = false
748+
internal private(set) var _hasFailed = false
749749

750750
open internal(set) var decodingFailurePolicy: NSCoder.DecodingFailurePolicy = .raiseException
751751

Sources/Foundation/NSData.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension NSData {
5656
}
5757
}
5858

59-
internal final class _NSDataDeallocator {
59+
private final class _NSDataDeallocator {
6060
var handler: (UnsafeMutableRawPointer, Int) -> Void = {_,_ in }
6161
}
6262

@@ -70,12 +70,12 @@ private let __kCFDontDeallocate: CFOptionFlags = 4
7070
open class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
7171
typealias CFType = CFData
7272

73-
internal var _base = _CFInfo(typeID: CFDataGetTypeID())
74-
internal var _length: Int = 0 // CFIndex
75-
internal var _capacity: Int = 0 // CFIndex
76-
internal var _deallocator: UnsafeMutableRawPointer? = nil // for CF only
77-
internal var _deallocHandler: _NSDataDeallocator? = _NSDataDeallocator() // for Swift
78-
internal var _bytes: UnsafeMutablePointer<UInt8>? = nil
73+
private var _base = _CFInfo(typeID: CFDataGetTypeID())
74+
private var _length: Int = 0 // CFIndex
75+
private var _capacity: Int = 0 // CFIndex
76+
private var _deallocator: UnsafeMutableRawPointer? = nil // for CF only
77+
private var _deallocHandler: _NSDataDeallocator? = _NSDataDeallocator() // for Swift
78+
private var _bytes: UnsafeMutablePointer<UInt8>? = nil
7979

8080
internal final var _cfObject: CFType {
8181
if type(of: self) === NSData.self || type(of: self) === NSMutableData.self {
@@ -112,7 +112,7 @@ open class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
112112
}
113113
}
114114

115-
internal init(bytes: UnsafeMutableRawPointer?, length: Int, copy: Bool = false, deallocator: ((UnsafeMutableRawPointer, Int) -> Void)? = nil) {
115+
fileprivate init(bytes: UnsafeMutableRawPointer?, length: Int, copy: Bool = false, deallocator: ((UnsafeMutableRawPointer, Int) -> Void)? = nil) {
116116
super.init()
117117
_init(bytes: bytes, length: length, copy: copy, deallocator: deallocator)
118118
}
@@ -340,7 +340,7 @@ open class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
340340
return NSMutableData(bytes: UnsafeMutableRawPointer(mutating: bytes), length: length, copy: true, deallocator: nil)
341341
}
342342

343-
internal func byteDescription(limit: Int? = nil) -> String {
343+
private func byteDescription(limit: Int? = nil) -> String {
344344
var s = ""
345345
var i = 0
346346
while i < self.length {

Sources/Foundation/NSNumber.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ extension NSNumber : ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral, Exp
594594

595595
}
596596

597-
internal struct CFSInt128Struct {
597+
private struct CFSInt128Struct {
598598
var high: Int64
599599
var low: UInt64
600600
}
@@ -606,8 +606,8 @@ fileprivate func cast<T, U>(_ t: T) -> U {
606606
open class NSNumber : NSValue {
607607
typealias CFType = CFNumber
608608
// This layout MUST be the same as CFNumber so that they are bridgeable
609-
internal var _base = _CFInfo(typeID: CFNumberGetTypeID())
610-
internal var _pad: UInt64 = 0
609+
private var _base = _CFInfo(typeID: CFNumberGetTypeID())
610+
private var _pad: UInt64 = 0
611611

612612
internal final var _cfObject: CFType {
613613
return unsafeBitCast(self, to: CFType.self)
@@ -903,7 +903,7 @@ open class NSNumber : NSValue {
903903
return .init(truncatingIfNeeded: value.low)
904904
}
905905

906-
internal var int128Value: CFSInt128Struct {
906+
private var int128Value: CFSInt128Struct {
907907
var value = CFSInt128Struct(high: 0, low: 0)
908908
CFNumberGetValue(_cfObject, kCFNumberSInt128Type, &value)
909909
return value

Sources/Foundation/NSObject.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ open class NSObject : NSObjectProtocol, Equatable, Hashable {
367367
// Please note:
368368
// the following methods are not overridable in swift-corelibs-foundation.
369369

370-
internal class var nsObjectSuperclass: NSObject.Type? {
370+
private class var nsObjectSuperclass: NSObject.Type? {
371371
// Pretend that {Swift,}Foundation.NSObject is the top of the class hierarchy.
372372
// On Darwin, avoids dipping into the class hierarchy that exists above this class,
373373
// which is ultimately rooted in the ObjC NSObject class.

Sources/Foundation/Progress.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ import Dispatch
3030
*/
3131
open class Progress : NSObject {
3232

33-
internal weak var _parent : Progress?
34-
internal var _children : Set<Progress>
35-
internal var _selfFraction : _ProgressFraction
36-
internal var _childFraction : _ProgressFraction
37-
internal var _userInfo : [ProgressUserInfoKey : Any]
33+
private weak var _parent : Progress?
34+
private var _children : Set<Progress>
35+
private var _selfFraction : _ProgressFraction
36+
private var _childFraction : _ProgressFraction
37+
private var _userInfo : [ProgressUserInfoKey : Any]
3838

3939
// This is set once, but after initialization
40-
internal var _portionOfParent : Int64
40+
private var _portionOfParent : Int64
4141

4242
static private var _tsdKey = "_Foundation_CurrentProgressKey"
4343

@@ -167,7 +167,7 @@ open class Progress : NSObject {
167167
}
168168
}
169169

170-
internal func _setParent(_ parent: Progress, portion: Int64) {
170+
private func _setParent(_ parent: Progress, portion: Int64) {
171171
_parent = parent
172172
_portionOfParent = portion
173173

@@ -416,18 +416,18 @@ open class Progress : NSObject {
416416
// MARK: -
417417
// MARK: Implementation of unit counts
418418

419-
internal var _overallFraction : _ProgressFraction {
419+
private var _overallFraction : _ProgressFraction {
420420
return _selfFraction + _childFraction
421421
}
422422

423-
internal func _addCompletedUnitCount(_ unitCount : Int64) {
423+
private func _addCompletedUnitCount(_ unitCount : Int64) {
424424
let old = _overallFraction
425425
_selfFraction.completed += unitCount
426426
let new = _overallFraction
427427
_updateFractionCompleted(from: old, to: new)
428428
}
429429

430-
internal func _updateFractionCompleted(from: _ProgressFraction, to: _ProgressFraction) {
430+
private func _updateFractionCompleted(from: _ProgressFraction, to: _ProgressFraction) {
431431
if from != to {
432432
_parent?._updateChild(self, from: from, to: to, portion: _portionOfParent)
433433
}

Tests/Foundation/Tests/TestNSData.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ import CoreFoundation
2020
class TestNSData: LoopbackServerTest {
2121

2222
class AllOnesImmutableData : NSData {
23-
private var __length : Int
23+
private var _length : Int
2424
var _pointer : UnsafeMutableBufferPointer<UInt8>? {
2525
willSet {
2626
if let p = _pointer { free(p.baseAddress) }
2727
}
2828
}
2929

3030
init(length: Int) {
31-
__length = length
31+
_length = length
3232
super.init()
3333
}
3434

@@ -45,7 +45,7 @@ class TestNSData: LoopbackServerTest {
4545

4646
override var length : Int {
4747
get {
48-
return __length
48+
return _length
4949
}
5050
}
5151

@@ -78,15 +78,15 @@ class TestNSData: LoopbackServerTest {
7878

7979
class AllOnesData : NSMutableData {
8080

81-
private var __length : Int
81+
private var _length : Int
8282
var _pointer : UnsafeMutableBufferPointer<UInt8>? {
8383
willSet {
8484
if let p = _pointer { free(p.baseAddress) }
8585
}
8686
}
8787

8888
override init(length: Int) {
89-
__length = length
89+
_length = length
9090
super.init()
9191
}
9292

@@ -103,22 +103,22 @@ class TestNSData: LoopbackServerTest {
103103

104104
override var length : Int {
105105
get {
106-
return __length
106+
return _length
107107
}
108108
set {
109109
if let ptr = _pointer {
110110
// Copy the data to our new length buffer
111111
let newBuffer = malloc(newValue)!
112-
if newValue <= __length {
112+
if newValue <= _length {
113113
memmove(newBuffer, ptr.baseAddress!, newValue)
114-
} else if newValue > __length {
115-
memmove(newBuffer, ptr.baseAddress!, __length)
116-
memset(newBuffer + __length, 1, newValue - __length)
114+
} else if newValue > _length {
115+
memmove(newBuffer, ptr.baseAddress!, _length)
116+
memset(newBuffer + _length, 1, newValue - _length)
117117
}
118118
let bytePtr = newBuffer.bindMemory(to: UInt8.self, capacity: newValue)
119119
_pointer = UnsafeMutableBufferPointer(start: bytePtr, count: newValue)
120120
}
121-
__length = newValue
121+
_length = newValue
122122
}
123123
}
124124

@@ -138,7 +138,7 @@ class TestNSData: LoopbackServerTest {
138138
}
139139

140140
override var mutableBytes: UnsafeMutableRawPointer {
141-
let newBufferLength = __length
141+
let newBufferLength = _length
142142
let newBuffer = malloc(newBufferLength)
143143
if let ptr = _pointer {
144144
// Copy the existing data to the new box, then return its pointer
@@ -150,7 +150,7 @@ class TestNSData: LoopbackServerTest {
150150
let bytePtr = newBuffer!.bindMemory(to: UInt8.self, capacity: newBufferLength)
151151
let result = UnsafeMutableBufferPointer(start: bytePtr, count: newBufferLength)
152152
_pointer = result
153-
__length = newBufferLength
153+
_length = newBufferLength
154154
return UnsafeMutableRawPointer(result.baseAddress!)
155155
}
156156

0 commit comments

Comments
 (0)