diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 2a112166..242e0fb2 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -2312,70 +2312,6 @@ QPDFObjectHandle::shallowCopyInternal2(QPDFObjectHandle& new_obj) throw std::runtime_error("attempt to make a shallow copy of a stream"); } new_obj = QPDFObjectHandle(obj->copy(true)); - - std::set<QPDFObjGen> visited; - new_obj.copyObject2(visited); -} - -void -QPDFObjectHandle::copyObject2(std::set<QPDFObjGen>& visited) -{ - assertInitialized(); - - if (isStream()) { - // same as obj->copy(true) - throw std::runtime_error( - "attempt to make a stream into a direct object"); - } - - auto cur_og = getObjGen(); - if (cur_og.getObj() != 0) { - if (visited.count(cur_og)) { - throw std::runtime_error( - "loop detected while converting object from " - "indirect to direct"); - } - visited.insert(cur_og); - } - - if (isReserved()) { - // same as obj->copy(true) - throw std::logic_error("QPDFObjectHandle: attempting to make a" - " reserved object handle direct"); - } - - std::shared_ptr<QPDFObject> new_obj; - - if (isBool() || isInteger() || isName() || isNull() || isReal() || - isString()) { - new_obj = obj->copy(true); - } else if (isArray()) { - // same as obj->copy(true) - std::vector<QPDFObjectHandle> items; - auto array = asArray(); - int n = array->getNItems(); - for (int i = 0; i < n; ++i) { - items.push_back(array->getItem(i)); - } - new_obj = QPDF_Array::create(items); - } else if (isDictionary()) { - // same as obj->copy(true) - std::map<std::string, QPDFObjectHandle> items; - auto dict = asDictionary(); - for (auto const& key: getKeys()) { - items[key] = dict->getKey(key); - } - new_obj = QPDF_Dictionary::create(items); - } else { - throw std::logic_error("QPDFObjectHandle::makeDirectInternal: " - "unknown object type"); - } - - this->obj = new_obj; - - if (cur_og.getObj()) { - visited.erase(cur_og); - } } void |