From 9d63774dd469869f52b3dc4af2c71211fd984b33 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 31 Jan 2016 11:01:25 +0100 Subject: 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 --- vcl/source/fontsubset/ttcr.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 16e831fdea31..b2016b9acb3f 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(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(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); -- cgit