Skip to content

Commit

Permalink
Updating ascii parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielHernandez26 committed Dec 16, 2024
1 parent 251e44b commit db5735b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Sources/XCLogParser/loglocation/LogLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ public struct LogLoader {
do {
let data = try Data(contentsOf: url)
let unzipped = try data.gunzipped()
guard let contents = String(data: unzipped, encoding: .ascii) else {
let string: String? = unzipped.withUnsafeBytes { pointer in
guard let charPointer = pointer
.assumingMemoryBound(to: CChar.self)
.baseAddress
else {
return nil
}

Check failure on line 36 in Sources/XCLogParser/loglocation/LogLoader.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
return String(cString: charPointer, encoding: .ascii)
}

Check failure on line 39 in Sources/XCLogParser/loglocation/LogLoader.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
guard let contents = string else {
throw LogError.readingFile(url.path)
}
return contents
Expand Down

0 comments on commit db5735b

Please sign in to comment.