aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-01-26 02:28:53 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-01-27 14:31:12 +0100
commit710d2e54f0762b7702640766d33b7e0977ba69de (patch)
tree580c55e980a62bed485399785dc45b3d7d7100f7 /libqpdf
parent823926f8bfff3a9fa8b93488b7d6a25da06719da (diff)
downloadqpdf-710d2e54f0762b7702640766d33b7e0977ba69de.tar.zst
Allow testing for subtype without specifying type in isDictionaryOfType etc
Accept empty string as type parameter in QPDFObjectHandle::isDictionaryOfType and isStreamOfType to allow for dictionaries with optional type.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFObjectHandle.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index f2c77dca..2713eb95 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -507,15 +507,9 @@ bool
QPDFObjectHandle::isDictionaryOfType(std::string const& type,
std::string const& subtype)
{
- if (isDictionary() && getKey("/Type").isNameAndEquals(type))
- {
- return (subtype == "") ||
- (hasKey("/Subtype") && getKey("/Subtype").isNameAndEquals(subtype));
- }
- else
- {
- return false;
- }
+ return isDictionary() &&
+ (type.empty() || getKey("/Type").isNameAndEquals(type)) &&
+ (subtype.empty() || getKey("/Subtype").isNameAndEquals(subtype));
}
bool