diff options
author | Brad Hards <bradh@frogmouth.net> | 2005-08-27 08:43:42 +0000 |
---|---|---|
committer | Brad Hards <bradh@frogmouth.net> | 2005-08-27 08:43:42 +0000 |
commit | d1d715158223c7ca3ae279cea420a948cfdb0428 (patch) | |
tree | 07a14d4aa4ed3b9624826b30e34ac6d2fabe4ab0 /fofi | |
parent | feb82c60b1f86a9d1260db57534d98c54ee615c4 (diff) |
Merge the gmalloc -> gmallocn changes from xpdf 3.0.1. This change is
based on martink's work (13-xpdf-3.01-goo-allocn.patch) with some
tweaking by me. There may be some residual gmallocn changes still to
be merged.
Diffstat (limited to 'fofi')
-rw-r--r-- | fofi/FoFiTrueType.cc | 12 | ||||
-rw-r--r-- | fofi/FoFiType1.cc | 2 | ||||
-rw-r--r-- | fofi/FoFiType1C.cc | 14 |
3 files changed, 14 insertions, 14 deletions
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index c73fcf44..2361c012 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -667,7 +667,7 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc, missingPost = seekTable("post") < 0; // read the loca table, check to see if it's sorted - locaTable = (TrueTypeLoca *)gmalloc((nGlyphs + 1) * sizeof(TrueTypeLoca)); + locaTable = (TrueTypeLoca *)gmallocn(nGlyphs + 1, sizeof(TrueTypeLoca)); unsortedLoca = gFalse; i = seekTable("loca"); pos = tables[i].offset; @@ -751,7 +751,7 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc, nNewTables = nTables - nZeroLengthTables + (missingCmap ? 1 : 0) + (missingName ? 1 : 0) + (missingPost ? 1 : 0); - newTables = (TrueTypeTable *)gmalloc(nNewTables * sizeof(TrueTypeTable)); + newTables = (TrueTypeTable *)gmallocn(nNewTables, sizeof(TrueTypeTable)); j = 0; for (i = 0; i < nTables; ++i) { if (tables[i].len > 0) { @@ -1001,7 +1001,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, // table, cmpTrueTypeLocaPos uses offset as its primary sort key, // and idx as its secondary key (ensuring that adjacent entries with // the same pos value remain in the same order) - locaTable = (TrueTypeLoca *)gmalloc((nGlyphs + 1) * sizeof(TrueTypeLoca)); + locaTable = (TrueTypeLoca *)gmallocn(nGlyphs + 1, sizeof(TrueTypeLoca)); i = seekTable("loca"); pos = tables[i].offset; ok = gTrue; @@ -1031,7 +1031,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, } // construct the new 'loca' table - locaData = (Guchar *)gmalloc((nGlyphs + 1) * (locaFmt ? 4 : 2)); + locaData = (Guchar *)gmallocn(nGlyphs + 1, (locaFmt ? 4 : 2)); for (i = 0; i <= nGlyphs; ++i) { pos = locaTable[i].newOffset; if (locaFmt) { @@ -1272,7 +1272,7 @@ void FoFiTrueType::parse() { if (!parsedOk) { return; } - tables = (TrueTypeTable *)gmalloc(nTables * sizeof(TrueTypeTable)); + tables = (TrueTypeTable *)gmallocn(nTables, sizeof(TrueTypeTable)); pos = 12; for (i = 0; i < nTables; ++i) { tables[i].tag = getU32BE(pos, &parsedOk); @@ -1309,7 +1309,7 @@ void FoFiTrueType::parse() { if (!parsedOk) { return; } - cmaps = (TrueTypeCmap *)gmalloc(nCmaps * sizeof(TrueTypeCmap)); + cmaps = (TrueTypeCmap *)gmallocn(nCmaps, sizeof(TrueTypeCmap)); for (j = 0; j < nCmaps; ++j) { cmaps[j].platform = getU16BE(pos, &parsedOk); cmaps[j].encoding = getU16BE(pos + 2, &parsedOk); diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc index 6c5ed3d9..ef27a3c6 100644 --- a/fofi/FoFiType1.cc +++ b/fofi/FoFiType1.cc @@ -156,7 +156,7 @@ void FoFiType1::parse() { encoding = fofiType1StandardEncoding; } else if (!encoding && !strncmp(line, "/Encoding 256 array", 19)) { - encoding = (char **)gmalloc(256 * sizeof(char *)); + encoding = (char **)gmallocn(256, sizeof(char *)); for (j = 0; j < 256; ++j) { encoding[j] = NULL; } diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc index 6287cef5..15d4c126 100644 --- a/fofi/FoFiType1C.cc +++ b/fofi/FoFiType1C.cc @@ -120,7 +120,7 @@ Gushort *FoFiType1C::getCIDToGIDMap(int *nCIDs) { } } ++n; - map = (Gushort *)gmalloc(n * sizeof(Gushort)); + map = (Gushort *)gmallocn(n, sizeof(Gushort)); memset(map, 0, n * sizeof(Gushort)); for (i = 0; i < nGlyphs; ++i) { map[charset[i]] = i; @@ -403,7 +403,7 @@ void FoFiType1C::convertToCIDType0(char *psName, nCIDs = charset[i] + 1; } } - cidMap = (int *)gmalloc(nCIDs * sizeof(int)); + cidMap = (int *)gmallocn(nCIDs, sizeof(int)); for (i = 0; i < nCIDs; ++i) { cidMap[i] = -1; } @@ -413,7 +413,7 @@ void FoFiType1C::convertToCIDType0(char *psName, // build the charstrings charStrings = new GooString(); - charStringOffsets = (int *)gmalloc((nCIDs + 1) * sizeof(int)); + charStringOffsets = (int *)gmallocn(nCIDs + 1, sizeof(int)); for (i = 0; i < nCIDs; ++i) { charStringOffsets[i] = charStrings->getLength(); if ((gid = cidMap[i]) >= 0) { @@ -670,7 +670,7 @@ void FoFiType1C::convertToType0(char *psName, nCIDs = charset[i] + 1; } } - cidMap = (int *)gmalloc(nCIDs * sizeof(int)); + cidMap = (int *)gmallocn(nCIDs, sizeof(int)); for (i = 0; i < nCIDs; ++i) { cidMap[i] = -1; } @@ -1692,7 +1692,7 @@ GBool FoFiType1C::parse() { } nFDs = fdIdx.len; privateDicts = (Type1CPrivateDict *) - gmalloc(nFDs * sizeof(Type1CPrivateDict)); + gmallocn(nFDs, sizeof(Type1CPrivateDict)); for (i = 0; i < nFDs; ++i) { getIndexVal(&fdIdx, i, &val, &parsedOk); if (!parsedOk) { @@ -2049,7 +2049,7 @@ void FoFiType1C::buildEncoding() { encoding = fofiType1ExpertEncoding; } else { - encoding = (char **)gmalloc(256 * sizeof(char *)); + encoding = (char **)gmallocn(256, sizeof(char *)); for (i = 0; i < 256; ++i) { encoding[i] = NULL; } @@ -2136,7 +2136,7 @@ GBool FoFiType1C::readCharset() { } else if (topDict.charsetOffset == 2) { charset = fofiType1CExpertSubsetCharset; } else { - charset = (Gushort *)gmalloc(nGlyphs * sizeof(Gushort)); + charset = (Gushort *)gmallocn(nGlyphs, sizeof(Gushort)); for (i = 0; i < nGlyphs; ++i) { charset[i] = 0; } |