Skip to content

Commit

Permalink
Faster processing of direct file reading
Browse files Browse the repository at this point in the history
  • Loading branch information
sincos2854 committed Jun 6, 2024
1 parent e5fc8d2 commit 6bca427
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spi00in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int ReadDataFromFile(LPCWSTR file_name, LONG_PTR macbin_offset, std::unique_ptr<
return SPI_FILE_READ_ERROR;
}

file_data = std::make_unique<BYTE[]>(file_size);
file_data = std::make_unique_for_overwrite<BYTE[]>(file_size);

size_t remain = file_size, offset = 0;
DWORD to_read = 0, read = 0;
Expand Down Expand Up @@ -166,7 +166,7 @@ int __stdcall IsSupportedW(LPCWSTR filename, DWORD_PTR dw)

if ((dw & 0xFFFF0000) == 0)
{
buf = std::make_unique<BYTE[]>(BUF_SIZE_HEADER);
buf = std::make_unique_for_overwrite<BYTE[]>(BUF_SIZE_HEADER);
if (!ReadFile(reinterpret_cast<HANDLE>(dw), buf.get(), BUF_SIZE_HEADER, &read_size, NULL))
{
return 0;
Expand Down

0 comments on commit 6bca427

Please sign in to comment.