2012-06-21 18:35:02 +00:00
|
|
|
// See the "Optimization" section of the manual.
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
#include <qpdf/QPDF.hh>
|
|
|
|
|
|
|
|
#include <qpdf/QTC.hh>
|
|
|
|
#include <qpdf/QPDFExc.hh>
|
|
|
|
#include <qpdf/QPDF_Dictionary.hh>
|
|
|
|
#include <qpdf/QPDF_Array.hh>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
QPDF::ObjUser::ObjUser() :
|
|
|
|
ou_type(ou_bad),
|
|
|
|
pageno(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QPDF::ObjUser::ObjUser(user_e type) :
|
|
|
|
ou_type(type),
|
|
|
|
pageno(0)
|
|
|
|
{
|
|
|
|
assert(type == ou_root);
|
|
|
|
}
|
|
|
|
|
|
|
|
QPDF::ObjUser::ObjUser(user_e type, int pageno) :
|
|
|
|
ou_type(type),
|
|
|
|
pageno(pageno)
|
|
|
|
{
|
|
|
|
assert((type == ou_page) || (type == ou_thumb));
|
|
|
|
}
|
|
|
|
|
|
|
|
QPDF::ObjUser::ObjUser(user_e type, std::string const& key) :
|
|
|
|
ou_type(type),
|
|
|
|
pageno(0),
|
|
|
|
key(key)
|
|
|
|
{
|
|
|
|
assert((type == ou_trailer_key) || (type == ou_root_key));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
QPDF::ObjUser::operator<(ObjUser const& rhs) const
|
|
|
|
{
|
|
|
|
if (this->ou_type < rhs.ou_type)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (this->ou_type == rhs.ou_type)
|
|
|
|
{
|
|
|
|
if (this->pageno < rhs.pageno)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (this->pageno == rhs.pageno)
|
|
|
|
{
|
|
|
|
return (this->key < rhs.key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
QPDF::optimize(std::map<int, int> const& object_stream_data,
|
|
|
|
bool allow_changes)
|
|
|
|
{
|
|
|
|
if (! this->obj_user_to_objects.empty())
|
|
|
|
{
|
|
|
|
// already optimized
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-15 01:35:10 +00:00
|
|
|
// The PDF specification indicates that /Outlines is supposed to
|
|
|
|
// be an indirect reference. Force it to be so if it exists and
|
|
|
|
// is direct. (This has been seen in the wild.)
|
|
|
|
QPDFObjectHandle root = getRoot();
|
|
|
|
if (root.getKey("/Outlines").isDictionary())
|
|
|
|
{
|
|
|
|
QPDFObjectHandle outlines = root.getKey("/Outlines");
|
|
|
|
if (! outlines.isIndirect())
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF_optimization indirect outlines");
|
|
|
|
root.replaceKey("/Outlines", makeIndirectObject(outlines));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
// Traverse pages tree pushing all inherited resources down to the
|
2012-06-22 16:11:25 +00:00
|
|
|
// page level. This also initializes this->all_pages.
|
2012-06-22 16:52:13 +00:00
|
|
|
pushInheritedAttributesToPage(allow_changes, false);
|
2012-06-22 15:50:02 +00:00
|
|
|
|
|
|
|
// Traverse pages
|
2013-02-24 02:46:21 +00:00
|
|
|
int n = this->all_pages.size();
|
2012-06-22 15:50:02 +00:00
|
|
|
for (int pageno = 0; pageno < n; ++pageno)
|
|
|
|
{
|
|
|
|
updateObjectMaps(ObjUser(ObjUser::ou_page, pageno),
|
|
|
|
this->all_pages[pageno]);
|
|
|
|
}
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
// Traverse document-level items
|
|
|
|
std::set<std::string> keys = this->trailer.getKeys();
|
|
|
|
for (std::set<std::string>::iterator iter = keys.begin();
|
|
|
|
iter != keys.end(); ++iter)
|
|
|
|
{
|
|
|
|
std::string const& key = *iter;
|
|
|
|
if (key == "/Root")
|
|
|
|
{
|
|
|
|
// handled separately
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateObjectMaps(ObjUser(ObjUser::ou_trailer_key, key),
|
|
|
|
this->trailer.getKey(key));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
keys = root.getKeys();
|
|
|
|
for (std::set<std::string>::iterator iter = keys.begin();
|
|
|
|
iter != keys.end(); ++iter)
|
|
|
|
{
|
|
|
|
// Technically, /I keys from /Thread dictionaries are supposed
|
|
|
|
// to be handled separately, but we are going to disregard
|
|
|
|
// that specification for now. There is loads of evidence
|
|
|
|
// that pdlin and Acrobat both disregard things like this from
|
|
|
|
// time to time, so this is almost certain not to cause any
|
|
|
|
// problems.
|
|
|
|
|
|
|
|
std::string const& key = *iter;
|
|
|
|
updateObjectMaps(ObjUser(ObjUser::ou_root_key, key),
|
|
|
|
root.getKey(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjUser root_ou = ObjUser(ObjUser::ou_root);
|
2013-06-14 15:58:37 +00:00
|
|
|
QPDFObjGen root_og = QPDFObjGen(root.getObjGen());
|
2008-04-29 12:55:25 +00:00
|
|
|
obj_user_to_objects[root_ou].insert(root_og);
|
|
|
|
object_to_obj_users[root_og].insert(root_ou);
|
|
|
|
|
|
|
|
filterCompressedObjects(object_stream_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-22 15:50:02 +00:00
|
|
|
QPDF::pushInheritedAttributesToPage()
|
|
|
|
{
|
|
|
|
// Public API should not have access to allow_changes.
|
2012-06-22 16:52:13 +00:00
|
|
|
pushInheritedAttributesToPage(true, false);
|
2012-06-22 15:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-22 16:52:13 +00:00
|
|
|
QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
|
2012-06-21 13:12:51 +00:00
|
|
|
{
|
|
|
|
// Traverse pages tree pushing all inherited resources down to the
|
|
|
|
// page level.
|
|
|
|
|
2012-07-11 19:29:41 +00:00
|
|
|
// The record of whether we've done this is cleared by
|
|
|
|
// updateAllPagesCache(). If we're warning for skipped keys,
|
|
|
|
// re-traverse unconditionally.
|
|
|
|
if (this->pushed_inherited_attributes_to_pages && (! warn_skipped_keys))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-21 13:12:51 +00:00
|
|
|
// key_ancestors is a mapping of page attribute keys to a stack of
|
2012-06-22 15:50:02 +00:00
|
|
|
// Pages nodes that contain values for them.
|
2012-06-21 13:12:51 +00:00
|
|
|
std::map<std::string, std::vector<QPDFObjectHandle> > key_ancestors;
|
2012-06-22 16:11:25 +00:00
|
|
|
this->all_pages.clear();
|
2012-06-22 15:50:02 +00:00
|
|
|
pushInheritedAttributesToPageInternal(
|
|
|
|
this->trailer.getKey("/Root").getKey("/Pages"),
|
2012-06-22 16:11:25 +00:00
|
|
|
key_ancestors, this->all_pages, allow_changes, warn_skipped_keys);
|
2012-06-21 13:12:51 +00:00
|
|
|
assert(key_ancestors.empty());
|
2012-07-11 19:29:41 +00:00
|
|
|
this->pushed_inherited_attributes_to_pages = true;
|
2012-06-21 13:12:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-22 15:50:02 +00:00
|
|
|
QPDF::pushInheritedAttributesToPageInternal(
|
2008-04-29 12:55:25 +00:00
|
|
|
QPDFObjectHandle cur_pages,
|
|
|
|
std::map<std::string, std::vector<QPDFObjectHandle> >& key_ancestors,
|
2012-06-22 16:11:25 +00:00
|
|
|
std::vector<QPDFObjectHandle>& pages,
|
2012-06-22 16:52:13 +00:00
|
|
|
bool allow_changes, bool warn_skipped_keys)
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
// Extract the underlying dictionary object
|
|
|
|
std::string type = cur_pages.getKey("/Type").getName();
|
|
|
|
|
|
|
|
if (type == "/Pages")
|
|
|
|
{
|
|
|
|
// Make a list of inheritable keys. Any key other than /Type,
|
|
|
|
// /Parent, Kids, or /Count is an inheritable attribute. Push
|
|
|
|
// this object onto the stack of pages nodes that have values
|
|
|
|
// for this attribute.
|
|
|
|
|
|
|
|
std::set<std::string> inheritable_keys;
|
|
|
|
std::set<std::string> keys = cur_pages.getKeys();
|
|
|
|
for (std::set<std::string>::iterator iter = keys.begin();
|
|
|
|
iter != keys.end(); ++iter)
|
|
|
|
{
|
|
|
|
std::string const& key = *iter;
|
2012-06-22 16:52:13 +00:00
|
|
|
if ( (key == "/MediaBox") || (key == "/CropBox") ||
|
|
|
|
(key == "/Resources") || (key == "/Rotate") )
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
if (! allow_changes)
|
|
|
|
{
|
2010-09-24 19:10:08 +00:00
|
|
|
throw QPDFExc(qpdf_e_internal, this->file->getName(),
|
2009-10-19 23:09:19 +00:00
|
|
|
this->last_object_description,
|
2010-09-24 19:10:08 +00:00
|
|
|
this->file->getLastOffset(),
|
2009-10-19 23:09:19 +00:00
|
|
|
"optimize detected an "
|
2012-06-22 16:52:13 +00:00
|
|
|
"inheritable attribute when called "
|
2009-10-19 23:09:19 +00:00
|
|
|
"in no-change mode");
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This is an inheritable resource
|
|
|
|
inheritable_keys.insert(key);
|
|
|
|
QPDFObjectHandle oh = cur_pages.getKey(key);
|
|
|
|
QTC::TC("qpdf", "QPDF opt direct pages resource",
|
|
|
|
oh.isIndirect() ? 0 : 1);
|
|
|
|
if (! oh.isIndirect())
|
|
|
|
{
|
|
|
|
if (! oh.isScalar())
|
|
|
|
{
|
|
|
|
// Replace shared direct object non-scalar
|
|
|
|
// resources with indirect objects to avoid
|
|
|
|
// copying large structures around.
|
|
|
|
cur_pages.replaceKey(key, makeIndirectObject(oh));
|
|
|
|
oh = cur_pages.getKey(key);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-27 16:39:01 +00:00
|
|
|
// It's okay to copy scalars.
|
2008-04-29 12:55:25 +00:00
|
|
|
QTC::TC("qpdf", "QPDF opt inherited scalar");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
key_ancestors[key].push_back(oh);
|
|
|
|
if (key_ancestors[key].size() > 1)
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt key ancestors depth > 1");
|
|
|
|
}
|
|
|
|
// Remove this resource from this node. It will be
|
|
|
|
// reattached at the page level.
|
|
|
|
cur_pages.removeKey(key);
|
|
|
|
}
|
2012-06-22 16:52:13 +00:00
|
|
|
else if (! ((key == "/Type") || (key == "/Parent") ||
|
|
|
|
(key == "/Kids") || (key == "/Count")))
|
|
|
|
{
|
|
|
|
// Warn when flattening, but not if the key is at the top
|
|
|
|
// level (i.e. "/Parent" not set), as we don't change these;
|
|
|
|
// but flattening removes intermediate /Pages nodes.
|
|
|
|
if ( (warn_skipped_keys) && (cur_pages.hasKey("/Parent")) )
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF unknown key not inherited");
|
|
|
|
setLastObjectDescription("Pages object",
|
|
|
|
cur_pages.getObjectID(),
|
|
|
|
cur_pages.getGeneration());
|
|
|
|
warn(QPDFExc(qpdf_e_pages, this->file->getName(),
|
|
|
|
this->last_object_description, 0,
|
|
|
|
"Unknown key " + key + " in /Pages object"
|
|
|
|
" is being discarded as a result of"
|
|
|
|
" flattening the /Pages tree"));
|
|
|
|
}
|
|
|
|
}
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Visit descendant nodes.
|
|
|
|
QPDFObjectHandle kids = cur_pages.getKey("/Kids");
|
|
|
|
int n = kids.getArrayNItems();
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
|
|
{
|
2012-06-22 15:50:02 +00:00
|
|
|
pushInheritedAttributesToPageInternal(
|
2012-06-22 16:11:25 +00:00
|
|
|
kids.getArrayItem(i), key_ancestors, pages,
|
2012-06-22 16:52:13 +00:00
|
|
|
allow_changes, warn_skipped_keys);
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// For each inheritable key, pop the stack. If the stack
|
|
|
|
// becomes empty, remove it from the map. That way, the
|
|
|
|
// invariant that the list of keys in key_ancestors is exactly
|
|
|
|
// those keys for which inheritable attributes are available.
|
|
|
|
|
|
|
|
if (! inheritable_keys.empty())
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt inheritable keys");
|
|
|
|
for (std::set<std::string>::iterator iter =
|
|
|
|
inheritable_keys.begin();
|
|
|
|
iter != inheritable_keys.end(); ++iter)
|
|
|
|
{
|
|
|
|
std::string const& key = (*iter);
|
|
|
|
key_ancestors[key].pop_back();
|
|
|
|
if (key_ancestors[key].empty())
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt erase empty key ancestor");
|
|
|
|
key_ancestors.erase(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt no inheritable keys");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (type == "/Page")
|
|
|
|
{
|
|
|
|
// Add all available inheritable attributes not present in
|
|
|
|
// this object to this object.
|
|
|
|
for (std::map<std::string, std::vector<QPDFObjectHandle> >::iterator
|
|
|
|
iter = key_ancestors.begin();
|
|
|
|
iter != key_ancestors.end(); ++iter)
|
|
|
|
{
|
|
|
|
std::string const& key = (*iter).first;
|
|
|
|
if (! cur_pages.hasKey(key))
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt resource inherited");
|
|
|
|
cur_pages.replaceKey(key, (*iter).second.back());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
|
|
|
|
}
|
|
|
|
}
|
2012-06-22 16:11:25 +00:00
|
|
|
pages.push_back(cur_pages);
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-24 19:10:08 +00:00
|
|
|
throw QPDFExc(qpdf_e_damaged_pdf, this->file->getName(),
|
2009-10-19 23:09:19 +00:00
|
|
|
this->last_object_description,
|
2010-09-24 19:10:08 +00:00
|
|
|
this->file->getLastOffset(),
|
2012-06-22 03:06:48 +00:00
|
|
|
"invalid Type " + type + " in page tree");
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
QPDF::updateObjectMaps(ObjUser const& ou, QPDFObjectHandle oh)
|
|
|
|
{
|
2013-06-14 15:22:04 +00:00
|
|
|
std::set<QPDFObjGen> visited;
|
2008-04-29 12:55:25 +00:00
|
|
|
updateObjectMapsInternal(ou, oh, visited, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
QPDF::updateObjectMapsInternal(ObjUser const& ou, QPDFObjectHandle oh,
|
2013-06-14 15:22:04 +00:00
|
|
|
std::set<QPDFObjGen>& visited, bool top)
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
// Traverse the object tree from this point taking care to avoid
|
|
|
|
// crossing page boundaries.
|
|
|
|
|
|
|
|
bool is_page_node = false;
|
|
|
|
|
|
|
|
if (oh.isDictionary() && oh.hasKey("/Type"))
|
|
|
|
{
|
|
|
|
std::string type = oh.getKey("/Type").getName();
|
|
|
|
if (type == "/Page")
|
|
|
|
{
|
|
|
|
is_page_node = true;
|
|
|
|
if (! top)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oh.isIndirect())
|
|
|
|
{
|
2013-06-14 15:58:37 +00:00
|
|
|
QPDFObjGen og(oh.getObjGen());
|
2008-04-29 12:55:25 +00:00
|
|
|
if (visited.count(og))
|
|
|
|
{
|
|
|
|
QTC::TC("qpdf", "QPDF opt loop detected");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this->obj_user_to_objects[ou].insert(og);
|
|
|
|
this->object_to_obj_users[og].insert(ou);
|
|
|
|
visited.insert(og);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oh.isArray())
|
|
|
|
{
|
|
|
|
int n = oh.getArrayNItems();
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
|
|
{
|
|
|
|
updateObjectMapsInternal(ou, oh.getArrayItem(i), visited, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (oh.isDictionary() || oh.isStream())
|
|
|
|
{
|
|
|
|
QPDFObjectHandle dict = oh;
|
|
|
|
if (oh.isStream())
|
|
|
|
{
|
|
|
|
dict = oh.getDict();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::set<std::string> keys = dict.getKeys();
|
|
|
|
for (std::set<std::string>::iterator iter = keys.begin();
|
|
|
|
iter != keys.end(); ++iter)
|
|
|
|
{
|
|
|
|
std::string const& key = *iter;
|
|
|
|
if (is_page_node && (key == "/Thumb"))
|
|
|
|
{
|
|
|
|
// Traverse page thumbnail dictionaries as a special
|
|
|
|
// case.
|
|
|
|
updateObjectMaps(ObjUser(ObjUser::ou_thumb, ou.pageno),
|
|
|
|
dict.getKey(key));
|
|
|
|
}
|
|
|
|
else if (is_page_node && (key == "/Parent"))
|
|
|
|
{
|
|
|
|
// Don't traverse back up the page tree
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateObjectMapsInternal(ou, dict.getKey(key),
|
|
|
|
visited, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
QPDF::filterCompressedObjects(std::map<int, int> const& object_stream_data)
|
|
|
|
{
|
|
|
|
if (object_stream_data.empty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Transform object_to_obj_users and obj_user_to_objects so that
|
|
|
|
// they refer only to uncompressed objects. If something is a
|
|
|
|
// user of a compressed object, then it is really a user of the
|
|
|
|
// object stream that contains it.
|
|
|
|
|
2013-06-14 15:22:04 +00:00
|
|
|
std::map<ObjUser, std::set<QPDFObjGen> > t_obj_user_to_objects;
|
|
|
|
std::map<QPDFObjGen, std::set<ObjUser> > t_object_to_obj_users;
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2013-06-14 15:22:04 +00:00
|
|
|
for (std::map<ObjUser, std::set<QPDFObjGen> >::iterator i1 =
|
2008-04-29 12:55:25 +00:00
|
|
|
this->obj_user_to_objects.begin();
|
|
|
|
i1 != this->obj_user_to_objects.end(); ++i1)
|
|
|
|
{
|
|
|
|
ObjUser const& ou = (*i1).first;
|
2013-06-14 15:22:04 +00:00
|
|
|
std::set<QPDFObjGen> const& objects = (*i1).second;
|
|
|
|
for (std::set<QPDFObjGen>::const_iterator i2 = objects.begin();
|
2008-04-29 12:55:25 +00:00
|
|
|
i2 != objects.end(); ++i2)
|
|
|
|
{
|
2013-06-14 15:22:04 +00:00
|
|
|
QPDFObjGen const& og = (*i2);
|
2008-04-29 12:55:25 +00:00
|
|
|
std::map<int, int>::const_iterator i3 =
|
2013-06-14 15:22:04 +00:00
|
|
|
object_stream_data.find(og.getObj());
|
2008-04-29 12:55:25 +00:00
|
|
|
if (i3 == object_stream_data.end())
|
|
|
|
{
|
|
|
|
t_obj_user_to_objects[ou].insert(og);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-14 15:22:04 +00:00
|
|
|
t_obj_user_to_objects[ou].insert(QPDFObjGen((*i3).second, 0));
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-14 15:22:04 +00:00
|
|
|
for (std::map<QPDFObjGen, std::set<ObjUser> >::iterator i1 =
|
2008-04-29 12:55:25 +00:00
|
|
|
this->object_to_obj_users.begin();
|
|
|
|
i1 != this->object_to_obj_users.end(); ++i1)
|
|
|
|
{
|
2013-06-14 15:22:04 +00:00
|
|
|
QPDFObjGen const& og = (*i1).first;
|
2008-04-29 12:55:25 +00:00
|
|
|
std::set<ObjUser> const& objusers = (*i1).second;
|
|
|
|
for (std::set<ObjUser>::const_iterator i2 = objusers.begin();
|
|
|
|
i2 != objusers.end(); ++i2)
|
|
|
|
{
|
|
|
|
ObjUser const& ou = (*i2);
|
|
|
|
std::map<int, int>::const_iterator i3 =
|
2013-06-14 15:22:04 +00:00
|
|
|
object_stream_data.find(og.getObj());
|
2008-04-29 12:55:25 +00:00
|
|
|
if (i3 == object_stream_data.end())
|
|
|
|
{
|
|
|
|
t_object_to_obj_users[og].insert(ou);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-14 15:22:04 +00:00
|
|
|
t_object_to_obj_users[QPDFObjGen((*i3).second, 0)].insert(ou);
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->obj_user_to_objects = t_obj_user_to_objects;
|
|
|
|
this->object_to_obj_users = t_object_to_obj_users;
|
|
|
|
}
|