MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CalculateDataCRC

Function CalculateDataCRC

engine/Poseidon/Network/IntegrityCheck.cpp:47–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47unsigned int CalculateDataCRC(const char* path, int offset, int size)
48{
49 // reject files not inside current directory
50 if (!IsRelativePath(path))
51 {
52 return 0;
53 }
54 QIFStreamB in;
55 in.AutoOpen(path);
56 if (in.fail())
57 {
58 return 0;
59 }
60 int endCheck = offset + size;
61 saturate(offset, 0, in.rest());
62 saturate(endCheck, offset, in.rest());
63
64 Poseidon::Foundation::CRCCalculator crc;
65 crc.Reset();
66 crc.Add(in.act() + offset, endCheck - offset);
67 return crc.GetResult();
68}

Callers 1

IntegrityCheckAnswerFunction · 0.85

Calls 9

IsRelativePathFunction · 0.85
saturateFunction · 0.85
AutoOpenMethod · 0.80
restMethod · 0.80
actMethod · 0.80
failMethod · 0.45
ResetMethod · 0.45
AddMethod · 0.45
GetResultMethod · 0.45

Tested by

no test coverage detected