summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2018-06-06 16:30:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-06 16:30:24 +0000
commitce4b14ef28ea4c78fe07f271c7185fe9766f7c55 (patch)
tree7861a77583cc957e7c6dbc0d749d4c6df85487ad /core/fpdfapi/parser/cpdf_parser.cpp
parent8ae320912348c162d2b90f1dc7b7528999bbb305 (diff)
downloadpdfium-ce4b14ef28ea4c78fe07f271c7185fe9766f7c55.tar.xz
Simplify check info availability.
Change-Id: I4475b83f69426b135c304d5861f0b7bb582deb81 Reviewed-on: https://pdfium-review.googlesource.com/17731 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index ba993c2e3c..73b4bcdc0c 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -69,7 +69,7 @@ class CPDF_Parser::TrailerData {
// Info is optional.
uint32_t info_obj_num = GetInfoObjNum();
- if (info_obj_num > 0)
+ if (info_obj_num != CPDF_Object::kInvalidObjNum)
result->SetNewFor<CPDF_Reference>("Info", nullptr, GetInfoObjNum());
// Root is required.
@@ -90,8 +90,8 @@ class CPDF_Parser::TrailerData {
void Clear() {
main_trailer_.reset();
- last_info_obj_num_ = 0;
- last_root_obj_num_ = 0;
+ last_info_obj_num_ = CPDF_Object::kInvalidObjNum;
+ last_root_obj_num_ = CPDF_Object::kInvalidObjNum;
}
uint32_t GetInfoObjNum() const {
@@ -120,8 +120,8 @@ class CPDF_Parser::TrailerData {
}
std::unique_ptr<CPDF_Dictionary> main_trailer_;
- uint32_t last_info_obj_num_ = 0;
- uint32_t last_root_obj_num_ = 0;
+ uint32_t last_info_obj_num_ = CPDF_Object::kInvalidObjNum;
+ uint32_t last_root_obj_num_ = CPDF_Object::kInvalidObjNum;
};
CPDF_Parser::CPDF_Parser()
@@ -286,9 +286,9 @@ CPDF_Parser::Error CPDF_Parser::StartParseInternal(CPDF_Document* pDocument) {
if (!m_pDocument->GetRoot())
return FORMAT_ERROR;
}
- if (GetRootObjNum() == 0) {
+ if (GetRootObjNum() == CPDF_Object::kInvalidObjNum) {
ReleaseEncryptHandler();
- if (!RebuildCrossRef() || GetRootObjNum() == 0)
+ if (!RebuildCrossRef() || GetRootObjNum() == CPDF_Object::kInvalidObjNum)
return FORMAT_ERROR;
eRet = SetEncryptHandler();
@@ -1389,9 +1389,9 @@ CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
return FORMAT_ERROR;
}
- if (GetRootObjNum() == 0) {
+ if (GetRootObjNum() == CPDF_Object::kInvalidObjNum) {
ReleaseEncryptHandler();
- if (!RebuildCrossRef() || GetRootObjNum() == 0)
+ if (!RebuildCrossRef() || GetRootObjNum() == CPDF_Object::kInvalidObjNum)
return FORMAT_ERROR;
eRet = SetEncryptHandler();