summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/fpdf_parser_utility.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-07-25 20:57:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-25 20:57:25 +0000
commita35063cb627d611e77816216d0d8946794a98079 (patch)
tree458125d329ef663797001d78a9181429085ec9b5 /core/fpdfapi/parser/fpdf_parser_utility.h
parent35b51e95b9a4d0c064efd905e946a554d6f47890 (diff)
downloadpdfium-a35063cb627d611e77816216d0d8946794a98079.tar.xz
Change GetHeaderOffset() to return Optional<FX_FILESIZE>.
Remove |kInvalidHeaderOffset|. Change-Id: I5978e745e97aa4e13299dd21028721725ac0c996 Reviewed-on: https://pdfium-review.googlesource.com/38853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/parser/fpdf_parser_utility.h')
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h
index 7529fbc484..5fe9b5d4a9 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.h
+++ b/core/fpdfapi/parser/fpdf_parser_utility.h
@@ -11,10 +11,11 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/retain_ptr.h"
+#include "third_party/base/optional.h"
-class IFX_SeekableReadStream;
class CPDF_Dictionary;
class CPDF_Object;
+class IFX_SeekableReadStream;
// Use the accessors below instead of directly accessing PDF_CharType.
extern const char PDF_CharType[256];
@@ -36,12 +37,11 @@ inline bool PDFCharIsLineEnding(uint8_t c) {
return c == '\r' || c == '\n';
}
-constexpr int32_t kInvalidHeaderOffset = -1;
-
-// On success, return a positive offset value to the PDF header.. If the header
+// On success, return a positive offset value to the PDF header. If the header
// cannot be found, or if there is an error reading from |pFile|, then return
-// |kInvalidHeaderOffset|.
-int32_t GetHeaderOffset(const RetainPtr<IFX_SeekableReadStream>& pFile);
+// nullopt.
+Optional<FX_FILESIZE> GetHeaderOffset(
+ const RetainPtr<IFX_SeekableReadStream>& pFile);
int32_t GetDirectInteger(const CPDF_Dictionary* pDict, const ByteString& key);