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

Method Load

src/creatorpacket.cpp:63–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61// Load the packet from disk.
62
63bool CreatorPacket::Load(DiskFile *diskfile, u64 offset, PACKET_HEADER &header)
64{
65 // Is the packet long enough
66 if (header.length <= sizeof(CREATORPACKET))
67 {
68 return false;
69 }
70
71 // Is the packet too large (what is the longest reasonable creator description)
72 if (header.length - sizeof(CREATORPACKET) > 100000)
73 {
74 return false;
75 }
76
77 // Allocate the packet (with a little extra so we will have NULLs after the description)
78 CREATORPACKET *packet = (CREATORPACKET *)AllocatePacket((size_t)header.length, 4);
79 packet->header = header;
80
81 // Load the rest of the packet from disk
82 return diskfile->Read(offset + sizeof(PACKET_HEADER),
83 packet->client,
84 (size_t)packet->header.length - sizeof(PACKET_HEADER));
85}

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.80

Tested by

no test coverage detected