summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-21 13:29:23 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-21 13:29:23 -0400
commit316eb864137a0b8eeb0d0d4d698ba83f4946a89c (patch)
tree9268f9369d9382ca3ee8f7496ab71394dfa9daef /core/src/fpdfapi/fpdf_page
parent43ce9035a026c7b4f15aa938dc39444d9253ea9f (diff)
downloadpdfium-316eb864137a0b8eeb0d0d4d698ba83f4946a89c.tar.xz
Merge to XFA: Add type cast definitions for CPDF_String.
This Cl adds ToString, CPDF_Object::AsString and CPDF_Object::IsString and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1417933002 . (cherry picked from commit 53d3ab125ef583be8cfac907b308a6551b93067a) Review URL: https://codereview.chromium.org/1408323006 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp6
2 files changed, 7 insertions, 8 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 3f0de2d416..584f9c24d3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -906,12 +906,13 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2];
}
m_MaxIndex = pArray->GetInteger(2);
+
CPDF_Object* pTableObj = pArray->GetElementValue(3);
- if (pTableObj == NULL) {
+ if (!pTableObj)
return FALSE;
- }
- if (pTableObj->GetType() == PDFOBJ_STRING) {
- m_Table = ((CPDF_String*)pTableObj)->GetString();
+
+ if (CPDF_String* pString = pTableObj->AsString()) {
+ m_Table = pString->GetString();
} else if (pTableObj->GetType() == PDFOBJ_STREAM) {
CPDF_StreamAcc acc;
acc.LoadAllData((CPDF_Stream*)pTableObj, FALSE);
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 1283a3a596..fbb364ee12 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -1359,10 +1359,8 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
}
int n = pArray->GetCount(), nsegs = 0, i;
for (i = 0; i < n; i++) {
- CPDF_Object* pObj = pArray->GetElementValue(i);
- if (pObj->GetType() == PDFOBJ_STRING) {
+ if (pArray->GetElementValue(i)->IsString())
nsegs++;
- }
}
if (nsegs == 0) {
for (i = 0; i < n; i++) {
@@ -1379,7 +1377,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
FX_FLOAT fInitKerning = 0;
for (i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetElementValue(i);
- if (pObj->GetType() == PDFOBJ_STRING) {
+ if (pObj->IsString()) {
CFX_ByteString str = pObj->GetString();
if (str.IsEmpty()) {
continue;