@@ -434,7 +434,7 @@ open class FileManager : NSObject {
434
434
let bufSize = Int ( PATH_MAX + 1 )
435
435
var buf = [ Int8] ( repeating: 0 , count: bufSize)
436
436
let len = _fileSystemRepresentation ( withPath: path) {
437
- readlink ( $0, & buf, bufSize)
437
+ readlink ( $0, & buf, bufSize)
438
438
}
439
439
if len < 0 {
440
440
throw _NSErrorWithErrno ( errno, reading: true , path: path)
@@ -503,16 +503,16 @@ open class FileManager : NSObject {
503
503
let buffer = UnsafeMutablePointer< UInt8> . allocate( capacity: Int ( fileInfo. st_blksize) )
504
504
defer { buffer. deallocate ( ) }
505
505
506
- var bytesRemaining = Int64 ( fileInfo. st_size)
506
+ var bytesRemaining = Int ( fileInfo. st_size)
507
507
while bytesRemaining > 0 {
508
- let bytesToRead = min ( bytesRemaining, Int64 ( fileInfo. st_blksize) )
509
- let bytesRead = try _readFrom ( fd: srcfd, toBuffer: buffer, length: Int ( bytesToRead) , filename: srcPath)
508
+ let bytesToRead = min ( bytesRemaining, Int ( fileInfo. st_blksize) )
509
+ let bytesRead = try _readFrom ( fd: srcfd, toBuffer: buffer, length: bytesToRead, filename: srcPath)
510
510
if bytesRead == 0 {
511
511
// Early EOF
512
512
return
513
513
}
514
514
try _writeTo ( fd: dstfd, fromBuffer: buffer, length: bytesRead, filename: dstPath)
515
- bytesRemaining -= Int64 ( bytesRead)
515
+ bytesRemaining -= bytesRead
516
516
}
517
517
}
518
518
@@ -693,11 +693,10 @@ open class FileManager : NSObject {
693
693
/* Process working directory management. Despite the fact that these are instance methods on FileManager, these methods report and change (respectively) the working directory for the entire process. Developers are cautioned that doing so is fraught with peril.
694
694
*/
695
695
open var currentDirectoryPath : String {
696
- let length = Int ( PATH_MAX) + 1
697
- var buf = [ Int8] ( repeating: 0 , count: length)
698
- getcwd ( & buf, length)
699
- let result = self . string ( withFileSystemRepresentation: buf, length: Int ( strlen ( buf) ) )
700
- return result
696
+ let len = Int ( PATH_MAX) + 1
697
+ var buf = [ Int8] ( repeating: 0 , count: len)
698
+ getcwd ( & buf, len)
699
+ return string ( withFileSystemRepresentation: buf, length: len)
701
700
}
702
701
703
702
@discardableResult
@@ -779,9 +778,9 @@ open class FileManager : NSObject {
779
778
buffer2. deallocate ( )
780
779
}
781
780
782
- var bytesLeft = size
781
+ var bytesLeft = Int ( size)
783
782
while bytesLeft > 0 {
784
- let bytesToRead = Int ( min ( Int64 ( bufSize) , bytesLeft) )
783
+ let bytesToRead = min ( bufSize, bytesLeft)
785
784
guard read ( fd1, buffer1, bytesToRead) == bytesToRead else {
786
785
return false
787
786
}
@@ -791,15 +790,15 @@ open class FileManager : NSObject {
791
790
guard memcmp ( buffer1, buffer2, bytesToRead) == 0 else {
792
791
return false
793
792
}
794
- bytesLeft -= Int64 ( bytesToRead)
793
+ bytesLeft -= bytesToRead
795
794
}
796
795
return true
797
796
}
798
797
799
798
private func _compareSymlinks( withFileSystemRepresentation file1Rep: UnsafePointer < Int8 > , andFileSystemRepresentation file2Rep: UnsafePointer < Int8 > , size: Int64 ) -> Bool {
800
799
let bufSize = Int ( size)
801
- let buffer1 = UnsafeMutablePointer< CChar> . allocate( capacity: Int ( bufSize) )
802
- let buffer2 = UnsafeMutablePointer< CChar> . allocate( capacity: Int ( bufSize) )
800
+ let buffer1 = UnsafeMutablePointer< CChar> . allocate( capacity: bufSize)
801
+ let buffer2 = UnsafeMutablePointer< CChar> . allocate( capacity: bufSize)
803
802
804
803
let size1 = readlink ( file1Rep, buffer1, bufSize)
805
804
let size2 = readlink ( file2Rep, buffer2, bufSize)
0 commit comments