From 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 21 May 2023 13:35:09 -0400 Subject: Rerun clang-format --- libqpdf/QPDFParser.cc | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'libqpdf/QPDFParser.cc') diff --git a/libqpdf/QPDFParser.cc b/libqpdf/QPDFParser.cc index e56fcce3..5d695897 100644 --- a/libqpdf/QPDFParser.cc +++ b/libqpdf/QPDFParser.cc @@ -140,9 +140,8 @@ QPDFParser::parse(bool& empty, bool content_stream) } else { state = st_start; state_stack.push_back( - (tokenizer.getType() == QPDFTokenizer::tt_array_open) - ? st_array - : st_dictionary); + (tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array + : st_dictionary); b_contents = false; stack.push_back(StackFrame(input)); } @@ -187,18 +186,15 @@ QPDFParser::parse(bool& empty, bool content_stream) if (content_stream) { object = QPDF_Operator::create(value); } else if ( - value == "R" && state != st_top && size >= 2 && - olist.back() && + value == "R" && state != st_top && size >= 2 && olist.back() && olist.back()->getTypeCode() == ::ot_integer && - !olist.back()->getObjGen().isIndirect() && - olist.at(size - 2) && + !olist.back()->getObjGen().isIndirect() && olist.at(size - 2) && olist.at(size - 2)->getTypeCode() == ::ot_integer && !olist.at(size - 2)->getObjGen().isIndirect()) { if (context == nullptr) { QTC::TC("qpdf", "QPDFParser indirect without context"); - throw std::logic_error( - "QPDFObjectHandle::parse called without context" - " on an object with indirect references"); + throw std::logic_error("QPDFObjectHandle::parse called without context" + " on an object with indirect references"); } auto ref_og = QPDFObjGen( QPDFObjectHandle(olist.at(size - 2)).getIntValueAsInt(), @@ -262,8 +258,7 @@ QPDFParser::parse(bool& empty, bool content_stream) } if (object == nullptr && !is_null && - (!((state == st_start) || (state == st_stop) || - (state == st_eof)))) { + (!((state == st_start) || (state == st_stop) || (state == st_eof)))) { throw std::logic_error("QPDFObjectHandle::parseInternal: " "unexpected uninitialized object"); is_null = true; @@ -321,15 +316,13 @@ QPDFParser::parse(bool& empty, bool content_stream) case st_stop: if ((state_stack.size() < 2) || (stack.size() < 2)) { - throw std::logic_error( - "QPDFObjectHandle::parseInternal: st_stop encountered" - " with insufficient elements in stack"); + throw std::logic_error("QPDFObjectHandle::parseInternal: st_stop encountered" + " with insufficient elements in stack"); } parser_state_e old_state = state_stack.back(); state_stack.pop_back(); if (old_state == st_array) { - object = QPDF_Array::create( - std::move(olist), frame.null_count > 100); + object = QPDF_Array::create(std::move(olist), frame.null_count > 100); setDescription(object, offset - 1); // The `offset` points to the next of "[". Set the rewind // offset to point to the beginning of "[". This has been @@ -361,10 +354,7 @@ QPDFParser::parse(bool& empty, bool content_stream) for (bool found_fake = false; !found_fake;) { key = "/QPDFFake" + std::to_string(next_fake_key++); found_fake = (names.count(key) == 0); - QTC::TC( - "qpdf", - "QPDFParser found fake", - (found_fake ? 0 : 1)); + QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1)); } warn( offset, @@ -398,11 +388,9 @@ QPDFParser::parse(bool& empty, bool content_stream) dict[std::move(key)] = std::move(val); } if (!frame.contents_string.empty() && dict.count("/Type") && - dict["/Type"].isNameAndEquals("/Sig") && - dict.count("/ByteRange") && dict.count("/Contents") && - dict["/Contents"].isString()) { - dict["/Contents"] = - QPDFObjectHandle::newString(frame.contents_string); + dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") && + dict.count("/Contents") && dict["/Contents"].isString()) { + dict["/Contents"] = QPDFObjectHandle::newString(frame.contents_string); dict["/Contents"].setParsedOffset(frame.contents_offset); } object = QPDF_Dictionary::create(std::move(dict)); @@ -433,8 +421,7 @@ QPDFParser::parse(bool& empty, bool content_stream) } void -QPDFParser::setDescription( - std::shared_ptr& obj, qpdf_offset_t parsed_offset) +QPDFParser::setDescription(std::shared_ptr& obj, qpdf_offset_t parsed_offset) { if (obj) { obj->setDescription(context, description, parsed_offset); @@ -458,8 +445,7 @@ QPDFParser::warn(QPDFExc const& e) const void QPDFParser::warn(qpdf_offset_t offset, std::string const& msg) const { - warn(QPDFExc( - qpdf_e_damaged_pdf, input->getName(), object_description, offset, msg)); + warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, offset, msg)); } void -- cgit v1.2.3-54-g00ecf