Bug 610823: Change a few users that use nsTArrays as buffers to explicitly use fallible tarray. r=jdaggett a=blocker

This commit is contained in:
Jonas Sicking 2011-01-06 20:45:10 -08:00
Родитель 77fecff96d
Коммит 044e50f0a9
20 изменённых файлов: 65 добавлений и 62 удалений

Просмотреть файл

@ -59,7 +59,7 @@ gfxDWriteFontFileLoader::CreateStreamFromKey(const void *fontFileReferenceKey,
return S_OK;
}
gfxDWriteFontFileStream::gfxDWriteFontFileStream(nsTArray<PRUint8> *aData)
gfxDWriteFontFileStream::gfxDWriteFontFileStream(FallibleTArray<PRUint8> *aData)
{
mData.SwapElements(*aData);
}

Просмотреть файл

@ -109,7 +109,7 @@ FontStretchFromDWriteStretch(DWRITE_FONT_STRETCH aStretch)
struct ffReferenceKey
{
nsTArray<PRUint8> *mArray;
FallibleTArray<PRUint8> *mArray;
nsID mGUID;
};
@ -147,7 +147,7 @@ public:
// IDWriteFontFileLoader methods
/**
* Important! Note the key here -has- to be a pointer to an
* nsTArray<PRUint8>.
* FallibleTArray<PRUint8>.
*/
virtual HRESULT STDMETHODCALLTYPE
CreateStreamFromKey(void const* fontFileReferenceKey,
@ -156,8 +156,8 @@ public:
/**
* Gets the singleton loader instance. Note that when using this font
* loader, the key must be a pointer to an nsTArray<PRUint8>. This array
* will be empty when the function returns.
* loader, the key must be a pointer to an FallibleTArray<PRUint8>. This
* array will be empty when the function returns.
*/
static IDWriteFontFileLoader* Instance()
{
@ -184,7 +184,7 @@ public:
*
* @param aData Font data
*/
gfxDWriteFontFileStream(nsTArray<PRUint8> *aData);
gfxDWriteFontFileStream(FallibleTArray<PRUint8> *aData);
~gfxDWriteFontFileStream();
// IUnknown interface
@ -232,7 +232,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64* lastWriteTime);
private:
nsTArray<PRUint8> mData;
FallibleTArray<PRUint8> mData;
nsAutoRefCnt mRefCnt;
};

Просмотреть файл

@ -225,7 +225,7 @@ gfxDWriteFontEntry::IsSymbolFont()
nsresult
gfxDWriteFontEntry::GetFontTable(PRUint32 aTableTag,
nsTArray<PRUint8> &aBuffer)
FallibleTArray<PRUint8> &aBuffer)
{
nsRefPtr<IDWriteFontFace> fontFace;
HRESULT hr;
@ -399,7 +399,7 @@ gfxDWriteFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
return nsnull;
}
nsTArray<PRUint8> newFontData;
FallibleTArray<PRUint8> newFontData;
rv = gfxFontUtils::RenameFont(uniqueName, aFontData, aLength, &newFontData);
NS_Free((void*)aFontData);

Просмотреть файл

@ -159,7 +159,7 @@ public:
virtual PRBool IsSymbolFont();
virtual nsresult GetFontTable(PRUint32 aTableTag,
nsTArray<PRUint8>& aBuffer);
FallibleTArray<PRUint8>& aBuffer);
nsresult ReadCMAP();
protected:

Просмотреть файл

@ -193,7 +193,7 @@ gfxFT2FontBase::GetFontTable(PRUint32 aTag)
if (mFontEntry->GetExistingFontTable(aTag, &blob))
return blob;
nsTArray<PRUint8> buffer;
FallibleTArray<PRUint8> buffer;
PRBool haveTable = gfxFT2LockedFace(this).GetFontTable(aTag, buffer);
// Cache even when there is no table to save having to open the FT_Face

Просмотреть файл

@ -268,7 +268,7 @@ FontEntry::ReadCMAP()
NS_ENSURE_TRUE(status == 0, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(len != 0, NS_ERROR_FAILURE);
nsAutoTArray<PRUint8,16384> buffer;
AutoFallibleTArray<PRUint8,16384> buffer;
if (!buffer.AppendElements(len)) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -354,7 +354,7 @@ gfxFT2LockedFace::GetUVSGlyph(PRUint32 aCharCode, PRUint32 aVariantSelector)
}
PRBool
gfxFT2LockedFace::GetFontTable(PRUint32 aTag, nsTArray<PRUint8>& aBuffer)
gfxFT2LockedFace::GetFontTable(PRUint32 aTag, FallibleTArray<PRUint8>& aBuffer)
{
if (!mFace || !FT_IS_SFNT(mFace))
return PR_FALSE;
@ -365,7 +365,7 @@ gfxFT2LockedFace::GetFontTable(PRUint32 aTag, nsTArray<PRUint8>& aBuffer)
if (error != 0)
return PR_FALSE;
if (NS_UNLIKELY(length > static_cast<nsTArray<PRUint8>::size_type>(-1))
if (NS_UNLIKELY(length > static_cast<FallibleTArray<PRUint8>::size_type>(-1))
|| NS_UNLIKELY(!aBuffer.SetLength(length)))
return PR_FALSE;

Просмотреть файл

@ -84,7 +84,7 @@ public:
void GetMetrics(gfxFont::Metrics* aMetrics, PRUint32* aSpaceGlyph);
PRBool GetFontTable(PRUint32 aTag, nsTArray<PRUint8>& aBuffer);
PRBool GetFontTable(PRUint32 aTag, FallibleTArray<PRUint8>& aBuffer);
// A scale factor for use in converting horizontal metrics from font units
// to pixels.

Просмотреть файл

@ -119,7 +119,7 @@ nsresult gfxFontEntry::InitializeUVSMap()
if (!mUVSData) {
const PRUint32 kCmapTag = TRUETYPE_TAG('c','m','a','p');
nsAutoTArray<PRUint8,16384> buffer;
AutoFallibleTArray<PRUint8,16384> buffer;
if (GetFontTable(kCmapTag, buffer) != NS_OK) {
mUVSOffset = 0; // don't bother to read the table again
return NS_ERROR_FAILURE;
@ -197,7 +197,7 @@ public:
// Adopts the content of aBuffer.
// Pass a non-null aHashEntry only if it should be cleared if/when this
// FontTableBlobData is deleted.
FontTableBlobData(nsTArray<PRUint8>& aBuffer,
FontTableBlobData(FallibleTArray<PRUint8>& aBuffer,
FontTableHashEntry *aHashEntry)
: mHashEntry(aHashEntry), mHashtable()
{
@ -239,7 +239,7 @@ public:
private:
// The font table data block, owned (via adoption)
nsTArray<PRUint8> mTableData;
FallibleTArray<PRUint8> mTableData;
// The blob destroy function needs to know the hashtable entry,
FontTableHashEntry *mHashEntry;
// and the owning hashtable, so that it can remove the entry.
@ -250,7 +250,7 @@ private:
};
void
gfxFontEntry::FontTableHashEntry::SaveTable(nsTArray<PRUint8>& aTable)
gfxFontEntry::FontTableHashEntry::SaveTable(FallibleTArray<PRUint8>& aTable)
{
Clear();
// adopts elements of aTable
@ -262,7 +262,7 @@ gfxFontEntry::FontTableHashEntry::SaveTable(nsTArray<PRUint8>& aTable)
hb_blob_t *
gfxFontEntry::FontTableHashEntry::
ShareTableAndGetBlob(nsTArray<PRUint8>& aTable,
ShareTableAndGetBlob(FallibleTArray<PRUint8>& aTable,
nsTHashtable<FontTableHashEntry> *aHashtable)
{
Clear();
@ -334,7 +334,7 @@ gfxFontEntry::GetExistingFontTable(PRUint32 aTag, hb_blob_t **aBlob)
hb_blob_t *
gfxFontEntry::ShareFontTableAndGetBlob(PRUint32 aTag,
nsTArray<PRUint8>* aBuffer)
FallibleTArray<PRUint8>* aBuffer)
{
if (NS_UNLIKELY(!mFontTableCache.IsInitialized())) {
// we do this here rather than on fontEntry construction
@ -357,7 +357,7 @@ gfxFontEntry::ShareFontTableAndGetBlob(PRUint32 aTag,
}
void
gfxFontEntry::PreloadFontTable(PRUint32 aTag, nsTArray<PRUint8>& aTable)
gfxFontEntry::PreloadFontTable(PRUint32 aTag, FallibleTArray<PRUint8>& aTable)
{
if (!mFontTableCache.IsInitialized()) {
// This is intended for use with downloaded fonts, to cache the layout
@ -732,7 +732,7 @@ gfxFontFamily::FindFontForChar(FontSearch *aMatchData)
// returns true if other names were found, false otherwise
PRBool
gfxFontFamily::ReadOtherFamilyNamesForFace(gfxPlatformFontList *aPlatformFontList,
nsTArray<PRUint8>& aNameTable,
FallibleTArray<PRUint8>& aNameTable,
PRBool useFullName)
{
const PRUint8 *nameData = aNameTable.Elements();
@ -795,7 +795,7 @@ gfxFontFamily::ReadOtherFamilyNames(gfxPlatformFontList *aPlatformFontList)
// read in other family names for the first face in the list
PRUint32 i, numFonts = mAvailableFonts.Length();
const PRUint32 kNAME = TRUETYPE_TAG('n','a','m','e');
nsAutoTArray<PRUint8,8192> buffer;
AutoFallibleTArray<PRUint8,8192> buffer;
for (i = 0; i < numFonts; ++i) {
gfxFontEntry *fe = mAvailableFonts[i];
@ -843,7 +843,7 @@ gfxFontFamily::ReadFaceNames(gfxPlatformFontList *aPlatformFontList,
PRUint32 i, numFonts = mAvailableFonts.Length();
const PRUint32 kNAME = TRUETYPE_TAG('n','a','m','e');
nsAutoTArray<PRUint8,8192> buffer;
AutoFallibleTArray<PRUint8,8192> buffer;
nsAutoString fullname, psname;
PRBool firstTime = PR_TRUE, readAllFaces = PR_FALSE;
@ -1055,7 +1055,7 @@ gfxFont::GetFontTable(PRUint32 aTag) {
if (mFontEntry->GetExistingFontTable(aTag, &blob))
return blob;
nsTArray<PRUint8> buffer;
FallibleTArray<PRUint8> buffer;
PRBool haveTable = NS_SUCCEEDED(mFontEntry->GetFontTable(aTag, buffer));
return mFontEntry->ShareFontTableAndGetBlob(aTag,
@ -1595,7 +1595,7 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics)
// If the conversion factor from FUnits is not yet set,
// 'head' table is required; otherwise we cannot read any metrics
// because we don't know unitsPerEm
nsAutoTArray<PRUint8,sizeof(HeadTable)> headData;
AutoFallibleTArray<PRUint8,sizeof(HeadTable)> headData;
if (NS_FAILED(mFontEntry->GetFontTable(kHeadTableTag, headData)) ||
headData.Length() < sizeof(HeadTable)) {
return PR_FALSE; // no 'head' table -> not an sfnt
@ -1609,7 +1609,7 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics)
}
// 'hhea' table is required to get vertical extents
nsAutoTArray<PRUint8,sizeof(HheaTable)> hheaData;
AutoFallibleTArray<PRUint8,sizeof(HheaTable)> hheaData;
if (NS_FAILED(mFontEntry->GetFontTable(kHheaTableTag, hheaData)) ||
hheaData.Length() < sizeof(HheaTable)) {
return PR_FALSE; // no 'hhea' table -> not an sfnt
@ -1625,7 +1625,7 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics)
SET_SIGNED(externalLeading, hhea->lineGap);
// 'post' table is required for underline metrics
nsAutoTArray<PRUint8,sizeof(PostTable)> postData;
AutoFallibleTArray<PRUint8,sizeof(PostTable)> postData;
if (NS_FAILED(mFontEntry->GetFontTable(kPostTableTag, postData))) {
return PR_TRUE; // no 'post' table -> sfnt is not valid
}
@ -1640,7 +1640,7 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics)
// 'OS/2' table is optional, if not found we'll estimate xHeight
// and aveCharWidth by measuring glyphs
nsAutoTArray<PRUint8,sizeof(OS2Table)> os2data;
AutoFallibleTArray<PRUint8,sizeof(OS2Table)> os2data;
if (NS_SUCCEEDED(mFontEntry->GetFontTable(kOS_2TableTag, os2data))) {
OS2Table *os2 = reinterpret_cast<OS2Table*>(os2data.Elements());

Просмотреть файл

@ -266,7 +266,7 @@ public:
return PR_TRUE;
}
virtual nsresult GetFontTable(PRUint32 aTableTag, nsTArray<PRUint8>& aBuffer) {
virtual nsresult GetFontTable(PRUint32 aTableTag, FallibleTArray<PRUint8>& aBuffer) {
return NS_ERROR_FAILURE; // all platform subclasses should reimplement this!
}
@ -295,12 +295,12 @@ public:
// Pass NULL for aBuffer to indicate that the table is not present and
// NULL will be returned. Also returns NULL on OOM.
hb_blob_t *ShareFontTableAndGetBlob(PRUint32 aTag,
nsTArray<PRUint8>* aTable);
FallibleTArray<PRUint8>* aTable);
// Preload a font table into the cache (used to store layout tables for
// harfbuzz, when they will be stripped from the actual sfnt being
// passed to platform font APIs for rasterization)
void PreloadFontTable(PRUint32 aTag, nsTArray<PRUint8>& aTable);
void PreloadFontTable(PRUint32 aTag, FallibleTArray<PRUint8>& aTable);
nsString mName;
@ -428,12 +428,12 @@ private:
// recorded in the hashtable entry so that others may use the same
// table.
hb_blob_t *
ShareTableAndGetBlob(nsTArray<PRUint8>& aTable,
ShareTableAndGetBlob(FallibleTArray<PRUint8>& aTable,
nsTHashtable<FontTableHashEntry> *aHashtable);
// Transfer (not copy) elements of aTable to a new hb_blob_t that is
// owned by the hashtable entry.
void SaveTable(nsTArray<PRUint8>& aTable);
void SaveTable(FallibleTArray<PRUint8>& aTable);
// Return a strong reference to the blob.
// Callers must hb_blob_destroy the returned blob.
@ -559,7 +559,7 @@ protected:
PRBool anItalic, PRInt16 aStretch);
PRBool ReadOtherFamilyNamesForFace(gfxPlatformFontList *aPlatformFontList,
nsTArray<PRUint8>& aNameTable,
FallibleTArray<PRUint8>& aNameTable,
PRBool useFullName = PR_FALSE);
// set whether this font family is in "bad" underline offset blacklist.

Просмотреть файл

@ -1279,7 +1279,7 @@ gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData,
nsresult
gfxFontUtils::RenameFont(const nsAString& aName, const PRUint8 *aFontData,
PRUint32 aFontDataLength, nsTArray<PRUint8> *aNewFont)
PRUint32 aFontDataLength, FallibleTArray<PRUint8> *aNewFont)
{
NS_ASSERTION(aNewFont, "null font data array");
@ -1437,14 +1437,14 @@ enum {
};
nsresult
gfxFontUtils::ReadNames(nsTArray<PRUint8>& aNameTable, PRUint32 aNameID,
gfxFontUtils::ReadNames(FallibleTArray<PRUint8>& aNameTable, PRUint32 aNameID,
PRInt32 aPlatformID, nsTArray<nsString>& aNames)
{
return ReadNames(aNameTable, aNameID, LANG_ALL, aPlatformID, aNames);
}
nsresult
gfxFontUtils::ReadCanonicalName(nsTArray<PRUint8>& aNameTable, PRUint32 aNameID,
gfxFontUtils::ReadCanonicalName(FallibleTArray<PRUint8>& aNameTable, PRUint32 aNameID,
nsString& aName)
{
nsresult rv;
@ -1682,7 +1682,7 @@ gfxFontUtils::DecodeFontName(const PRUint8 *aNameData, PRInt32 aByteLen,
}
nsresult
gfxFontUtils::ReadNames(nsTArray<PRUint8>& aNameTable, PRUint32 aNameID,
gfxFontUtils::ReadNames(FallibleTArray<PRUint8>& aNameTable, PRUint32 aNameID,
PRInt32 aLangID, PRInt32 aPlatformID,
nsTArray<nsString>& aNames)
{
@ -1869,7 +1869,8 @@ DumpEOTHeader(PRUint8 *aHeader, PRUint32 aHeaderLen)
nsresult
gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength,
nsTArray<PRUint8> *aHeader, FontDataOverlay *aOverlay)
FallibleTArray<PRUint8> *aHeader,
FontDataOverlay *aOverlay)
{
NS_ASSERTION(aFontData && aFontDataLength != 0, "null font data");
NS_ASSERTION(aHeader, "null header");

Просмотреть файл

@ -691,7 +691,7 @@ public:
// EOT header on output
static nsresult
MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength,
nsTArray<PRUint8> *aHeader, FontDataOverlay *aOverlay);
FallibleTArray<PRUint8> *aHeader, FontDataOverlay *aOverlay);
// determine whether a font (which has already passed ValidateSFNTHeaders)
// is CFF format rather than TrueType
@ -713,17 +713,17 @@ public:
// appended on the end, returns true on success
static nsresult
RenameFont(const nsAString& aName, const PRUint8 *aFontData,
PRUint32 aFontDataLength, nsTArray<PRUint8> *aNewFont);
PRUint32 aFontDataLength, FallibleTArray<PRUint8> *aNewFont);
// read all names matching aNameID, returning in aNames array
static nsresult
ReadNames(nsTArray<PRUint8>& aNameTable, PRUint32 aNameID,
ReadNames(FallibleTArray<PRUint8>& aNameTable, PRUint32 aNameID,
PRInt32 aPlatformID, nsTArray<nsString>& aNames);
// reads English or first name matching aNameID, returning in aName
// platform based on OS
static nsresult
ReadCanonicalName(nsTArray<PRUint8>& aNameTable, PRUint32 aNameID,
ReadCanonicalName(FallibleTArray<PRUint8>& aNameTable, PRUint32 aNameID,
nsString& aName);
// convert a name from the raw name table data into an nsString,
@ -802,7 +802,7 @@ public:
protected:
static nsresult
ReadNames(nsTArray<PRUint8>& aNameTable, PRUint32 aNameID,
ReadNames(FallibleTArray<PRUint8>& aNameTable, PRUint32 aNameID,
PRInt32 aLangID, PRInt32 aPlatformID, nsTArray<nsString>& aNames);
// convert opentype name-table platform/encoding/language values to a charset name

Просмотреть файл

@ -235,7 +235,7 @@ GDIFontEntry::ReadCMAP()
mCmapInitialized = PR_TRUE;
const PRUint32 kCmapTag = TRUETYPE_TAG('c','m','a','p');
nsAutoTArray<PRUint8,16384> buffer;
AutoFallibleTArray<PRUint8,16384> buffer;
if (GetFontTable(kCmapTag, buffer) != NS_OK)
return NS_ERROR_FAILURE;
PRUint8 *cmap = buffer.Elements();
@ -270,7 +270,8 @@ GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, PRBool aNeedsBo
}
nsresult
GDIFontEntry::GetFontTable(PRUint32 aTableTag, nsTArray<PRUint8>& aBuffer)
GDIFontEntry::GetFontTable(PRUint32 aTableTag,
FallibleTArray<PRUint8>& aBuffer)
{
if (!IsTrueType()) {
return NS_ERROR_FAILURE;
@ -866,7 +867,7 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
// for TTF fonts, first try using the t2embed library
if (!isCFF) {
// TrueType-style glyphs, use EOT library
nsAutoTArray<PRUint8,2048> eotHeader;
AutoFallibleTArray<PRUint8,2048> eotHeader;
PRUint8 *buffer;
PRUint32 eotlen;
@ -906,7 +907,7 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
// load CFF fonts or fonts that failed with t2embed loader
if (fontRef == nsnull) {
// Postscript-style glyphs, swizzle name table, load directly
nsTArray<PRUint8> newFontData;
FallibleTArray<PRUint8> newFontData;
isEmbedded = PR_FALSE;
rv = gfxFontUtils::RenameFont(uniqueName, aFontData, aLength, &newFontData);

Просмотреть файл

@ -308,7 +308,8 @@ protected:
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, PRBool aNeedsBold);
virtual nsresult GetFontTable(PRUint32 aTableTag, nsTArray<PRUint8>& aBuffer);
virtual nsresult GetFontTable(PRUint32 aTableTag,
FallibleTArray<PRUint8>& aBuffer);
LOGFONTW mLogFont;
};

Просмотреть файл

@ -208,7 +208,7 @@ gfxMacFont::InitMetrics()
// which then leads to metrics errors when we read the 'hmtx' table to
// get glyph advances for HarfBuzz, see bug 580863)
const PRUint32 kHeadTableTag = TRUETYPE_TAG('h','e','a','d');
nsAutoTArray<PRUint8,sizeof(HeadTable)> headData;
AutoFallibleTArray<PRUint8,sizeof(HeadTable)> headData;
if (NS_SUCCEEDED(mFontEntry->GetFontTable(kHeadTableTag, headData)) &&
headData.Length() >= sizeof(HeadTable)) {
HeadTable *head = reinterpret_cast<HeadTable*>(headData.Elements());

Просмотреть файл

@ -68,7 +68,7 @@ public:
PRBool RequiresAATLayout() const { return mRequiresAAT; }
virtual nsresult GetFontTable(PRUint32 aTableTag, nsTArray<PRUint8>& aBuffer);
virtual nsresult GetFontTable(PRUint32 aTableTag, FallibleTArray<PRUint8>& aBuffer);
PRBool IsCFF();

Просмотреть файл

@ -212,7 +212,7 @@ MacOSFontEntry::ReadCMAP()
PRUint32 kCMAP = TRUETYPE_TAG('c','m','a','p');
nsAutoTArray<PRUint8,16384> cmap;
AutoFallibleTArray<PRUint8,16384> cmap;
if (GetFontTable(kCMAP, cmap) != NS_OK)
return NS_ERROR_FAILURE;
@ -295,7 +295,7 @@ MacOSFontEntry::ReadCMAP()
}
nsresult
MacOSFontEntry::GetFontTable(PRUint32 aTableTag, nsTArray<PRUint8>& aBuffer)
MacOSFontEntry::GetFontTable(PRUint32 aTableTag, FallibleTArray<PRUint8>& aBuffer)
{
nsAutoreleasePool localPool;
@ -593,7 +593,7 @@ gfxSingleFaceMacFontFamily::ReadOtherFamilyNames(gfxPlatformFontList *aPlatformF
return;
const PRUint32 kNAME = TRUETYPE_TAG('n','a','m','e');
nsAutoTArray<PRUint8,8192> buffer;
AutoFallibleTArray<PRUint8,8192> buffer;
if (fe->GetFontTable(kNAME, buffer) != NS_OK)
return;

Просмотреть файл

@ -103,7 +103,7 @@ public:
friend class gfxSkipChars;
private:
typedef nsAutoTArray<PRUint8,256> Buffer;
typedef AutoFallibleTArray<PRUint8,256> Buffer;
/**
* Moves mRunCharCount/mRunSkipped to the buffer (updating mCharCount),

Просмотреть файл

@ -359,7 +359,7 @@ CacheLayoutTablesFromSFNT(const PRUint8* aFontData, PRUint32 aLength,
case TRUETYPE_TAG('G','D','E','F'):
case TRUETYPE_TAG('G','P','O','S'):
case TRUETYPE_TAG('G','S','U','B'): {
nsTArray<PRUint8> buffer;
FallibleTArray<PRUint8> buffer;
if (!buffer.AppendElements(aFontData + dirEntry->offset,
dirEntry->length)) {
NS_WARNING("failed to cache font table - out of memory?");
@ -391,7 +391,7 @@ PreloadTableFromWOFF(const PRUint8* aFontData, PRUint32 aLength,
PRUint32 status = eWOFF_ok;
PRUint32 len = woffGetTableSize(aFontData, aLength, aTableTag, &status);
if (WOFF_SUCCESS(status) && len > 0) {
nsTArray<PRUint8> buffer;
FallibleTArray<PRUint8> buffer;
if (!buffer.AppendElements(len)) {
NS_WARNING("failed to cache font table - out of memory?");
return;

Просмотреть файл

@ -272,10 +272,10 @@ template < >
struct variant_storage_traits<PRUint8[]>
{
typedef std::pair<const void *, int> ConstructorType;
typedef nsTArray<PRUint8> StorageType;
typedef FallibleTArray<PRUint8> StorageType;
static inline StorageType storage_conversion(ConstructorType aBlob)
{
nsTArray<PRUint8> data(aBlob.second);
StorageType data(aBlob.second);
(void)data.AppendElements(static_cast<const PRUint8 *>(aBlob.first),
aBlob.second);
return data;
@ -284,7 +284,7 @@ struct variant_storage_traits<PRUint8[]>
template < >
struct variant_blob_traits<PRUint8[]>
{
static inline nsresult asArray(nsTArray<PRUint8> &aData,
static inline nsresult asArray(FallibleTArray<PRUint8> &aData,
PRUint16 *_type,
PRUint32 *_size,
void **_result)