MCPcopy Create free account
hub / github.com/Parchive/par2cmdline / Load

Method Load

src/recoverypacket.cpp:108–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106// is recovered in the DataBlock object.
107
108bool RecoveryPacket::Load(DiskFile *_diskfile,
109 u64 _offset,
110 PACKET_HEADER &_header)
111{
112 diskfile = _diskfile;
113 offset = _offset;
114
115 // Is the packet actually large enough
116 if (_header.length <= sizeof(packet))
117 {
118 return false;
119 }
120
121 // Save the fixed header
122 packet.header = _header;
123
124 // Set the data block to immediately follow the header on disk
125 datablock.SetLocation(diskfile, offset + sizeof(packet));
126 datablock.SetLength(packet.header.length - sizeof(packet));
127
128 // Read the rest of the packet header
129 return diskfile->Read(offset + sizeof(packet.header), &packet.exponent, sizeof(packet)-sizeof(packet.header));
130}

Callers

nothing calls this directly

Calls 3

SetLocationMethod · 0.80
SetLengthMethod · 0.80
ReadMethod · 0.80

Tested by

no test coverage detected