@@ -300,7 +300,7 @@ open class FileManager : NSObject {
300
300
301
301
try _contentsOfDir ( atPath: path, { ( entryName, entryType) throws in
302
302
contents. append ( entryName)
303
- if entryType == Int32 ( DT_DIR) {
303
+ if entryType == DT_DIR {
304
304
let subPath : String = path + " / " + entryName
305
305
let entries = try subpathsOfDirectory ( atPath: subPath)
306
306
contents. append ( contentsOf: entries. map ( { file in " \( entryName) / \( file) " } ) )
@@ -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,6 +503,7 @@ open class FileManager : NSObject {
503
503
let buffer = UnsafeMutablePointer< UInt8> . allocate( capacity: Int ( fileInfo. st_blksize) )
504
504
defer { buffer. deallocate ( ) }
505
505
506
+ // Casted to Int64 because fileInfo.st_size is 64 bits long even on 32 bit platforms
506
507
var bytesRemaining = Int64 ( fileInfo. st_size)
507
508
while bytesRemaining > 0 {
508
509
let bytesToRead = min ( bytesRemaining, Int64 ( fileInfo. st_blksize) )
@@ -696,8 +697,7 @@ open class FileManager : NSObject {
696
697
let length = Int ( PATH_MAX) + 1
697
698
var buf = [ Int8] ( repeating: 0 , count: length)
698
699
getcwd ( & buf, length)
699
- let result = self . string ( withFileSystemRepresentation: buf, length: Int ( strlen ( buf) ) )
700
- return result
700
+ return string ( withFileSystemRepresentation: buf, length: Int ( strlen ( buf) ) )
701
701
}
702
702
703
703
@discardableResult
@@ -798,8 +798,8 @@ open class FileManager : NSObject {
798
798
799
799
private func _compareSymlinks( withFileSystemRepresentation file1Rep: UnsafePointer < Int8 > , andFileSystemRepresentation file2Rep: UnsafePointer < Int8 > , size: Int64 ) -> Bool {
800
800
let bufSize = Int ( size)
801
- let buffer1 = UnsafeMutablePointer< CChar> . allocate( capacity: Int ( bufSize) )
802
- let buffer2 = UnsafeMutablePointer< CChar> . allocate( capacity: Int ( bufSize) )
801
+ let buffer1 = UnsafeMutablePointer< CChar> . allocate( capacity: bufSize)
802
+ let buffer2 = UnsafeMutablePointer< CChar> . allocate( capacity: bufSize)
803
803
804
804
let size1 = readlink ( file1Rep, buffer1, bufSize)
805
805
let size2 = readlink ( file2Rep, buffer2, bufSize)
0 commit comments