17 FILE* file = fopen(filename,
"rb");
19 fprintf(stderr,
"Failed to open: %s\n", filename);
22 (
void)fseek(file, 0, SEEK_END);
23 size_t file_length = ftell(file);
27 (
void)fseek(file, 0, SEEK_SET);
28 std::vector<uint8_t> buffer(file_length);
29 size_t bytes_read = fread(buffer.data(), 1, file_length, file);
31 if (bytes_read != file_length) {
32 fprintf(stderr,
"Failed to read: %s\n", filename);
38FileAccessForTesting::FileAccessForTesting(
const std::string& file_name) {
39 std::string file_path = PathService::GetTestFilePath(file_name);
40 if (file_path.empty()) {
44 file_contents_ = GetFileContents(file_path.c_str());
45 if (file_contents_.empty()) {
49 m_FileLen = pdfium::base::checked_cast<
unsigned long>(file_contents_.size());
50 m_GetBlock = SGetBlock;