| Index: core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
|
| diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
|
| index a4cc85ae7da5da65471c117a3ee6a692cea4295a..caffb6861b0c4aaa75291e5ea0131e1203c0cc89 100644
|
| --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
|
| +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
|
| @@ -69,20 +69,14 @@ const char PDF_CharType[256] = {
|
| 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'};
|
|
|
| int32_t GetHeaderOffset(IFX_FileRead* pFile) {
|
| - // TODO(dsinclair): This is a complicated way of saying %PDF, simplify?
|
| - const FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025);
|
| -
|
| const size_t kBufSize = 4;
|
| uint8_t buf[kBufSize];
|
| - int32_t offset = 0;
|
| - while (offset <= 1024) {
|
| + for (int32_t offset = 0; offset <= 1024; ++offset) {
|
| if (!pFile->ReadBlock(buf, offset, kBufSize))
|
| return -1;
|
|
|
| - if (*(FX_DWORD*)buf == tag)
|
| + if (memcmp(buf, "%PDF", 4) == 0)
|
| return offset;
|
| -
|
| - ++offset;
|
| }
|
| return -1;
|
| }
|
|
|