From 182872882a2a25a966e69825d9e7b23715e93957 Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Thu, 6 Jan 2011 20:45:10 -0800 Subject: [PATCH] Bug 610823: Change a few users that use nsTArrays as buffers to explicitly use fallible tarray. r=jdaggett a=blocker --- gfx/thebes/gfxDWriteCommon.cpp | 2 +- gfx/thebes/gfxDWriteCommon.h | 12 +++++------ gfx/thebes/gfxDWriteFontList.cpp | 4 ++-- gfx/thebes/gfxDWriteFontList.h | 2 +- gfx/thebes/gfxFT2FontBase.cpp | 2 +- gfx/thebes/gfxFT2Fonts.cpp | 2 +- gfx/thebes/gfxFT2Utils.cpp | 4 ++-- gfx/thebes/gfxFT2Utils.h | 2 +- gfx/thebes/gfxFont.cpp | 30 ++++++++++++++-------------- gfx/thebes/gfxFont.h | 12 +++++------ gfx/thebes/gfxFontUtils.cpp | 11 +++++----- gfx/thebes/gfxFontUtils.h | 10 +++++----- gfx/thebes/gfxGDIFontList.cpp | 9 +++++---- gfx/thebes/gfxGDIFontList.h | 3 ++- gfx/thebes/gfxMacFont.cpp | 2 +- gfx/thebes/gfxMacPlatformFontList.h | 2 +- gfx/thebes/gfxMacPlatformFontList.mm | 6 +++--- gfx/thebes/gfxSkipChars.h | 2 +- gfx/thebes/gfxUserFontSet.cpp | 4 ++-- storage/src/Variant.h | 6 +++--- 20 files changed, 65 insertions(+), 62 deletions(-) diff --git a/gfx/thebes/gfxDWriteCommon.cpp b/gfx/thebes/gfxDWriteCommon.cpp index 63648bd6a90c..b3915475e58c 100644 --- a/gfx/thebes/gfxDWriteCommon.cpp +++ b/gfx/thebes/gfxDWriteCommon.cpp @@ -59,7 +59,7 @@ gfxDWriteFontFileLoader::CreateStreamFromKey(const void *fontFileReferenceKey, return S_OK; } -gfxDWriteFontFileStream::gfxDWriteFontFileStream(nsTArray *aData) +gfxDWriteFontFileStream::gfxDWriteFontFileStream(FallibleTArray *aData) { mData.SwapElements(*aData); } diff --git a/gfx/thebes/gfxDWriteCommon.h b/gfx/thebes/gfxDWriteCommon.h index ca5ae2d23ff3..1661d1675105 100644 --- a/gfx/thebes/gfxDWriteCommon.h +++ b/gfx/thebes/gfxDWriteCommon.h @@ -109,7 +109,7 @@ FontStretchFromDWriteStretch(DWRITE_FONT_STRETCH aStretch) struct ffReferenceKey { - nsTArray *mArray; + FallibleTArray *mArray; nsID mGUID; }; @@ -147,7 +147,7 @@ public: // IDWriteFontFileLoader methods /** * Important! Note the key here -has- to be a pointer to an - * nsTArray. + * FallibleTArray. */ 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. This array - * will be empty when the function returns. + * loader, the key must be a pointer to an FallibleTArray. This + * array will be empty when the function returns. */ static IDWriteFontFileLoader* Instance() { @@ -184,7 +184,7 @@ public: * * @param aData Font data */ - gfxDWriteFontFileStream(nsTArray *aData); + gfxDWriteFontFileStream(FallibleTArray *aData); ~gfxDWriteFontFileStream(); // IUnknown interface @@ -232,7 +232,7 @@ public: virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64* lastWriteTime); private: - nsTArray mData; + FallibleTArray mData; nsAutoRefCnt mRefCnt; }; diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index f15866d4f9cb..fdac80bd4b2a 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -225,7 +225,7 @@ gfxDWriteFontEntry::IsSymbolFont() nsresult gfxDWriteFontEntry::GetFontTable(PRUint32 aTableTag, - nsTArray &aBuffer) + FallibleTArray &aBuffer) { nsRefPtr fontFace; HRESULT hr; @@ -399,7 +399,7 @@ gfxDWriteFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, return nsnull; } - nsTArray newFontData; + FallibleTArray newFontData; rv = gfxFontUtils::RenameFont(uniqueName, aFontData, aLength, &newFontData); NS_Free((void*)aFontData); diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index 3bd7d8b0a040..8ac282832b3e 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -159,7 +159,7 @@ public: virtual PRBool IsSymbolFont(); virtual nsresult GetFontTable(PRUint32 aTableTag, - nsTArray& aBuffer); + FallibleTArray& aBuffer); nsresult ReadCMAP(); protected: diff --git a/gfx/thebes/gfxFT2FontBase.cpp b/gfx/thebes/gfxFT2FontBase.cpp index 1babb974a7ca..53ada1cc6866 100644 --- a/gfx/thebes/gfxFT2FontBase.cpp +++ b/gfx/thebes/gfxFT2FontBase.cpp @@ -193,7 +193,7 @@ gfxFT2FontBase::GetFontTable(PRUint32 aTag) if (mFontEntry->GetExistingFontTable(aTag, &blob)) return blob; - nsTArray buffer; + FallibleTArray buffer; PRBool haveTable = gfxFT2LockedFace(this).GetFontTable(aTag, buffer); // Cache even when there is no table to save having to open the FT_Face diff --git a/gfx/thebes/gfxFT2Fonts.cpp b/gfx/thebes/gfxFT2Fonts.cpp index ff5d8818bfe8..7ff24d4d2df2 100644 --- a/gfx/thebes/gfxFT2Fonts.cpp +++ b/gfx/thebes/gfxFT2Fonts.cpp @@ -268,7 +268,7 @@ FontEntry::ReadCMAP() NS_ENSURE_TRUE(status == 0, NS_ERROR_FAILURE); NS_ENSURE_TRUE(len != 0, NS_ERROR_FAILURE); - nsAutoTArray buffer; + AutoFallibleTArray buffer; if (!buffer.AppendElements(len)) { return NS_ERROR_FAILURE; } diff --git a/gfx/thebes/gfxFT2Utils.cpp b/gfx/thebes/gfxFT2Utils.cpp index 28481ce1b13c..07504e0cdeab 100644 --- a/gfx/thebes/gfxFT2Utils.cpp +++ b/gfx/thebes/gfxFT2Utils.cpp @@ -354,7 +354,7 @@ gfxFT2LockedFace::GetUVSGlyph(PRUint32 aCharCode, PRUint32 aVariantSelector) } PRBool -gfxFT2LockedFace::GetFontTable(PRUint32 aTag, nsTArray& aBuffer) +gfxFT2LockedFace::GetFontTable(PRUint32 aTag, FallibleTArray& aBuffer) { if (!mFace || !FT_IS_SFNT(mFace)) return PR_FALSE; @@ -365,7 +365,7 @@ gfxFT2LockedFace::GetFontTable(PRUint32 aTag, nsTArray& aBuffer) if (error != 0) return PR_FALSE; - if (NS_UNLIKELY(length > static_cast::size_type>(-1)) + if (NS_UNLIKELY(length > static_cast::size_type>(-1)) || NS_UNLIKELY(!aBuffer.SetLength(length))) return PR_FALSE; diff --git a/gfx/thebes/gfxFT2Utils.h b/gfx/thebes/gfxFT2Utils.h index e7506f5bb5f5..3d83b50306b6 100644 --- a/gfx/thebes/gfxFT2Utils.h +++ b/gfx/thebes/gfxFT2Utils.h @@ -84,7 +84,7 @@ public: void GetMetrics(gfxFont::Metrics* aMetrics, PRUint32* aSpaceGlyph); - PRBool GetFontTable(PRUint32 aTag, nsTArray& aBuffer); + PRBool GetFontTable(PRUint32 aTag, FallibleTArray& aBuffer); // A scale factor for use in converting horizontal metrics from font units // to pixels. diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index ddd28ef39939..45acd72450b2 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -119,7 +119,7 @@ nsresult gfxFontEntry::InitializeUVSMap() if (!mUVSData) { const PRUint32 kCmapTag = TRUETYPE_TAG('c','m','a','p'); - nsAutoTArray buffer; + AutoFallibleTArray 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& aBuffer, + FontTableBlobData(FallibleTArray& aBuffer, FontTableHashEntry *aHashEntry) : mHashEntry(aHashEntry), mHashtable() { @@ -239,7 +239,7 @@ public: private: // The font table data block, owned (via adoption) - nsTArray mTableData; + FallibleTArray 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& aTable) +gfxFontEntry::FontTableHashEntry::SaveTable(FallibleTArray& aTable) { Clear(); // adopts elements of aTable @@ -262,7 +262,7 @@ gfxFontEntry::FontTableHashEntry::SaveTable(nsTArray& aTable) hb_blob_t * gfxFontEntry::FontTableHashEntry:: -ShareTableAndGetBlob(nsTArray& aTable, +ShareTableAndGetBlob(FallibleTArray& aTable, nsTHashtable *aHashtable) { Clear(); @@ -334,7 +334,7 @@ gfxFontEntry::GetExistingFontTable(PRUint32 aTag, hb_blob_t **aBlob) hb_blob_t * gfxFontEntry::ShareFontTableAndGetBlob(PRUint32 aTag, - nsTArray* aBuffer) + FallibleTArray* 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& aTable) +gfxFontEntry::PreloadFontTable(PRUint32 aTag, FallibleTArray& 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& aNameTable, + FallibleTArray& 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 buffer; + AutoFallibleTArray 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 buffer; + AutoFallibleTArray 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 buffer; + FallibleTArray 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 headData; + AutoFallibleTArray 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 hheaData; + AutoFallibleTArray 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 postData; + AutoFallibleTArray 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 os2data; + AutoFallibleTArray os2data; if (NS_SUCCEEDED(mFontEntry->GetFontTable(kOS_2TableTag, os2data))) { OS2Table *os2 = reinterpret_cast(os2data.Elements()); diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 01710efef363..e8575e244267 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -266,7 +266,7 @@ public: return PR_TRUE; } - virtual nsresult GetFontTable(PRUint32 aTableTag, nsTArray& aBuffer) { + virtual nsresult GetFontTable(PRUint32 aTableTag, FallibleTArray& 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* aTable); + FallibleTArray* 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& aTable); + void PreloadFontTable(PRUint32 aTag, FallibleTArray& 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& aTable, + ShareTableAndGetBlob(FallibleTArray& aTable, nsTHashtable *aHashtable); // Transfer (not copy) elements of aTable to a new hb_blob_t that is // owned by the hashtable entry. - void SaveTable(nsTArray& aTable); + void SaveTable(FallibleTArray& 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& aNameTable, + FallibleTArray& aNameTable, PRBool useFullName = PR_FALSE); // set whether this font family is in "bad" underline offset blacklist. diff --git a/gfx/thebes/gfxFontUtils.cpp b/gfx/thebes/gfxFontUtils.cpp index 93bc5bb0534c..3ebfd9f0b1ba 100644 --- a/gfx/thebes/gfxFontUtils.cpp +++ b/gfx/thebes/gfxFontUtils.cpp @@ -1279,7 +1279,7 @@ gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData, nsresult gfxFontUtils::RenameFont(const nsAString& aName, const PRUint8 *aFontData, - PRUint32 aFontDataLength, nsTArray *aNewFont) + PRUint32 aFontDataLength, FallibleTArray *aNewFont) { NS_ASSERTION(aNewFont, "null font data array"); @@ -1437,14 +1437,14 @@ enum { }; nsresult -gfxFontUtils::ReadNames(nsTArray& aNameTable, PRUint32 aNameID, +gfxFontUtils::ReadNames(FallibleTArray& aNameTable, PRUint32 aNameID, PRInt32 aPlatformID, nsTArray& aNames) { return ReadNames(aNameTable, aNameID, LANG_ALL, aPlatformID, aNames); } nsresult -gfxFontUtils::ReadCanonicalName(nsTArray& aNameTable, PRUint32 aNameID, +gfxFontUtils::ReadCanonicalName(FallibleTArray& aNameTable, PRUint32 aNameID, nsString& aName) { nsresult rv; @@ -1682,7 +1682,7 @@ gfxFontUtils::DecodeFontName(const PRUint8 *aNameData, PRInt32 aByteLen, } nsresult -gfxFontUtils::ReadNames(nsTArray& aNameTable, PRUint32 aNameID, +gfxFontUtils::ReadNames(FallibleTArray& aNameTable, PRUint32 aNameID, PRInt32 aLangID, PRInt32 aPlatformID, nsTArray& aNames) { @@ -1869,7 +1869,8 @@ DumpEOTHeader(PRUint8 *aHeader, PRUint32 aHeaderLen) nsresult gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength, - nsTArray *aHeader, FontDataOverlay *aOverlay) + FallibleTArray *aHeader, + FontDataOverlay *aOverlay) { NS_ASSERTION(aFontData && aFontDataLength != 0, "null font data"); NS_ASSERTION(aHeader, "null header"); diff --git a/gfx/thebes/gfxFontUtils.h b/gfx/thebes/gfxFontUtils.h index 6529b929eaa0..16abdba0021c 100644 --- a/gfx/thebes/gfxFontUtils.h +++ b/gfx/thebes/gfxFontUtils.h @@ -691,7 +691,7 @@ public: // EOT header on output static nsresult MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength, - nsTArray *aHeader, FontDataOverlay *aOverlay); + FallibleTArray *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 *aNewFont); + PRUint32 aFontDataLength, FallibleTArray *aNewFont); // read all names matching aNameID, returning in aNames array static nsresult - ReadNames(nsTArray& aNameTable, PRUint32 aNameID, + ReadNames(FallibleTArray& aNameTable, PRUint32 aNameID, PRInt32 aPlatformID, nsTArray& aNames); // reads English or first name matching aNameID, returning in aName // platform based on OS static nsresult - ReadCanonicalName(nsTArray& aNameTable, PRUint32 aNameID, + ReadCanonicalName(FallibleTArray& 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& aNameTable, PRUint32 aNameID, + ReadNames(FallibleTArray& aNameTable, PRUint32 aNameID, PRInt32 aLangID, PRInt32 aPlatformID, nsTArray& aNames); // convert opentype name-table platform/encoding/language values to a charset name diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 8a713fcef1e3..b57906fb906c 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -235,7 +235,7 @@ GDIFontEntry::ReadCMAP() mCmapInitialized = PR_TRUE; const PRUint32 kCmapTag = TRUETYPE_TAG('c','m','a','p'); - nsAutoTArray buffer; + AutoFallibleTArray 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& aBuffer) +GDIFontEntry::GetFontTable(PRUint32 aTableTag, + FallibleTArray& 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 eotHeader; + AutoFallibleTArray 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 newFontData; + FallibleTArray newFontData; isEmbedded = PR_FALSE; rv = gfxFontUtils::RenameFont(uniqueName, aFontData, aLength, &newFontData); diff --git a/gfx/thebes/gfxGDIFontList.h b/gfx/thebes/gfxGDIFontList.h index 650686f6dbd9..f2840d21eada 100644 --- a/gfx/thebes/gfxGDIFontList.h +++ b/gfx/thebes/gfxGDIFontList.h @@ -308,7 +308,8 @@ protected: virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, PRBool aNeedsBold); - virtual nsresult GetFontTable(PRUint32 aTableTag, nsTArray& aBuffer); + virtual nsresult GetFontTable(PRUint32 aTableTag, + FallibleTArray& aBuffer); LOGFONTW mLogFont; }; diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 0fe7d1920db4..4c018257c380 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -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 headData; + AutoFallibleTArray headData; if (NS_SUCCEEDED(mFontEntry->GetFontTable(kHeadTableTag, headData)) && headData.Length() >= sizeof(HeadTable)) { HeadTable *head = reinterpret_cast(headData.Elements()); diff --git a/gfx/thebes/gfxMacPlatformFontList.h b/gfx/thebes/gfxMacPlatformFontList.h index a1cca30efb78..2eb3942eac09 100644 --- a/gfx/thebes/gfxMacPlatformFontList.h +++ b/gfx/thebes/gfxMacPlatformFontList.h @@ -68,7 +68,7 @@ public: PRBool RequiresAATLayout() const { return mRequiresAAT; } - virtual nsresult GetFontTable(PRUint32 aTableTag, nsTArray& aBuffer); + virtual nsresult GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffer); PRBool IsCFF(); diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index ac79c78505a6..a863df996f1d 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -212,7 +212,7 @@ MacOSFontEntry::ReadCMAP() PRUint32 kCMAP = TRUETYPE_TAG('c','m','a','p'); - nsAutoTArray cmap; + AutoFallibleTArray cmap; if (GetFontTable(kCMAP, cmap) != NS_OK) return NS_ERROR_FAILURE; @@ -295,7 +295,7 @@ MacOSFontEntry::ReadCMAP() } nsresult -MacOSFontEntry::GetFontTable(PRUint32 aTableTag, nsTArray& aBuffer) +MacOSFontEntry::GetFontTable(PRUint32 aTableTag, FallibleTArray& aBuffer) { nsAutoreleasePool localPool; @@ -593,7 +593,7 @@ gfxSingleFaceMacFontFamily::ReadOtherFamilyNames(gfxPlatformFontList *aPlatformF return; const PRUint32 kNAME = TRUETYPE_TAG('n','a','m','e'); - nsAutoTArray buffer; + AutoFallibleTArray buffer; if (fe->GetFontTable(kNAME, buffer) != NS_OK) return; diff --git a/gfx/thebes/gfxSkipChars.h b/gfx/thebes/gfxSkipChars.h index f88bb1b6106d..60cb0da6a034 100644 --- a/gfx/thebes/gfxSkipChars.h +++ b/gfx/thebes/gfxSkipChars.h @@ -103,7 +103,7 @@ public: friend class gfxSkipChars; private: - typedef nsAutoTArray Buffer; + typedef AutoFallibleTArray Buffer; /** * Moves mRunCharCount/mRunSkipped to the buffer (updating mCharCount), diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index 97884cb57e5b..42b526e4938a 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -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 buffer; + FallibleTArray 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 buffer; + FallibleTArray buffer; if (!buffer.AppendElements(len)) { NS_WARNING("failed to cache font table - out of memory?"); return; diff --git a/storage/src/Variant.h b/storage/src/Variant.h index c1b06d2896bd..6d968ac6adaa 100644 --- a/storage/src/Variant.h +++ b/storage/src/Variant.h @@ -272,10 +272,10 @@ template < > struct variant_storage_traits { typedef std::pair ConstructorType; - typedef nsTArray StorageType; + typedef FallibleTArray StorageType; static inline StorageType storage_conversion(ConstructorType aBlob) { - nsTArray data(aBlob.second); + StorageType data(aBlob.second); (void)data.AppendElements(static_cast(aBlob.first), aBlob.second); return data; @@ -284,7 +284,7 @@ struct variant_storage_traits template < > struct variant_blob_traits { - static inline nsresult asArray(nsTArray &aData, + static inline nsresult asArray(FallibleTArray &aData, PRUint16 *_type, PRUint32 *_size, void **_result)