MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / crc32File

Function crc32File

source/util/crc.cpp:36–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36unsigned int crc32File(BString filePath) {
37 PLATFORM_STAT_STRUCT buf;
38 if (PLATFORM_STAT(filePath.c_str(), &buf) == 0 && buf.st_size) {
39 BReadFile f(filePath);
40 if (f.isOpen()) {
41 unsigned char* buffer = new unsigned char[(int)buf.st_size];
42 if ((U64)f.read(buffer, buf.st_size) == (U64)buf.st_size) {
43 unsigned int result = crc32b(buffer, (int)buf.st_size);
44 delete[] buffer;
45 return result;
46 }
47 delete[] buffer;
48 }
49 }
50 return 0;
51}

Callers 1

updateFileListMethod · 0.85

Calls 4

crc32bFunction · 0.85
c_strMethod · 0.45
isOpenMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected