summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-11 12:56:51 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-11 12:56:51 -0800
commit0e8141a8d3d2c1ed51561815ac26e5bba801a629 (patch)
tree0a7f4ee8faca409e775d48754b3ade8973c5245e /core/src
parentea269b6973e381042102c7304bfdd19e9cd75349 (diff)
downloadpdfium-0e8141a8d3d2c1ed51561815ac26e5bba801a629.tar.xz
Merge to XFA: CPDF_Object() constructor should set its internal m_Type variable.
Original Review URL: https://codereview.chromium.org/880233005 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/916953002
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index c477ba6f6e..18f06d6a14 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -5,6 +5,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../../include/fpdfapi/fpdf_parser.h"
+#include "../../../include/fxcrt/fx_string.h"
+
void CPDF_Object::Release()
{
if (m_ObjNum) {
@@ -331,30 +333,23 @@ void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len)
((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE);
}
}
+
CPDF_Number::CPDF_Number(int value)
-{
- m_Type = PDFOBJ_NUMBER;
- m_bInteger = TRUE;
- m_Integer = value;
+ : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) {
}
+
CPDF_Number::CPDF_Number(FX_FLOAT value)
-{
- m_Type = PDFOBJ_NUMBER;
- m_bInteger = FALSE;
- m_Float = value;
+ : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) {
}
+
CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData)
-{
- m_Type = PDFOBJ_NUMBER;
- m_bInteger = bInteger;
- m_Integer = *(int*)pData;
+ : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData) {
}
-extern void FX_atonum(FX_BSTR, FX_BOOL&, void*);
-CPDF_Number::CPDF_Number(FX_BSTR str)
-{
- m_Type = PDFOBJ_NUMBER;
+
+CPDF_Number::CPDF_Number(FX_BSTR str) : CPDF_Object(PDFOBJ_NUMBER) {
FX_atonum(str, m_bInteger, &m_Integer);
}
+
void CPDF_Number::SetString(FX_BSTR str)
{
FX_atonum(str, m_bInteger, &m_Integer);
@@ -372,11 +367,8 @@ void CPDF_Number::SetNumber(FX_FLOAT value)
m_bInteger = FALSE;
m_Float = value;
}
-CPDF_String::CPDF_String(const CFX_WideString& str)
-{
- m_Type = PDFOBJ_STRING;
+CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) {
m_String = PDF_EncodeText(str, str.GetLength());
- m_bHex = FALSE;
}
CPDF_Array::~CPDF_Array()
{
@@ -859,8 +851,7 @@ void CPDF_Dictionary::SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix)
SetAt(key, pArray);
}
CPDF_Stream::CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict)
-{
- m_Type = PDFOBJ_STREAM;
+ : CPDF_Object(PDFOBJ_STREAM) {
m_pDict = pDict;
m_dwSize = size;
m_GenNum = (FX_DWORD) - 1;