mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Refactor QPDFObjectHandle::unsafeShallowCopy
This commit is contained in:
parent
0289b21c3b
commit
d7b8525235
@ -1634,7 +1634,6 @@ class QPDFObjectHandle
|
|||||||
bool first_level_only,
|
bool first_level_only,
|
||||||
bool stop_at_streams);
|
bool stop_at_streams);
|
||||||
void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
|
void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
|
||||||
void shallowCopyInternal2(QPDFObjectHandle& oh);
|
|
||||||
void copyObject(
|
void copyObject(
|
||||||
std::set<QPDFObjGen>& visited,
|
std::set<QPDFObjGen>& visited,
|
||||||
bool cross_indirect,
|
bool cross_indirect,
|
||||||
|
@ -2298,20 +2298,11 @@ QPDFObjectHandle::copyObject1(
|
|||||||
QPDFObjectHandle
|
QPDFObjectHandle
|
||||||
QPDFObjectHandle::unsafeShallowCopy()
|
QPDFObjectHandle::unsafeShallowCopy()
|
||||||
{
|
{
|
||||||
QPDFObjectHandle result;
|
if (!dereference()) {
|
||||||
shallowCopyInternal2(result);
|
throw std::logic_error("operation attempted on uninitialized "
|
||||||
return result;
|
"QPDFObjectHandle");
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
QPDFObjectHandle::shallowCopyInternal2(QPDFObjectHandle& new_obj)
|
|
||||||
{
|
|
||||||
assertInitialized();
|
|
||||||
|
|
||||||
if (isStream()) {
|
|
||||||
throw std::runtime_error("attempt to make a shallow copy of a stream");
|
|
||||||
}
|
}
|
||||||
new_obj = QPDFObjectHandle(obj->copy(true));
|
return QPDFObjectHandle(obj->copy(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user