| 299 | } |
| 300 | |
| 301 | bool IsEqualFiles(string const & firstFile, string const & secondFile) |
| 302 | { |
| 303 | FileData first(firstFile, FileData::Op::READ); |
| 304 | FileData second(secondFile, FileData::Op::READ); |
| 305 | if (first.Size() != second.Size()) |
| 306 | return false; |
| 307 | |
| 308 | size_t constexpr bufSize = READ_FILE_BUFFER_SIZE; |
| 309 | vector<char> buf1, buf2; |
| 310 | buf1.resize(bufSize); |
| 311 | buf2.resize(bufSize); |
| 312 | size_t const fileSize = static_cast<size_t>(first.Size()); |
| 313 | size_t currSize = 0; |
| 314 | |
| 315 | while (currSize < fileSize) |
| 316 | { |
| 317 | size_t const toRead = min(bufSize, fileSize - currSize); |
| 318 | |
| 319 | first.Read(currSize, &buf1[0], toRead); |
| 320 | second.Read(currSize, &buf2[0], toRead); |
| 321 | |
| 322 | if (buf1 != buf2) |
| 323 | return false; |
| 324 | |
| 325 | currSize += toRead; |
| 326 | } |
| 327 | |
| 328 | return true; |
| 329 | } |
| 330 | |
| 331 | std::vector<uint8_t> ReadFile(std::string const & filePath) |
| 332 | { |