vcl/source/fontsubset/ttcr.cxx |   32 ++++++++++----------------------
 vcl/source/fontsubset/ttcr.hxx |    4 ++--
 2 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit ab1d9893bad53ae6e1400c502b648e980ca876b5
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Sep 24 08:30:25 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Sep 24 12:29:40 2022 +0200

    flattenTrueTypeTableGeneric
    
    Change-Id: I197b2f45943513af7a514c92b5896bda659adf9d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140536
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index e68f50d1f03b..8c2bcaecc21a 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -289,12 +289,6 @@ struct table_cmap {
     std::unique_ptr<CmapSubTable[]> s;      /* sorted array of sub-tables      
     */
 };
 
-struct tdata_generic {
-    sal_uInt32 tag;
-    sal_uInt32 nbytes;
-    std::unique_ptr<sal_uInt8[]> ptr;
-};
-
 struct tdata_loca {
     sal_uInt32 nbytes;                      /* number of bytes in loca table */
     std::unique_ptr<sal_uInt8[]> ptr;       /* pointer to the data */
@@ -358,11 +352,9 @@ TrueTypeTablePost::~TrueTypeTablePost()
 
 int TrueTypeTableGeneric::GetRawData(TableEntry* te)
 {
-    assert(this->m_generic != nullptr);
-
-    te->data = this->m_generic->ptr.get();
-    te->length = this->m_generic->nbytes;
-    te->tag = this->m_generic->tag;
+    te->data = this->m_ptr.get();
+    te->length = this->m_nbytes;
+    te->tag = this->m_tag;
 
     return TTCR_OK;
 }
@@ -664,27 +656,23 @@ int TrueTypeTablePost::GetRawData(TableEntry* te)
 TrueTypeTableGeneric::TrueTypeTableGeneric(sal_uInt32 tag,
                                 sal_uInt32 nbytes,
                                 const sal_uInt8* ptr)
-    : TrueTypeTable(0),
-    m_generic(new tdata_generic)
+    : TrueTypeTable(tag),
+    m_nbytes(nbytes)
 {
-    m_generic->nbytes = nbytes;
-    m_generic->tag = tag;
     if (nbytes) {
-        m_generic->ptr = ttmalloc(nbytes);
-        memcpy(m_generic->ptr.get(), ptr, nbytes);
+        m_ptr = ttmalloc(nbytes);
+        memcpy(m_ptr.get(), ptr, nbytes);
     }
 }
 
 TrueTypeTableGeneric::TrueTypeTableGeneric(sal_uInt32 tag,
                                 sal_uInt32 nbytes,
                                 std::unique_ptr<sal_uInt8[]> ptr)
-    : TrueTypeTable(0),
-    m_generic(new tdata_generic)
+    : TrueTypeTable(tag),
+    m_nbytes(nbytes)
 {
-    m_generic->nbytes = nbytes;
-    m_generic->tag = tag;
     if (nbytes) {
-        m_generic->ptr = std::move(ptr);
+        m_ptr = std::move(ptr);
     }
 }
 
diff --git a/vcl/source/fontsubset/ttcr.hxx b/vcl/source/fontsubset/ttcr.hxx
index 2dc10dc31cd2..d5cf47d97308 100644
--- a/vcl/source/fontsubset/ttcr.hxx
+++ b/vcl/source/fontsubset/ttcr.hxx
@@ -32,7 +32,6 @@ namespace vcl
 class TrueTypeTable;
 struct tdata_loca;
 struct table_cmap;
-struct tdata_generic;
 struct TableEntry;
 
 
@@ -135,7 +134,8 @@ struct TableEntry;
         virtual ~TrueTypeTableGeneric() override;
         virtual int GetRawData(TableEntry*) override;
     private:
-        std::unique_ptr<tdata_generic> m_generic;
+        sal_uInt32 m_nbytes;
+        std::unique_ptr<sal_uInt8[]> m_ptr;
     };
 
 /**

Reply via email to