File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed
Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ extension _FileIOProtocol {
238238 }
239239}
240240
241+ #if false
241242extension _FileIOProtocol {
242243 @_disfavoredOverload
243244 @inline ( __always)
@@ -274,8 +275,38 @@ extension _FileIOProtocol {
274275 return String ( cString: data)
275276 }
276277}
278+ #endif
279+
280+ extension MemoryMappedFileIOProtocol {
281+ @inline ( __always)
282+ func readString(
283+ offset: UInt64
284+ ) -> String ? {
285+ String (
286+ cString: ptr
287+ . advanced ( by: numericCast ( offset) )
288+ . assumingMemoryBound ( to: CChar . self)
289+ )
290+ }
291+
292+ @inline ( __always)
293+ func readString(
294+ offset: UInt64 ,
295+ size: Int // ignored
296+ ) -> String ? {
297+ readString ( offset: offset)
298+ }
299+
300+ @inline ( __always)
301+ func readString(
302+ offset: UInt64 ,
303+ step: Int = 10 // ignored
304+ ) -> String ? {
305+ readString ( offset: offset)
306+ }
307+ }
277308
278- extension MemoryMappedFile {
309+ extension MemoryMappedFile . FileSlice {
279310 @inline ( __always)
280311 func readString(
281312 offset: UInt64
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ extension DyldCacheMappingAndSlideInfo {
8787}
8888
8989extension DyldCacheMappingAndSlideInfo {
90- private func _slideInfo< File: FileIOProtocol > (
90+ private func _slideInfo< File: MemoryMappedFileIOProtocol > (
9191 version: DyldCacheSlideInfo . Version ,
9292 fileHandle: File
9393 ) -> DyldCacheSlideInfo ? {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ internal protocol _DyldCacheFileRepresentable: DyldCacheRepresentable
1717where DylibsTrie == DataTrieTree < DylibsTrieNodeContent > ,
1818 ProgramsTrie == DataTrieTree < ProgramsTrieNodeContent >
1919{
20- associatedtype File : FileIOProtocol
20+ associatedtype File : MemoryMappedFileIOProtocol
2121 var fileHandle : File { get }
2222
2323 func machOFiles( ) -> AnySequence < MachOFile >
You can’t perform that action at this time.
0 commit comments