vcl/source/fontsubset/ttcr.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit c3d488c201231a98ef13560dc8d070267d8d5e86
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Fri Sep 23 09:41:32 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Sep 23 10:28:01 2022 +0200

    -Werror=class-memaccess
    
    ...since 590796ca0866168e3129d2abd0a0197114cddcdc "convert TrueTypeTable to 
C++
    class"
    
    Change-Id: I9c1908ba0618f5a04bc669e722ea5ad54ae217b4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140471
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index 5bfc283e48a6..a5fde16ffe69 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -838,7 +838,9 @@ void TrueTypeTableCmap::cmapAdd(sal_uInt32 id, sal_uInt32 
c, sal_uInt32 g)
     if (!found) {
         if (m_cmap->n == m_cmap->m) {
             std::unique_ptr<CmapSubTable[]> tmp(new CmapSubTable[m_cmap->m + 
CMAP_SUBTABLE_INCR]);
-            memcpy(tmp.get(), s, sizeof(CmapSubTable) * m_cmap->m);
+            for (sal_uInt32 j = 0; j != m_cmap->m; ++j) {
+                tmp[j] = std::move(s[j]);
+            }
             m_cmap->m += CMAP_SUBTABLE_INCR;
             s = tmp.get();
             m_cmap->s = std::move(tmp);
@@ -849,7 +851,9 @@ void TrueTypeTableCmap::cmapAdd(sal_uInt32 id, sal_uInt32 
c, sal_uInt32 g)
         }
 
         if (i < m_cmap->n) {
-            memmove(s+i+1, s+i, m_cmap->n-i);
+            for (sal_uInt32 j = m_cmap->n; j != i; --j) {
+                s[j + 1] = std::move(s[j]);
+            }
         }
 
         m_cmap->n++;

Reply via email to