From 46c8b1e3202ab5ae3663141dc25bec3b4360322e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 25 Mar 2016 13:42:34 -0700 Subject: Replace CFX_DWordArray with CFX_ArrayTemplate. First step to getting rid of FX_DWORD. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1832113003 . --- core/fpdfapi/fpdf_edit/editint.h | 4 ++-- core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 7 ++++--- core/fpdfapi/fpdf_edit/include/cpdf_creator.h | 2 +- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_cidfont.h | 6 +++--- core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_data_avail.h | 4 ++-- core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_hint_tables.h | 8 ++++---- core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 2 +- core/fpdfapi/fpdf_parser/include/cpdf_document.h | 2 +- core/fxcrt/include/fx_basic.h | 1 - core/include/fxge/fx_font.h | 2 +- fpdfsdk/javascript/Field.cpp | 6 +++--- fpdfsdk/javascript/Field.h | 7 ++++--- 15 files changed, 29 insertions(+), 28 deletions(-) diff --git a/core/fpdfapi/fpdf_edit/editint.h b/core/fpdfapi/fpdf_edit/editint.h index 8a73f123a3..eaf93d12da 100644 --- a/core/fpdfapi/fpdf_edit/editint.h +++ b/core/fpdfapi/fpdf_edit/editint.h @@ -29,14 +29,14 @@ class CPDF_ObjectStream { FX_FILESIZE End(CPDF_Creator* pCreator); - CFX_DWordArray m_ObjNumArray; + CFX_ArrayTemplate m_ObjNumArray; CFX_ByteTextBuf m_Buffer; FX_DWORD m_dwObjNum; int32_t m_index; protected: - CFX_DWordArray m_OffsetArray; + CFX_ArrayTemplate m_OffsetArray; }; class CPDF_XRefStream { public: diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index cf79fdc47d..8e1072aa00 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -500,7 +500,8 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString& dest) { dest = (FX_CHAR*)pBuffer; free(pBuffer); } -FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray& charSets) { +FX_BOOL IsHasCharSet(CFArrayRef languages, + const CFX_ArrayTemplate& charSets) { int iCount = charSets.GetSize(); for (int i = 0; i < CFArrayGetCount(languages); ++i) { CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(languages, i); @@ -571,7 +572,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, CFRelease(descriptor); return NULL; } - CFX_DWordArray charSets; + CFX_ArrayTemplate charSets; charSets.Add(FXFONT_CHINESEBIG5_CHARSET); charSets.Add(FXFONT_GB2312_CHARSET); charSets.Add(FXFONT_HANGEUL_CHARSET); @@ -1075,7 +1076,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageDict, - CFX_DWordArray& pageList) { + CFX_ArrayTemplate& pageList) { CPDF_Dictionary* pRoot = pDoc->GetRoot(); if (!pRoot) { return -1; diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h index 0488266564..ad776a2866 100644 --- a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h +++ b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h @@ -93,7 +93,7 @@ class CPDF_Creator { FX_POSITION m_Pos; FX_FILESIZE m_XrefStart; CFX_FileSizeListArray m_ObjectOffset; - CFX_DWordArray m_NewObjNumArray; + CFX_ArrayTemplate m_NewObjNumArray; CPDF_Array* m_pIDArray; int32_t m_FileVersion; }; diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index d528017779..956046c3be 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -812,7 +812,7 @@ void CPDF_CIDFont::LoadSubstFont() { g_CharsetCPs[m_Charset], IsVertWriting()); } void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, - CFX_DWordArray& result, + CFX_ArrayTemplate& result, int nElements) { int width_status = 0; int iCurElement = 0; diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.h b/core/fpdfapi/fpdf_font/cpdf_cidfont.h index 6ff7c825d2..6405d2c342 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.h +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.h @@ -63,7 +63,7 @@ class CPDF_CIDFont : public CPDF_Font { protected: int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph); void LoadMetricsArray(CPDF_Array* pArray, - CFX_DWordArray& result, + CFX_ArrayTemplate& result, int nElements); void LoadSubstFont(); FX_WCHAR GetUnicodeFromCharCode(FX_DWORD charcode) const; @@ -78,10 +78,10 @@ class CPDF_CIDFont : public CPDF_Font { uint16_t m_DefaultWidth; uint16_t* m_pAnsiWidths; FX_SMALL_RECT m_CharBBox[256]; - CFX_DWordArray m_WidthList; + CFX_ArrayTemplate m_WidthList; short m_DefaultVY; short m_DefaultW1; - CFX_DWordArray m_VertMetrics; + CFX_ArrayTemplate m_VertMetrics; FX_BOOL m_bAdobeCourierStd; CFX_CTTGSUBTable* m_pTTGSUBTable; }; diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index c5576ae8e2..2c41c13a5a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -499,7 +499,7 @@ void CPDF_DataAvail::ResetFirstCheck(int iPage) { FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) { FX_DWORD iPageObjs = m_PageObjList.GetSize(); - CFX_DWordArray UnavailObjList; + CFX_ArrayTemplate UnavailObjList; for (FX_DWORD i = 0; i < iPageObjs; ++i) { FX_DWORD dwPageObjNum = m_PageObjList.GetAt(i); FX_BOOL bExist = FALSE; diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h index 4c8d3719ff..036de72968 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h @@ -179,8 +179,8 @@ class CPDF_DataAvail final : public IPDF_DataAvail { FX_DWORD m_bufferSize; CFX_ByteString m_WordBuf; uint8_t m_bufferData[512]; - CFX_DWordArray m_XRefStreamList; - CFX_DWordArray m_PageObjList; + CFX_ArrayTemplate m_XRefStreamList; + CFX_ArrayTemplate m_PageObjList; FX_DWORD m_PagesObjNum; FX_BOOL m_bLinearized; FX_DWORD m_dwFirstPageNo; diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp index 0dd869210e..eafda43965 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp @@ -126,7 +126,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { if (!CanReadFromBitStream(hStream, required_bits)) return FALSE; - CFX_DWordArray dwPageLenArray; + CFX_ArrayTemplate dwPageLenArray; for (int i = 0; i < nPages; ++i) { FX_SAFE_DWORD safePageLen = hStream->GetBits(dwDeltaPageLenBits); safePageLen += dwPageLeastLen; diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h index 3271f5e1ec..f6f862fab6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h @@ -51,10 +51,10 @@ class CPDF_HintTables { CPDF_DataAvail* m_pDataAvail; FX_DWORD m_nFirstPageSharedObjs; FX_FILESIZE m_szFirstPageObjOffset; - CFX_DWordArray m_dwDeltaNObjsArray; - CFX_DWordArray m_dwNSharedObjsArray; - CFX_DWordArray m_dwSharedObjNumArray; - CFX_DWordArray m_dwIdentifierArray; + CFX_ArrayTemplate m_dwDeltaNObjsArray; + CFX_ArrayTemplate m_dwNSharedObjsArray; + CFX_ArrayTemplate m_dwSharedObjNumArray; + CFX_ArrayTemplate m_dwIdentifierArray; std::vector m_szPageOffsetArray; std::vector m_szSharedObjOffsetArray; }; diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index e9896d8099..5312e62d43 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -1010,7 +1010,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { return FALSE; } - CFX_DWordArray WidthArray; + CFX_ArrayTemplate WidthArray; FX_SAFE_DWORD dwAccWidth = 0; for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { WidthArray.Add(pArray->GetIntegerAt(i)); diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h index 02a55dd455..21b9d250fd 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -129,7 +129,7 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { FX_BOOL m_bLinearized; FX_DWORD m_dwFirstPageNo; FX_DWORD m_dwFirstPageObjNum; - CFX_DWordArray m_PageList; + CFX_ArrayTemplate m_PageList; CPDF_DocPageData* m_pDocPage; CPDF_DocRenderData* m_pDocRender; }; diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 3da2e03e60..4f2e83c20b 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -398,7 +398,6 @@ class CFX_ArrayTemplate : public CFX_BasicArray { return -1; } }; -typedef CFX_ArrayTemplate CFX_DWordArray; #ifdef PDF_ENABLE_XFA typedef CFX_ArrayTemplate CFX_WideStringCArray; diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index 7bfe0c22f3..382a916734 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -346,7 +346,7 @@ class CFX_FontMapper { FX_BOOL m_bListLoaded; FXFT_Face m_MMFaces[MM_FACE_COUNT]; CFX_ByteString m_LastFamily; - CFX_DWordArray m_CharsetArray; + CFX_ArrayTemplate m_CharsetArray; std::vector m_FaceArray; IFX_SystemFontInfo* m_pFontInfo; FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 198c833db5..814d2e86fa 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -947,7 +947,7 @@ FX_BOOL Field::currentValueIndices(IJS_Context* cc, if (!m_bCanSet) return FALSE; - CFX_DWordArray array; + CFX_ArrayTemplate array; if (vp.GetType() == CJS_Value::VT_number) { int iSelecting = 0; @@ -1002,7 +1002,7 @@ FX_BOOL Field::currentValueIndices(IJS_Context* cc, void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, - const CFX_DWordArray& array) { + const CFX_ArrayTemplate& array) { ASSERT(pDocument); std::vector FieldArray = @@ -3428,7 +3428,7 @@ void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) { } void Field::AddDelay_WordArray(enum FIELD_PROP prop, - const CFX_DWordArray& array) { + const CFX_ArrayTemplate& array) { CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h index 5e80f72d58..c3045632df 100644 --- a/fpdfsdk/javascript/Field.h +++ b/fpdfsdk/javascript/Field.h @@ -84,7 +84,7 @@ struct CJS_DelayData { CFX_WideString widestring; CFX_FloatRect rect; CPWL_Color color; - CFX_DWordArray wordarray; + CFX_ArrayTemplate wordarray; CJS_WideStringArray widestringarray; }; @@ -344,7 +344,7 @@ class Field : public CJS_EmbedObj { static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, - const CFX_DWordArray& array); + const CFX_ArrayTemplate& array); static void SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex); @@ -476,7 +476,8 @@ class Field : public CJS_EmbedObj { void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string); void AddDelay_Rect(enum FIELD_PROP prop, const CFX_FloatRect& rect); void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color); - void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array); + void AddDelay_WordArray(enum FIELD_PROP prop, + const CFX_ArrayTemplate& array); void AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array); -- cgit v1.2.3