summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fpdfapi/fpdf_objects.h8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp10
3 files changed, 8 insertions, 16 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index a52132f6b9..0df8be727c 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -138,13 +138,7 @@ class CPDF_Number : public CPDF_Object {
return new CPDF_Number(str);
}
- static CPDF_Number* Create(FX_BOOL bInteger, void* pData) {
- return new CPDF_Number(bInteger, pData);
- }
-
- CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Integer(0) {}
-
- CPDF_Number(FX_BOOL bInteger, void* pData);
+ CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(0) {}
CPDF_Number(int value);
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index ffa5e62a07..1283a3a596 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -163,8 +163,10 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) {
}
_ContentParam& param = m_ParamBuf1[real_index];
if (param.m_Type == PDFOBJ_NUMBER) {
- CPDF_Number* pNumber = CPDF_Number::Create(param.m_Number.m_bInteger,
- &param.m_Number.m_Integer);
+ CPDF_Number* pNumber = param.m_Number.m_bInteger
+ ? CPDF_Number::Create(param.m_Number.m_Integer)
+ : CPDF_Number::Create(param.m_Number.m_Float);
+
param.m_Type = 0;
param.m_pObject = pNumber;
return pNumber;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 2755493136..e82479104f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -247,8 +247,9 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect,
case PDFOBJ_BOOLEAN:
return new CPDF_Boolean(this->AsBoolean()->m_bValue);
case PDFOBJ_NUMBER:
- return new CPDF_Number(((CPDF_Number*)this)->m_bInteger,
- &((CPDF_Number*)this)->m_Integer);
+ if (((CPDF_Number*)this)->m_bInteger)
+ return new CPDF_Number(((CPDF_Number*)this)->m_Integer);
+ return new CPDF_Number(((CPDF_Number*)this)->m_Float);
case PDFOBJ_STRING:
return new CPDF_String(((CPDF_String*)this)->m_String,
((CPDF_String*)this)->IsHex());
@@ -359,11 +360,6 @@ CPDF_Number::CPDF_Number(int value)
CPDF_Number::CPDF_Number(FX_FLOAT value)
: CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) {}
-CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData)
- : CPDF_Object(PDFOBJ_NUMBER),
- m_bInteger(bInteger),
- m_Integer(*(int*)pData) {}
-
CPDF_Number::CPDF_Number(const CFX_ByteStringC& str)
: CPDF_Object(PDFOBJ_NUMBER) {
FX_atonum(str, m_bInteger, &m_Integer);