From b8eb63b834eb45559fc919d9fa061fc5e1c5bede Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sun, 6 Aug 2017 18:17:43 +0300 Subject: [PATCH] Minor code improvements. --- Sources/7zFileInfo.swift | 5 ++++- Tests/7zTests.swift | 13 ++++++------- Tests/TarTests.swift | 2 +- Tests/ZipTests.swift | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Sources/7zFileInfo.swift b/Sources/7zFileInfo.swift index 1a920472..2748a0c8 100644 --- a/Sources/7zFileInfo.swift +++ b/Sources/7zFileInfo.swift @@ -60,7 +60,10 @@ class SevenZipFileInfo { let names = bitReader.bytes(count: propertySize - 1) var nextFile = 0 var nextName = 0 - for i in stride(from: 0, to: names.count, by: 2) { // TODO: Understand what is going on here. + for i in stride(from: 0, to: names.count, by: 2) { + // End of file name is identified by two consequent NULL bytes. + // TODO: In Swift 4.0 we may try to convert dat to UTF16LE first, + // and then split it into strings? if names[i] == 0 && names[i + 1] == 0 { files[nextFile].name = String(data: Data(bytes: names[nextName..