Fixed a mistake with length of fileComment.

This commit is contained in:
Timofey Solomko
2017-05-09 21:07:50 +03:00
parent b99f7101ac
commit dffceccb84
+10 -2
View File
@@ -58,7 +58,7 @@ public class ZipEntry: ContainerEntry {
private var pointerData: DataWithPointer
/// Name of the file or directory.
public var name: String? {
public var name: String {
return self.cdEntry.fileName
}
@@ -72,6 +72,14 @@ public class ZipEntry: ContainerEntry {
return self.cdEntry.externalFileAttributes
}
public var size: Int {
return Int(truncatingBitPattern: cdEntry.uncompSize)
}
public var isDirectory: Bool {
return false // TODO: Implement.
}
/**
Returns data associated with this entry.
@@ -396,7 +404,7 @@ struct CentralDirectoryEntry {
}
}
guard let fileComment = String(data: Data(bytes: pointerData.alignedBytes(count: fileNameLength)),
guard let fileComment = String(data: Data(bytes: pointerData.alignedBytes(count: fileCommentLength)),
encoding: .utf8)
else { throw ZipError.wrongTextField }
self.fileComment = fileComment