[Libreoffice-commits] core.git: vcl/source

Julien Nabet serval2412 at yahoo.fr
Sun Jan 31 02:13:40 PST 2016


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

New commits:
commit 9d63774dd469869f52b3dc4af2c71211fd984b33
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Jan 31 11:01:25 2016 +0100

    cppcheck: fix redundantCopy
    
    scalloc calls calloc which allocates and zero-initializes array
    (see http://www.cplusplus.com/reference/cstdlib/calloc/)
    Note: there was another useless memset to 0 not detected by cppcheck
    
    Change-Id: Icc6458aef2ffb05fd33a858a65e0ec2dd36a8307

diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index 16e831f..b2016b9 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -1015,7 +1015,6 @@ TrueTypeTable *TrueTypeTableNew_cmap()
     cmap->n = 0;
     cmap->m = CMAP_SUBTABLE_INIT;
     cmap->s = static_cast<CmapSubTable *>(scalloc(CMAP_SUBTABLE_INIT, sizeof(CmapSubTable)));
-    memset(cmap->s, 0, sizeof(CmapSubTable) * CMAP_SUBTABLE_INIT);
 
     table->data = cmap;
 
@@ -1145,7 +1144,6 @@ void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g)
     if (!found) {
         if (t->n == t->m) {
             CmapSubTable* tmp = static_cast<CmapSubTable*>(scalloc(t->m + CMAP_SUBTABLE_INCR, sizeof(CmapSubTable)));
-            memset(tmp, 0, t->m + CMAP_SUBTABLE_INCR * sizeof(CmapSubTable));
             memcpy(tmp, s, sizeof(CmapSubTable) * t->m);
             t->m += CMAP_SUBTABLE_INCR;
             free(s);


More information about the Libreoffice-commits mailing list