Add some comments and remove leftover WIP noise.

This commit is contained in:
Stephen Canon committed 2024-07-17 12:49:37 -04:00
1 parent c64775ef71
commit 3b43b391b5
2 files changed
+10 -9

No files matched your search

+5 -9
View File
@@ -59,15 +59,6 @@ public struct FilePath: Sendable {
}
}
/*
extension FilePath: Hashable, Codable {
precondition(_hasRoot == (self.root != nil))
}
}
*/
@available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *)
extension FilePath {
/// The length of the file path, excluding the null terminator.
@@ -76,6 +67,11 @@ extension FilePath {
@available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *)
extension FilePath: Hashable, Codable {
// Encoder is synthesized; it probably should have been explicit and used
// a single-value container, but making that change now is somewhat risky.
// Decoder is written explicitly to ensure that we validate invariants on
// untrusted input.
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self._storage = try container.decode(SystemString.self, forKey: ._storage)
+5
View File
@@ -174,6 +174,11 @@ extension SystemString: RangeReplaceableCollection {
}
extension SystemString: Hashable, Codable {
// Encoder is synthesized; it probably should have been explicit and used
// a single-value container, but making that change now is somewhat risky.
// Decoder is written explicitly to ensure that we validate invariants on
// untrusted input.
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.nullTerminatedStorage = try container.decode(