File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public struct File {
38
38
In the event of read-error we do not feed a partially generated
39
39
line before ending iteration.
40
40
*/
41
- public func enumerate( _ separator: Character = " \n " ) throws -> FileLineGenerator {
41
+ public func enumerate( _ separator: UnicodeScalar = " \n " ) throws -> FileLineGenerator {
42
42
return try FileLineGenerator ( path: path, separator: separator)
43
43
}
44
44
}
@@ -50,8 +50,8 @@ public class FileLineGenerator: IteratorProtocol, Sequence {
50
50
private let fp : UnsafeMutablePointer < FILE >
51
51
private let separator : Int32
52
52
53
- init ( path: String , separator c: Character ) throws {
54
- separator = Int32 ( String ( c ) . utf8 . first! )
53
+ init ( path: String , separator c: UnicodeScalar ) throws {
54
+ separator = Int32 ( UInt8 ( ascii : c ) )
55
55
fp = try fopen ( path)
56
56
}
57
57
Original file line number Diff line number Diff line change @@ -289,9 +289,9 @@ extension String {
289
289
var idx = utf8. startIndex
290
290
let end = utf8. endIndex
291
291
while idx != end {
292
- if utf8 [ idx] == " / " . utf8 . first! {
292
+ if utf8 [ idx] == UInt8 ( ascii : " / " ) {
293
293
idx = idx. successor ( )
294
- if idx == end || utf8 [ idx] == " / " . utf8 . first! {
294
+ if idx == end || utf8 [ idx] == UInt8 ( ascii : " / " ) {
295
295
return false
296
296
}
297
297
}
You can’t perform that action at this time.
0 commit comments