MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / BodyReader

Class BodyReader

3ds/source/transfer.cpp:214–230  ·  view source on GitHub ↗

ByteReader over the streamed body, positioned at the file part's start. TransferProto::extractZip owns the length accounting.

Source from the content-addressed store, hash-verified

212 // ByteReader over the streamed body, positioned at the file part's start.
213 // TransferProto::extractZip owns the length accounting.
214 struct BodyReader : TransferProto::ByteReader {
215 FSStream input;
216 explicit BodyReader(const std::u16string& path, u64 startOffset) : input(Archive::sdmc(), path, FS_OPEN_READ)
217 {
218 if (input.good()) {
219 input.offset((u32)startOffset);
220 }
221 }
222 bool good() { return input.good(); }
223 ~BodyReader() override
224 {
225 if (input.good()) {
226 input.close();
227 }
228 }
229 size_t read(void* dst, size_t n) override { return input.good() ? input.read(dst, (u32)n) : 0; }
230 };
231
232 // ExtractSink writing under a u16string destination root via FSStream.
233 struct FsExtractSink : TransferProto::ExtractSink {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected