Commit 974bc7cf3e02f85cab22a377c233af6c5e53a99c
1 parent
14b541b8
Refactor `EncryptionParameters::interpretCF`: replace `QPDFObjectHandle` with `N…
…ame` for improved clarity and consistency, and simplify `/Identity` handling.
Showing
2 changed files
with
7 additions
and
6 deletions
libqpdf/QPDF_encryption.cc
| ... | ... | @@ -600,18 +600,17 @@ QPDF::EncryptionData::recover_encryption_key_with_password( |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | QPDF::encryption_method_e |
| 603 | -QPDF::EncryptionParameters::interpretCF(QPDFObjectHandle const& cf) const | |
| 603 | +QPDF::EncryptionParameters::interpretCF(Name const& cf) const | |
| 604 | 604 | { |
| 605 | - if (!cf.isName()) { | |
| 605 | + if (!cf) { | |
| 606 | 606 | // Default: /Identity |
| 607 | 607 | return e_none; |
| 608 | 608 | } |
| 609 | - std::string filter = cf.getName(); | |
| 610 | - auto it = crypt_filters.find(filter); | |
| 609 | + auto it = crypt_filters.find(cf); | |
| 611 | 610 | if (it != crypt_filters.end()) { |
| 612 | 611 | return it->second; |
| 613 | 612 | } |
| 614 | - if (filter == "/Identity") { | |
| 613 | + if (cf == "/Identity") { | |
| 615 | 614 | return e_none; |
| 616 | 615 | } |
| 617 | 616 | return e_unknown; | ... | ... |
libqpdf/qpdf/QPDF_private.hh
| ... | ... | @@ -7,6 +7,8 @@ |
| 7 | 7 | #include <qpdf/QPDFObject_private.hh> |
| 8 | 8 | #include <qpdf/QPDFTokenizer_private.hh> |
| 9 | 9 | |
| 10 | +using namespace qpdf; | |
| 11 | + | |
| 10 | 12 | // Writer class is restricted to QPDFWriter so that only it can call certain methods. |
| 11 | 13 | class QPDF::Writer |
| 12 | 14 | { |
| ... | ... | @@ -204,7 +206,7 @@ class QPDF::EncryptionParameters |
| 204 | 206 | } |
| 205 | 207 | |
| 206 | 208 | void initialize(QPDF& qpdf); |
| 207 | - encryption_method_e interpretCF(QPDFObjectHandle const& cf) const; | |
| 209 | + encryption_method_e interpretCF(Name const& cf) const; | |
| 208 | 210 | |
| 209 | 211 | private: |
| 210 | 212 | bool encrypted{false}; | ... | ... |