[poppler] poppler/CertificateInfo.cc poppler/CertificateInfo.h poppler/SignatureInfo.cc poppler/SignatureInfo.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 10 22:14:10 UTC 2023


 poppler/CertificateInfo.cc |   25 -------------------------
 poppler/CertificateInfo.h  |   18 +++++++++---------
 poppler/SignatureInfo.cc   |   22 +---------------------
 poppler/SignatureInfo.h    |   13 ++++++-------
 4 files changed, 16 insertions(+), 62 deletions(-)

New commits:
commit b46e395c39700325cd6d717f0cf459274a44a1a9
Author: Sune Vuorela <sune at vuorela.dk>
Date:   Fri Mar 10 14:10:32 2023 +0100

    Simplify certificate and signature info
    
    More stuff can be defaulted.

diff --git a/poppler/CertificateInfo.cc b/poppler/CertificateInfo.cc
index 8b94e070..982ee898 100644
--- a/poppler/CertificateInfo.cc
+++ b/poppler/CertificateInfo.cc
@@ -16,31 +16,6 @@
 #include <cstring>
 #include <cstdlib>
 
-X509CertificateInfo::PublicKeyInfo::PublicKeyInfo() : publicKeyType(OTHERKEY), publicKeyStrength(0) { }
-
-X509CertificateInfo::PublicKeyInfo::PublicKeyInfo(X509CertificateInfo::PublicKeyInfo &&other) noexcept
-{
-    publicKey = std::move(other.publicKey);
-    publicKeyType = other.publicKeyType;
-    publicKeyStrength = other.publicKeyStrength;
-}
-
-X509CertificateInfo::PublicKeyInfo &X509CertificateInfo::PublicKeyInfo::operator=(X509CertificateInfo::PublicKeyInfo &&other) noexcept
-{
-    publicKey = std::move(other.publicKey);
-    publicKeyType = other.publicKeyType;
-    publicKeyStrength = other.publicKeyStrength;
-    return *this;
-}
-
-X509CertificateInfo::EntityInfo::EntityInfo() = default;
-
-X509CertificateInfo::EntityInfo::~EntityInfo() = default;
-
-X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) noexcept = default;
-
-X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) noexcept = default;
-
 X509CertificateInfo::X509CertificateInfo() : ku_extensions(KU_NONE), cert_version(-1), is_self_signed(false) { }
 
 X509CertificateInfo::~X509CertificateInfo() = default;
diff --git a/poppler/CertificateInfo.h b/poppler/CertificateInfo.h
index b99edc8c..7b324f0b 100644
--- a/poppler/CertificateInfo.h
+++ b/poppler/CertificateInfo.h
@@ -51,26 +51,26 @@ public:
 
     struct PublicKeyInfo
     {
-        PublicKeyInfo();
+        PublicKeyInfo() = default;
 
-        PublicKeyInfo(PublicKeyInfo &&) noexcept;
-        PublicKeyInfo &operator=(PublicKeyInfo &&) noexcept;
+        PublicKeyInfo(PublicKeyInfo &&) noexcept = default;
+        PublicKeyInfo &operator=(PublicKeyInfo &&) noexcept = default;
 
         PublicKeyInfo(const PublicKeyInfo &) = delete;
         PublicKeyInfo &operator=(const PublicKeyInfo &) = delete;
 
         GooString publicKey;
-        PublicKeyType publicKeyType;
-        unsigned int publicKeyStrength; // in bits
+        PublicKeyType publicKeyType = OTHERKEY;
+        unsigned int publicKeyStrength = 0; // in bits
     };
 
     struct EntityInfo
     {
-        EntityInfo();
-        ~EntityInfo();
+        EntityInfo() = default;
+        ~EntityInfo() = default;
 
-        EntityInfo(EntityInfo &&) noexcept;
-        EntityInfo &operator=(EntityInfo &&) noexcept;
+        EntityInfo(EntityInfo &&) noexcept = default;
+        EntityInfo &operator=(EntityInfo &&) noexcept = default;
 
         EntityInfo(const EntityInfo &) = delete;
         EntityInfo &operator=(const EntityInfo &) = delete;
diff --git a/poppler/SignatureInfo.cc b/poppler/SignatureInfo.cc
index de26ec20..bce00bdc 100644
--- a/poppler/SignatureInfo.cc
+++ b/poppler/SignatureInfo.cc
@@ -27,27 +27,7 @@
 
 /* Constructor & Destructor */
 
-SignatureInfo::SignatureInfo()
-{
-    sig_status = SIGNATURE_NOT_VERIFIED;
-    cert_status = CERTIFICATE_NOT_VERIFIED;
-    cert_info = nullptr;
-    hash_type = HashAlgorithm::Unknown;
-    signing_time = 0;
-    sig_subfilter_supported = false;
-}
-
-SignatureInfo::SignatureInfo(SignatureValidationStatus sig_val_status, CertificateValidationStatus cert_val_status)
-{
-    sig_status = sig_val_status;
-    cert_status = cert_val_status;
-    cert_info = nullptr;
-    hash_type = HashAlgorithm::Unknown;
-    signing_time = 0;
-    sig_subfilter_supported = false;
-}
-
-SignatureInfo::~SignatureInfo() { }
+SignatureInfo::~SignatureInfo() = default;
 
 /* GETTERS */
 
diff --git a/poppler/SignatureInfo.h b/poppler/SignatureInfo.h
index 1a75990f..d389ae24 100644
--- a/poppler/SignatureInfo.h
+++ b/poppler/SignatureInfo.h
@@ -54,8 +54,7 @@ class X509CertificateInfo;
 class POPPLER_PRIVATE_EXPORT SignatureInfo
 {
 public:
-    SignatureInfo();
-    SignatureInfo(SignatureValidationStatus, CertificateValidationStatus);
+    SignatureInfo() = default;
     ~SignatureInfo();
 
     SignatureInfo(const SignatureInfo &) = delete;
@@ -86,16 +85,16 @@ public:
     void setCertificateInfo(std::unique_ptr<X509CertificateInfo>);
 
 private:
-    SignatureValidationStatus sig_status;
-    CertificateValidationStatus cert_status;
+    SignatureValidationStatus sig_status = SIGNATURE_NOT_VERIFIED;
+    CertificateValidationStatus cert_status = CERTIFICATE_NOT_VERIFIED;
     std::unique_ptr<X509CertificateInfo> cert_info;
     std::string signer_name;
     std::string subject_dn;
     GooString location;
     GooString reason;
-    HashAlgorithm hash_type;
-    time_t signing_time;
-    bool sig_subfilter_supported;
+    HashAlgorithm hash_type = HashAlgorithm::Unknown;
+    time_t signing_time = 0;
+    bool sig_subfilter_supported = false;
 };
 
 #endif


More information about the poppler mailing list