| 34 | } |
| 35 | |
| 36 | unsigned 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 | } |
no test coverage detected