mirror of
https://github.com/qpdf/qpdf.git
synced 2025-02-13 00:58:28 +00:00
Refactor: separate copyStreamData from replaceForeignIndirectObjects
This commit is contained in:
parent
15269f36d8
commit
60afe4142e
@ -1005,6 +1005,8 @@ class QPDF
|
|||||||
bool top);
|
bool top);
|
||||||
QPDFObjectHandle replaceForeignIndirectObjects(
|
QPDFObjectHandle replaceForeignIndirectObjects(
|
||||||
QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top);
|
QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top);
|
||||||
|
void copyStreamData(
|
||||||
|
QPDFObjectHandle dest_stream, QPDFObjectHandle src_stream);
|
||||||
|
|
||||||
// Linearization Hint table structures.
|
// Linearization Hint table structures.
|
||||||
// Naming conventions:
|
// Naming conventions:
|
||||||
|
@ -2576,6 +2576,28 @@ QPDF::replaceForeignIndirectObjects(
|
|||||||
replaceForeignIndirectObjects(
|
replaceForeignIndirectObjects(
|
||||||
old_dict.getKey(*iter), obj_copier, false));
|
old_dict.getKey(*iter), obj_copier, false));
|
||||||
}
|
}
|
||||||
|
copyStreamData(result, foreign);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreign.assertScalar();
|
||||||
|
result = foreign;
|
||||||
|
result.makeDirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top && (! result.isStream()) && result.isIndirect())
|
||||||
|
{
|
||||||
|
throw std::logic_error("replacement for foreign object is indirect");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
|
||||||
|
{
|
||||||
|
QPDFObjectHandle dict = result.getDict();
|
||||||
|
QPDFObjectHandle old_dict = foreign.getDict();
|
||||||
if (this->m->copied_stream_data_provider == 0)
|
if (this->m->copied_stream_data_provider == 0)
|
||||||
{
|
{
|
||||||
this->m->copied_stream_data_provider =
|
this->m->copied_stream_data_provider =
|
||||||
@ -2651,20 +2673,6 @@ QPDF::replaceForeignIndirectObjects(
|
|||||||
dict.getKey("/Filter"),
|
dict.getKey("/Filter"),
|
||||||
dict.getKey("/DecodeParms"));
|
dict.getKey("/DecodeParms"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreign.assertScalar();
|
|
||||||
result = foreign;
|
|
||||||
result.makeDirect();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (top && (! result.isStream()) && result.isIndirect())
|
|
||||||
{
|
|
||||||
throw std::logic_error("replacement for foreign object is indirect");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user