diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-21 15:46:10 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-21 15:46:10 -0400 |
commit | 710c909117da4297e5a9508bedb306fc5c49eb36 (patch) | |
tree | 53c9bf4471ebe72977773ec8151b4ae44c3975bb /core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | |
parent | 316eb864137a0b8eeb0d0d4d698ba83f4946a89c (diff) | |
download | pdfium-710c909117da4297e5a9508bedb306fc5c49eb36.tar.xz |
Merge to XFA: Add type cast definitions for CPDF_Name.
This Cl adds ToName, CPDF_Object::AsName and CPDF_Object::IsName and
updates the src to use them as needed.
BUG=pdfium:201
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1417823005 .
(cherry picked from commit 1c77edb7b34e03787605b7965784cea38ef9f1d7)
Review URL: https://codereview.chromium.org/1417033004 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index fbb364ee12..6f186e6c3b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -413,11 +413,10 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() { return; } FX_BOOL bDirect = TRUE; - if (pProperty->GetType() == PDFOBJ_NAME) { + if (pProperty->IsName()) { pProperty = FindResourceObj(FX_BSTRC("Properties"), pProperty->GetString()); - if (pProperty == NULL) { + if (!pProperty) return; - } bDirect = FALSE; } if (CPDF_Dictionary* pDict = pProperty->AsDictionary()) { @@ -499,7 +498,8 @@ void _PDF_ReplaceAbbr(CPDF_Object* pObj) { pDict->ReplaceKey(key, fullname); key = fullname; } - if (value->GetType() == PDFOBJ_NAME) { + + if (value->IsName()) { CFX_ByteString name = value->GetString(); fullname = _PDF_FindFullName( _PDF_InlineValueAbbr, @@ -517,7 +517,7 @@ void _PDF_ReplaceAbbr(CPDF_Object* pObj) { CPDF_Array* pArray = (CPDF_Array*)pObj; for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { CPDF_Object* pElement = pArray->GetElement(i); - if (pElement->GetType() == PDFOBJ_NAME) { + if (pElement->IsName()) { CFX_ByteString name = pElement->GetString(); CFX_ByteStringC fullname = _PDF_FindFullName( _PDF_InlineValueAbbr, @@ -562,7 +562,7 @@ void _PDF_ReplaceFull(CPDF_Object* pObj) { pDict->ReplaceKey(key, abbrName); key = abbrName; } - if (value->GetType() == PDFOBJ_NAME) { + if (value->IsName()) { CFX_ByteString name = value->GetString(); abbrName = _PDF_FindAbbrName( _PDF_InlineValueAbbr, @@ -580,7 +580,7 @@ void _PDF_ReplaceFull(CPDF_Object* pObj) { CPDF_Array* pArray = (CPDF_Array*)pObj; for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { CPDF_Object* pElement = pArray->GetElement(i); - if (pElement->GetType() == PDFOBJ_NAME) { + if (pElement->IsName()) { CFX_ByteString name = pElement->GetString(); CFX_ByteStringC abbrName = _PDF_FindAbbrName( _PDF_InlineValueAbbr, @@ -1065,7 +1065,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { } int nargs = m_ParamCount; int nvalues = nargs; - if (pLastParam->GetType() == PDFOBJ_NAME) { + if (pLastParam->IsName()) { nvalues--; } FX_FLOAT* values = NULL; @@ -1095,9 +1095,9 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { } int nargs = m_ParamCount; int nvalues = nargs; - if (pLastParam->GetType() == PDFOBJ_NAME) { + if (pLastParam->IsName()) nvalues--; - } + FX_FLOAT* values = NULL; if (nvalues) { values = FX_Alloc(FX_FLOAT, nvalues); @@ -1357,13 +1357,14 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { if (pArray == NULL) { return; } - int n = pArray->GetCount(), nsegs = 0, i; - for (i = 0; i < n; i++) { + int n = pArray->GetCount(); + int nsegs = 0; + for (int i = 0; i < n; i++) { if (pArray->GetElementValue(i)->IsString()) nsegs++; } if (nsegs == 0) { - for (i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { m_pCurStates->m_TextX -= FXSYS_Mul(pArray->GetNumber(i), m_pCurStates->m_TextState.GetFontSize()) / @@ -1375,7 +1376,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs); int iSegment = 0; FX_FLOAT fInitKerning = 0; - for (i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { CPDF_Object* pObj = pArray->GetElementValue(i); if (pObj->IsString()) { CFX_ByteString str = pObj->GetString(); |