summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_edit
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-27 12:08:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-27 12:08:12 -0700
commit8d2aae7ee320da3a8ffe01c57e38b3f98443257d (patch)
treee694c6f82ec72fa46e6172b4475996b30d3f6a3a /core/src/fpdfapi/fpdf_edit
parentff46aaf499edcf153ee2f57c7016587aa96dcfa0 (diff)
downloadpdfium-8d2aae7ee320da3a8ffe01c57e38b3f98443257d.tar.xz
Revert "FX Bool considered harmful, part 3"
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255293002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_edit')
-rw-r--r--core/src/fpdfapi/fpdf_edit/editint.h14
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp244
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp38
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp24
5 files changed, 164 insertions, 164 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h
index bc4c72aff9..4aec32a49a 100644
--- a/core/src/fpdfapi/fpdf_edit/editint.h
+++ b/core/src/fpdfapi/fpdf_edit/editint.h
@@ -12,7 +12,7 @@ class CPDF_ObjectStream
public:
CPDF_ObjectStream();
- bool Start();
+ FX_BOOL Start();
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj);
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize);
@@ -34,15 +34,15 @@ public:
CPDF_XRefStream();
- bool Start();
+ FX_BOOL Start();
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator);
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator);
- bool End(CPDF_Creator *pCreator, bool bEOF = false);
- bool AddObjectNumberToIndexArray(FX_DWORD objnum);
- bool EndXRefStream(CPDF_Creator* pCreator);
+ FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE);
+ FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum);
+ FX_BOOL EndXRefStream(CPDF_Creator* pCreator);
CFX_DWordArray m_IndexArray;
@@ -51,8 +51,8 @@ public:
FX_DWORD m_dwTempObjNum;
protected:
- int32_t EndObjectStream(CPDF_Creator *pCreator, bool bEOF = true);
- bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
+ int32_t EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE);
+ FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF);
int32_t m_iSeg;
CPDF_ObjectStream m_ObjStream;
CFX_ByteTextBuf m_Buffer;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index b84936c273..65f78dab13 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -28,10 +28,10 @@ CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) : m_pPage(p
CPDF_PageContentGenerate::~CPDF_PageContentGenerate()
{
}
-bool CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject)
+FX_BOOL CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject)
{
if (!pPageObject) {
- return false;
+ return FALSE;
}
return m_pageObjects.Add(pPageObject);
}
@@ -51,7 +51,7 @@ void CPDF_PageContentGenerate::GenerateContent()
pPageDict->RemoveAt("Contents");
}
CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
- pStream->SetData(buf.GetBuffer(), buf.GetLength(), false, false);
+ pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
m_pDocument->AddIndirectObject(pStream);
pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
}
@@ -158,7 +158,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix)
ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);
}
CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
- pStream->SetData(buf.GetBuffer(), buf.GetLength(), false, false);
+ pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
m_pDocument->AddIndirectObject(pStream);
m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index b197b25979..22826a3609 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -13,7 +13,7 @@
extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, uint8_t*& dest_buf, FX_DWORD& dest_size);
extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns,
uint8_t*& dest_buf, FX_DWORD& dest_size);
-extern bool IsSignatureDict(const CPDF_Dictionary* pDict);
+extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict);
int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset)
{
int32_t len = 0;
@@ -43,7 +43,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *
break;
case PDFOBJ_STRING: {
CFX_ByteString str = pObj->GetString();
- bool bHex = ((CPDF_String*)pObj)->IsHex();
+ FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex();
if ((len = pFile->AppendString(PDF_EncodeString(str, bHex))) < 0) {
return -1;
}
@@ -156,7 +156,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *
}
offset += 8;
CPDF_StreamAcc acc;
- acc.LoadAllData(p, true);
+ acc.LoadAllData(p, TRUE);
if (pFile->AppendBlock(acc.GetData(), acc.GetSize()) < 0) {
return -1;
}
@@ -168,12 +168,12 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *
break;
}
default:
- ASSERT(false);
+ ASSERT(FALSE);
break;
}
return 1;
}
-int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, bool bCompress)
+int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress)
{
FX_FILESIZE offset = 0;
int32_t len = 0;
@@ -285,10 +285,10 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dw
offset += len + 6;
return offset;
}
-bool PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer)
+FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer)
{
if (!pBuffer) {
- return false;
+ return FALSE;
}
void* pContext = FX_Random_MT_Start(dwSeed1);
int32_t i = 0;
@@ -301,21 +301,21 @@ bool PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer)
*pBuffer++ = FX_Random_MT_Generate(pContext);
}
FX_Random_MT_Close(pContext);
- return true;
+ return TRUE;
}
class CPDF_FlateEncoder
{
public:
CPDF_FlateEncoder();
~CPDF_FlateEncoder();
- bool Initialize(CPDF_Stream* pStream, bool bFlateEncode);
- bool Initialize(const uint8_t* pBuffer, FX_DWORD size, bool bFlateEncode, bool bXRefStream = false);
+ FX_BOOL Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode);
+ FX_BOOL Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE);
void CloneDict();
uint8_t* m_pData;
FX_DWORD m_dwSize;
CPDF_Dictionary* m_pDict;
- bool m_bCloned;
- bool m_bNewData;
+ FX_BOOL m_bCloned;
+ FX_BOOL m_bNewData;
CPDF_StreamAcc m_Acc;
};
CPDF_FlateEncoder::CPDF_FlateEncoder()
@@ -323,19 +323,19 @@ CPDF_FlateEncoder::CPDF_FlateEncoder()
m_pData = NULL;
m_dwSize = 0;
m_pDict = NULL;
- m_bCloned = false;
- m_bNewData = false;
+ m_bCloned = FALSE;
+ m_bNewData = FALSE;
}
void CPDF_FlateEncoder::CloneDict()
{
if (!m_bCloned) {
m_pDict = (CPDF_Dictionary*)m_pDict->Clone();
- m_bCloned = true;
+ m_bCloned = TRUE;
}
}
-bool CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, bool bFlateEncode)
+FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
{
- m_Acc.LoadAllData(pStream, true);
+ m_Acc.LoadAllData(pStream, TRUE);
if ((pStream && pStream->GetDict() && pStream->GetDict()->KeyExist("Filter")) || !bFlateEncode) {
if (pStream->GetDict()->KeyExist("Filter") && !bFlateEncode) {
CPDF_StreamAcc destAcc;
@@ -344,40 +344,40 @@ bool CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, bool bFlateEncode)
m_pData = (uint8_t*)destAcc.DetachData();
m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone();
m_pDict->RemoveAt(FX_BSTRC("Filter"));
- m_bNewData = true;
- m_bCloned = true;
+ m_bNewData = TRUE;
+ m_bCloned = TRUE;
} else {
m_pData = (uint8_t*)m_Acc.GetData();
m_dwSize = m_Acc.GetSize();
m_pDict = pStream->GetDict();
}
- return true;
+ return TRUE;
}
m_pData = NULL;
m_dwSize = 0;
- m_bNewData = true;
- m_bCloned = true;
+ m_bNewData = TRUE;
+ m_bCloned = TRUE;
::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), m_pData, m_dwSize);
m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone();
m_pDict->SetAtInteger("Length", m_dwSize);
m_pDict->SetAtName("Filter", "FlateDecode");
m_pDict->RemoveAt("DecodeParms");
- return true;
+ return TRUE;
}
-bool CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, FX_DWORD size, bool bFlateEncode, bool bXRefStream)
+FX_BOOL CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream)
{
if (!bFlateEncode) {
m_pData = (uint8_t*)pBuffer;
m_dwSize = size;
- return true;
+ return TRUE;
}
- m_bNewData = true;
+ m_bNewData = TRUE;
if (bXRefStream) {
::FlateEncode(pBuffer, size, 12, 1, 8, 7, m_pData, m_dwSize);
} else {
::FlateEncode(pBuffer, size, m_pData, m_dwSize);
}
- return true;
+ return TRUE;
}
CPDF_FlateEncoder::~CPDF_FlateEncoder()
{
@@ -393,33 +393,33 @@ class CPDF_Encryptor
public:
CPDF_Encryptor();
~CPDF_Encryptor();
- bool Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size);
+ FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size);
uint8_t* m_pData;
FX_DWORD m_dwSize;
- bool m_bNewBuf;
+ FX_BOOL m_bNewBuf;
};
CPDF_Encryptor::CPDF_Encryptor()
{
m_pData = NULL;
m_dwSize = 0;
- m_bNewBuf = false;
+ m_bNewBuf = FALSE;
}
-bool CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size)
+FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size)
{
if (src_size == 0) {
- return true;
+ return TRUE;
}
if (pHandler == NULL) {
m_pData = (uint8_t*)src_data;
m_dwSize = src_size;
- m_bNewBuf = false;
- return true;
+ m_bNewBuf = FALSE;
+ return TRUE;
}
m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size);
m_pData = FX_Alloc(uint8_t, m_dwSize);
pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize);
- m_bNewBuf = true;
- return true;
+ m_bNewBuf = TRUE;
+ return TRUE;
}
CPDF_Encryptor::~CPDF_Encryptor()
{
@@ -432,14 +432,14 @@ CPDF_ObjectStream::CPDF_ObjectStream()
, m_index(0)
{
}
-bool CPDF_ObjectStream::Start()
+FX_BOOL CPDF_ObjectStream::Start()
{
m_ObjNumArray.RemoveAll();
m_OffsetArray.RemoveAll();
m_Buffer.Clear();
m_dwObjNum = 0;
m_index = 0;
- return true;
+ return TRUE;
}
int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj)
{
@@ -547,12 +547,12 @@ CPDF_XRefStream::CPDF_XRefStream()
, m_iSeg(0)
{
}
-bool CPDF_XRefStream::Start()
+FX_BOOL CPDF_XRefStream::Start()
{
m_IndexArray.RemoveAll();
m_Buffer.Clear();
m_iSeg = 0;
- return true;
+ return TRUE;
}
int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator)
{
@@ -578,7 +578,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t
}
return EndObjectStream(pCreator);
}
-static void _AppendIndex0(CFX_ByteTextBuf& buffer, bool bFirstObject = true)
+static void _AppendIndex0(CFX_ByteTextBuf& buffer, FX_BOOL bFirstObject = TRUE)
{
buffer.AppendByte(0);
buffer.AppendByte(0);
@@ -613,7 +613,7 @@ static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t inde
buffer.AppendByte(FX_GETBYTEOFFSET8(index));
buffer.AppendByte(FX_GETBYTEOFFSET0(index));
}
-int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, bool bEOF)
+int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
{
FX_FILESIZE objOffset = 0;
if (bEOF) {
@@ -644,7 +644,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, bool bEOF)
_AppendIndex2(m_Buffer, dwObjStmNum, index++);
}
} else {
- _AppendIndex0(m_Buffer, false);
+ _AppendIndex0(m_Buffer, FALSE);
}
}
if (iSize > 0 && bEOF) {
@@ -682,12 +682,12 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, bool bEOF)
}
return 1;
}
-bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF)
+FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF)
{
FX_FILESIZE offset_tmp = pCreator->m_Offset;
FX_DWORD objnum = ++pCreator->m_dwLastObjNum;
CFX_FileBufferArchive *pFile = &pCreator->m_File;
- bool bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
+ FX_BOOL bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
if (bIncremental) {
AddObjectNumberToIndexArray(objnum);
} else {
@@ -696,7 +696,7 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF)
if (offset) {
_AppendIndex1(m_Buffer, *offset);
} else {
- _AppendIndex0(m_Buffer, false);
+ _AppendIndex0(m_Buffer, FALSE);
}
}
}
@@ -704,49 +704,49 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF)
FX_FILESIZE &offset = pCreator->m_Offset;
int32_t len = pFile->AppendDWord(objnum);
if (len < 0) {
- return false;
+ return FALSE;
}
offset += len;
if ((len = pFile->AppendString(FX_BSTRC(" 0 obj\r\n<</Type /XRef/W[1 4 2]/Index["))) < 0) {
- return false;
+ return FALSE;
}
offset += len;
if (!bIncremental) {
if ((len = pFile->AppendDWord(0)) < 0) {
- return false;
+ return FALSE;
}
if ((len = pFile->AppendString(FX_BSTRC(" "))) < 0) {
- return false;
+ return FALSE;
}
offset += len + 1;
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
- return false;
+ return FALSE;
}
offset += len;
} else {
int32_t iSeg = m_IndexArray.GetSize() / 2;
for (int32_t i = 0; i < iSeg; i++) {
if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2))) < 0) {
- return false;
+ return FALSE;
}
if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
- return false;
+ return FALSE;
}
offset += len + 1;
if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2 + 1))) < 0) {
- return false;
+ return FALSE;
}
if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
- return false;
+ return FALSE;
}
offset += len + 1;
}
}
if (pFile->AppendString(FX_BSTRC("]/Size ")) < 0) {
- return false;
+ return FALSE;
}
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
- return false;
+ return FALSE;
}
offset += len + 7;
if (m_PrevOffset > 0) {
@@ -762,26 +762,26 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF)
}
offset += len + 6;
}
- bool bPredictor = true;
+ FX_BOOL bPredictor = TRUE;
CPDF_FlateEncoder encoder;
encoder.Initialize(m_Buffer.GetBuffer(), m_Buffer.GetLength(), pCreator->m_bCompress, bPredictor);
if (pCreator->m_bCompress) {
if (pFile->AppendString(FX_BSTRC("/Filter /FlateDecode")) < 0) {
- return false;
+ return FALSE;
}
offset += 20;
if (bPredictor) {
if ((len = pFile->AppendString(FX_BSTRC("/DecodeParms<</Columns 7/Predictor 12>>"))) < 0) {
- return false;
+ return FALSE;
}
offset += len;
}
}
if (pFile->AppendString(FX_BSTRC("/Length ")) < 0) {
- return false;
+ return FALSE;
}
if ((len = pFile->AppendDWord(encoder.m_dwSize)) < 0) {
- return false;
+ return FALSE;
}
offset += len + 8;
if (bEOF) {
@@ -801,27 +801,27 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF)
}
}
if ((len = pFile->AppendString(FX_BSTRC(">>stream\r\n"))) < 0) {
- return false;
+ return FALSE;
}
offset += len;
if (pFile->AppendBlock(encoder.m_pData, encoder.m_dwSize) < 0) {
- return false;
+ return FALSE;
}
if ((len = pFile->AppendString(FX_BSTRC("\r\nendstream\r\nendobj\r\n"))) < 0) {
- return false;
+ return FALSE;
}
offset += encoder.m_dwSize + len;
m_PrevOffset = offset_tmp;
- return true;
+ return TRUE;
}
-bool CPDF_XRefStream::End(CPDF_Creator *pCreator, bool bEOF )
+FX_BOOL CPDF_XRefStream::End(CPDF_Creator *pCreator, FX_BOOL bEOF )
{
if (EndObjectStream(pCreator, bEOF) < 0) {
- return false;
+ return FALSE;
}
return GenerateXRefStream(pCreator, bEOF);
}
-bool CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
+FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
{
if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) {
_AppendIndex0(m_Buffer);
@@ -830,7 +830,7 @@ bool CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
if (offset) {
_AppendIndex1(m_Buffer, *offset);
} else {
- _AppendIndex0(m_Buffer, false);
+ _AppendIndex0(m_Buffer, FALSE);
}
}
} else {
@@ -843,9 +843,9 @@ bool CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
}
}
}
- return GenerateXRefStream(pCreator, false);
+ return GenerateXRefStream(pCreator, FALSE);
}
-bool CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
+FX_BOOL CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
{
int32_t iSize = m_IndexArray.GetSize();
if (iSize == 0) {
@@ -862,13 +862,13 @@ bool CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
m_IndexArray.Add(1);
}
}
- return true;
+ return TRUE;
}
CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
{
m_pDocument = pDoc;
m_pParser = (CPDF_Parser*)pDoc->m_pParser;
- m_bCompress = true;
+ m_bCompress = TRUE;
if (m_pParser) {
m_pEncryptDict = m_pParser->GetEncryptDict();
m_pCryptoHandler = m_pParser->GetCryptoHandler();
@@ -876,11 +876,11 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
m_pEncryptDict = NULL;
m_pCryptoHandler = NULL;
}
- m_bSecurityChanged = false;
- m_bStandardSecurity = false;
+ m_bSecurityChanged = FALSE;
+ m_bStandardSecurity = FALSE;
m_pMetadata = NULL;
- m_bEncryptCloned = false;
- m_bEncryptMetadata = false;
+ m_bEncryptCloned = FALSE;
+ m_bEncryptMetadata = FALSE;
m_Offset = 0;
m_iStage = -1;
m_dwFlags = 0;
@@ -892,7 +892,7 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
m_pIDArray = NULL;
m_FileVersion = 0;
m_dwEnryptObjNum = 0;
- m_bNewCrypto = false;
+ m_bNewCrypto = FALSE;
}
CPDF_Creator::~CPDF_Creator()
{
@@ -903,10 +903,10 @@ CPDF_Creator::~CPDF_Creator()
}
Clear();
}
-static bool _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag)
+static FX_BOOL _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag)
{
if (!(flag & FPDFCREATE_INCREMENTAL)) {
- return false;
+ return FALSE;
}
int32_t iSize = pXRef->m_IndexArray.GetSize() / 2;
int32_t iCount = 0;
@@ -1001,7 +1001,7 @@ int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum)
int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto)
{
CPDF_FlateEncoder encoder;
- encoder.Initialize((CPDF_Stream*)pStream, pStream == m_pMetadata ? false : m_bCompress);
+ encoder.Initialize((CPDF_Stream*)pStream, pStream == m_pMetadata ? FALSE : m_bCompress);
CPDF_Encryptor encryptor;
if(!encryptor.Initialize(pCrypto, objnum, encoder.m_pData, encoder.m_dwSize)) {
return -1;
@@ -1067,7 +1067,7 @@ int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj)
}
return WriteIndirectObj(pObj->GetObjNum(), pObj);
}
-int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, bool bEncrypt)
+int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt)
{
int32_t len = 0;
if (pObj == NULL) {
@@ -1096,7 +1096,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, b
break;
case PDFOBJ_STRING: {
CFX_ByteString str = pObj->GetString();
- bool bHex = ((CPDF_String*)pObj)->IsHex();
+ FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex();
if (m_pCryptoHandler == NULL || !bEncrypt) {
CFX_ByteString content = PDF_EncodeString(str, bHex);
if ((len = m_File.AppendString(content)) < 0) {
@@ -1206,10 +1206,10 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, b
}
m_Offset += 2;
CPDF_Dictionary* p = (CPDF_Dictionary*)pObj;
- bool bSignDict = IsSignatureDict(p);
+ FX_BOOL bSignDict = IsSignatureDict(p);
FX_POSITION pos = p->GetStartPos();
while (pos) {
- bool bSignValue = false;
+ FX_BOOL bSignValue = FALSE;
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
if (m_File.AppendString(FX_BSTRC("/")) < 0) {
@@ -1220,7 +1220,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, b
}
m_Offset += len + 1;
if (bSignDict && key == FX_BSTRC("Contents")) {
- bSignValue = true;
+ bSignValue = TRUE;
}
if (pValue->GetObjNum()) {
if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
@@ -1255,8 +1255,8 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
}
m_ObjectOffset[objnum] = m_Offset;
void* valuetemp = NULL;
- bool bExistInMap = m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, valuetemp);
- bool bObjStm = (m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream;
+ FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, valuetemp);
+ FX_BOOL bObjStm = (m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream;
if(m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap || bObjStm) {
CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
if (pObj == NULL) {
@@ -1334,7 +1334,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause)
}
return 0;
}
-int32_t CPDF_Creator::WriteNewObjs(bool bIncremental, IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause)
{
int32_t iCount = m_NewObjNumArray.GetSize();
int32_t index = (int32_t)(uintptr_t)m_Pos;
@@ -1385,8 +1385,8 @@ void CPDF_Creator::InitOldObjNumOffsets()
}
void CPDF_Creator::InitNewObjNumOffsets()
{
- bool bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
- bool bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
+ FX_BOOL bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
+ FX_BOOL bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
FX_DWORD nOldSize = m_pParser ? m_pParser->m_CrossRef.GetSize() : 0;
FX_POSITION pos = m_pDocument->m_IndirectObjs.GetStartPosition();
while (pos) {
@@ -1414,7 +1414,7 @@ void CPDF_Creator::InitNewObjNumOffsets()
}
int32_t i = 0;
FX_DWORD dwStartObjNum = 0;
- bool bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
+ FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
while (i < iCount) {
dwStartObjNum = m_NewObjNumArray.ElementAt(i);
if ((bIncremental && (bNoOriginal || bCrossRefValid)) || !m_ObjectOffset.GetPtrAt(dwStartObjNum)) {
@@ -1427,10 +1427,10 @@ void CPDF_Creator::InitNewObjNumOffsets()
}
FX_DWORD dwLastObjNum = dwStartObjNum;
i++;
- bool bNewStart = false;
+ FX_BOOL bNewStart = FALSE;
for (; i < iCount; i++) {
FX_DWORD dwCurObjNum = m_NewObjNumArray.ElementAt(i);
- bool bExist = (dwCurObjNum < nOldSize && m_ObjectOffset.GetPtrAt(dwCurObjNum) != NULL);
+ FX_BOOL bExist = (dwCurObjNum < nOldSize && m_ObjectOffset.GetPtrAt(dwCurObjNum) != NULL);
if (bExist || dwCurObjNum - dwLastObjNum > 1) {
if (!bNewStart) {
m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1);
@@ -1546,7 +1546,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_pParser->GetLastXRefOffset() == 0) {
InitOldObjNumOffsets();
FX_DWORD dwEnd = m_pParser->GetLastObjNum();
- bool bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0;
+ FX_BOOL bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0;
for (FX_DWORD objnum = 0; objnum <= dwEnd; objnum++) {
if (m_pParser->m_V5Type[objnum] == 0 || m_pParser->m_V5Type[objnum] == 255) {
continue;
@@ -1622,7 +1622,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
if (m_iStage == 80) {
m_XrefStart = m_Offset;
if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) {
- m_pXRefStream->End(this, true);
+ m_pXRefStream->End(this, TRUE);
m_XrefStart = m_pXRefStream->m_PrevOffset;
m_iStage = 90;
} else if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 || !m_pParser->IsXRefStream()) {
@@ -1765,7 +1765,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause)
{
FXSYS_assert(m_iStage >= 90);
if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) {
- bool bXRefStream = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
+ FX_BOOL bXRefStream = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
if (!bXRefStream) {
if (m_File.AppendString(FX_BSTRC("trailer\r\n<<")) < 0) {
return -1;
@@ -1976,39 +1976,39 @@ void CPDF_Creator::Clear()
m_pIDArray = NULL;
}
}
-bool CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags)
+FX_BOOL CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags)
{
if (!m_File.AttachFile(filename)) {
- return false;
+ return FALSE;
}
- bool bRet = Create(flags);
+ FX_BOOL bRet = Create(flags);
if (!bRet || !(flags & FPDFCREATE_PROGRESSIVE)) {
Clear();
}
return bRet;
}
-bool CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags)
+FX_BOOL CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags)
{
if (!m_File.AttachFile(filename)) {
- return false;
+ return FALSE;
}
- bool bRet = Create(flags);
+ FX_BOOL bRet = Create(flags);
if (!bRet || !(flags & FPDFCREATE_PROGRESSIVE)) {
Clear();
}
return bRet;
}
-bool CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags)
+FX_BOOL CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags)
{
if (!pFile) {
- return false;
+ return FALSE;
}
- if (!m_File.AttachFile(pFile, false)) {
- return false;
+ if (!m_File.AttachFile(pFile, FALSE)) {
+ return FALSE;
}
return Create(flags);
}
-bool CPDF_Creator::Create(FX_DWORD flags)
+FX_BOOL CPDF_Creator::Create(FX_DWORD flags)
{
m_dwFlags = flags;
m_iStage = 0;
@@ -2019,14 +2019,14 @@ bool CPDF_Creator::Create(FX_DWORD flags)
m_NewObjNumArray.RemoveAll();
InitID();
if (flags & FPDFCREATE_PROGRESSIVE) {
- return true;
+ return TRUE;
}
return Continue(NULL) > -1;
}
-void CPDF_Creator::InitID(bool bDefault )
+void CPDF_Creator::InitID(FX_BOOL bDefault )
{
CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : NULL;
- bool bNewId = !m_pIDArray;
+ FX_BOOL bNewId = !m_pIDArray;
if (!m_pIDArray) {
FX_DWORD* pBuffer = NULL;
m_pIDArray = CPDF_Array::Create();
@@ -2037,7 +2037,7 @@ void CPDF_Creator::InitID(bool bDefault )
pBuffer = FX_Alloc(FX_DWORD, 4);
PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer);
CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD));
- m_pIDArray->Add(CPDF_String::Create(bsBuffer, true), m_pDocument);
+ m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
}
if (pBuffer) {
FX_Free(pBuffer);
@@ -2055,7 +2055,7 @@ void CPDF_Creator::InitID(bool bDefault )
FX_DWORD* pBuffer = FX_Alloc(FX_DWORD, 4);
PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer);
CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD));
- m_pIDArray->Add(CPDF_String::Create(bsBuffer, true), m_pDocument);
+ m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
FX_Free(pBuffer);
return;
}
@@ -2071,8 +2071,8 @@ void CPDF_Creator::InitID(bool bDefault )
}
m_pCryptoHandler = new CPDF_StandardCryptoHandler;
m_pCryptoHandler->Init(m_pEncryptDict, &handler);
- m_bNewCrypto = true;
- m_bSecurityChanged = true;
+ m_bNewCrypto = TRUE;
+ m_bSecurityChanged = TRUE;
}
}
}
@@ -2103,18 +2103,18 @@ int32_t CPDF_Creator::Continue(IFX_Pause *pPause)
}
return m_iStage;
}
-bool CPDF_Creator::SetFileVersion(int32_t fileVersion )
+FX_BOOL CPDF_Creator::SetFileVersion(int32_t fileVersion )
{
if (fileVersion < 10 || fileVersion > 17) {
- return false;
+ return FALSE;
}
m_FileVersion = fileVersion;
- return true;
+ return TRUE;
}
void CPDF_Creator::RemoveSecurity()
{
ResetStandardSecurity();
- m_bSecurityChanged = true;
+ m_bSecurityChanged = TRUE;
m_pEncryptDict = NULL;
m_pCryptoHandler = NULL;
}
@@ -2124,7 +2124,7 @@ void CPDF_Creator::ResetStandardSecurity()
delete m_pCryptoHandler;
m_pCryptoHandler = NULL;
}
- m_bNewCrypto = false;
+ m_bNewCrypto = FALSE;
if (!m_bStandardSecurity) {
return;
}
@@ -2132,5 +2132,5 @@ void CPDF_Creator::ResetStandardSecurity()
m_pEncryptDict->Release();
m_pEncryptDict = NULL;
}
- m_bStandardSecurity = false;
+ m_bStandardSecurity = FALSE;
}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 3621c7957a..5a5fb94ef3 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -12,7 +12,7 @@ CPDF_Document::CPDF_Document() : CPDF_IndirectObjects(NULL)
{
m_pRootDict = NULL;
m_pInfoDict = NULL;
- m_bLinearized = false;
+ m_bLinearized = FALSE;
m_dwFirstPageNo = 0;
m_dwFirstPageObjNum = 0;
m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this);
@@ -215,7 +215,7 @@ static void _InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArr
}
FX_Free(widths);
}
-CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, bool bVert, bool bTranslateName)
+CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_BOOL bTranslateName)
{
LOGFONTA lfa;
FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
@@ -239,7 +239,7 @@ CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC)
}
return result;
}
-CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, bool bVert, bool bTranslateName)
+CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_BOOL bTranslateName)
{
pLogFont->lfHeight = -1000;
pLogFont->lfWidth = 0;
@@ -269,7 +269,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, bool bVert, bool bT
if ((pLogFont->lfPitchAndFamily & 0xf8) == FF_SCRIPT) {
flags |= PDFFONT_SCRIPT;
}
- bool bCJK = pLogFont->lfCharSet == CHINESEBIG5_CHARSET || pLogFont->lfCharSet == GB2312_CHARSET ||
+ FX_BOOL bCJK = pLogFont->lfCharSet == CHINESEBIG5_CHARSET || pLogFont->lfCharSet == GB2312_CHARSET ||
pLogFont->lfCharSet == HANGEUL_CHARSET || pLogFont->lfCharSet == SHIFTJIS_CHARSET;
CFX_ByteString basefont;
if (bTranslateName && bCJK) {
@@ -549,7 +549,7 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest)
dest = (FX_CHAR*)pBuffer;
free(pBuffer);
}
-bool IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
+FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
{
int iCount = charSets.GetSize();
for (int i = 0; i < CFArrayGetCount(languages); ++i) {
@@ -557,11 +557,11 @@ bool IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
FX_DWORD CharSet = FX_GetCharsetFromLang(CFStringGetCStringPtr(language, kCFStringEncodingMacRoman), -1);
for (int j = 0; j < iCount; ++j) {
if (CharSet == charSets[j]) {
- return true;
+ return TRUE;
}
}
}
- return false;
+ return FALSE;
}
void FX_GetCharWidth(CTFontRef font, UniChar start, UniChar end, int* width)
{
@@ -599,7 +599,7 @@ static void _InsertWidthArray(CTFontRef font, int start, int end, CPDF_Array* pW
}
FX_Free(widths);
}
-CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslateName)
+CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTranslateName)
{
CTFontRef font = (CTFontRef)pFont;
CTFontDescriptorRef descriptor = CTFontCopyFontDescriptor(font);
@@ -607,7 +607,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslat
return NULL;
}
CFX_ByteString basefont;
- bool bCJK = false;
+ FX_BOOL bCJK = FALSE;
int flags = 0, italicangle = 0, ascend = 0, descend = 0, capheight = 0, bbox[4];
FXSYS_memset(bbox, 0, sizeof(int) * 4);
CFArrayRef languages = (CFArrayRef)CTFontDescriptorCopyAttribute(descriptor, kCTFontLanguagesAttribute);
@@ -621,7 +621,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslat
charSets.Add(FXFONT_HANGEUL_CHARSET);
charSets.Add(FXFONT_SHIFTJIS_CHARSET);
if (IsHasCharSet(languages, charSets)) {
- bCJK = true;
+ bCJK = TRUE;
}
CFRelease(descriptor);
CFDictionaryRef traits = (CFDictionaryRef)CTFontCopyTraits(font);
@@ -737,7 +737,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslat
CFX_ByteString cmap;
CFX_ByteString ordering;
int supplement;
- bool bFound = false;
+ FX_BOOL bFound = FALSE;
CPDF_Array* pWidthArray = new CPDF_Array;
charSets.RemoveAll();
charSets.Add(FXFONT_CHINESEBIG5_CHARSET);
@@ -747,7 +747,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslat
supplement = 4;
pWidthArray->AddInteger(1);
_InsertWidthArray(font, 0x20, 0x7e, pWidthArray);
- bFound = true;
+ bFound = TRUE;
}
charSets.RemoveAll();
charSets.Add(FXFONT_GB2312_CHARSET);
@@ -758,7 +758,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslat
_InsertWidthArray(font, 0x20, 0x20, pWidthArray);
pWidthArray->AddInteger(814);
_InsertWidthArray(font, 0x21, 0x7e, pWidthArray);
- bFound = true;
+ bFound = TRUE;
}
charSets.RemoveAll();
charSets.Add(FXFONT_HANGEUL_CHARSET);
@@ -768,7 +768,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslat
supplement = 2;
pWidthArray->AddInteger(1);
_InsertWidthArray(font, 0x20, 0x7e, pWidthArray);
- bFound = true;
+ bFound = TRUE;
}
charSets.RemoveAll();
charSets.Add(FXFONT_SHIFTJIS_CHARSET);
@@ -867,12 +867,12 @@ static void _InsertWidthArray1(CFX_Font* pFont, IFX_FontEncoding* pEncoding, FX_
}
FX_Free(widths);
}
-CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert)
+CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert)
{
if (pFont == NULL) {
return NULL;
}
- bool bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || charset == FXFONT_GB2312_CHARSET ||
+ FX_BOOL bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || charset == FXFONT_GB2312_CHARSET ||
charset == FXFONT_HANGEUL_CHARSET || charset == FXFONT_SHIFTJIS_CHARSET;
CFX_ByteString basefont = pFont->GetFamilyName();
basefont.Replace(" ", "");
@@ -1052,7 +1052,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert)
return LoadFont(pBaseDict);
}
static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages,
- int nPagesToGo, CPDF_Dictionary* pPage, bool bInsert, CFX_PtrArray& stackList)
+ int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL bInsert, CFX_PtrArray& stackList)
{
CPDF_Array* pKidList = pPages->GetArray("Kids");
if (!pKidList) {
@@ -1122,7 +1122,7 @@ static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageD
} else {
CFX_PtrArray stack;
stack.Add(pPages);
- if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, true, stack) < 0) {
+ if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, stack) < 0) {
return -1;
}
}
@@ -1165,7 +1165,7 @@ void CPDF_Document::DeletePage(int iPage)
}
CFX_PtrArray stack;
stack.Add(pPages);
- if (InsertDeletePDFPage(this, pPages, iPage, NULL, false, stack) < 0) {
+ if (InsertDeletePDFPage(this, pPages, iPage, NULL, FALSE, stack) < 0) {
return;
}
m_PageList.RemoveAt(iPage);
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 21ce31e3c3..dad7326a5b 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -16,7 +16,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size)
int32_t height;
int32_t num_comps;
int32_t bits;
- bool color_trans;
+ FX_BOOL color_trans;
if (!CPDF_ModuleMgr::Get()->GetJpegModule()->
LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) {
return NULL;
@@ -48,7 +48,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size)
pDict->SetAt("DecodeParms", pParms);
pParms->SetAtInteger("ColorTransform", 0);
}
- m_bIsMask = false;
+ m_bIsMask = FALSE;
m_Width = width;
m_Height = height;
if (m_pStream == NULL) {
@@ -92,7 +92,7 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile)
void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, int quality, uint8_t* &buf, FX_STRSIZE &size)
{
}
-void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, uint8_t* &buf, FX_STRSIZE &size, bool bLossLess)
+void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, uint8_t* &buf, FX_STRSIZE &size, FX_BOOL bLossLess)
{
}
void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam)
@@ -105,7 +105,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
uint8_t* src_buf = pBitmap->GetBuffer();
int32_t src_pitch = pBitmap->GetPitch();
int32_t bpp = pBitmap->GetBPP();
- bool bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb);
+ FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Dictionary* pDict = new CPDF_Dictionary;
pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
@@ -121,7 +121,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b);
}
if (set_a == 0 || reset_a == 0) {
- pDict->SetAt(FX_BSTRC("ImageMask"), new CPDF_Boolean(true));
+ pDict->SetAt(FX_BSTRC("ImageMask"), new CPDF_Boolean(TRUE));
if (reset_a == 0) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(1);
@@ -142,7 +142,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
pBuf[4] = (FX_CHAR)set_g;
pBuf[5] = (FX_CHAR)set_b;
ct.ReleaseBuffer(6);
- pCS->Add(CPDF_String::Create(ct, true));
+ pCS->Add(CPDF_String::Create(ct, TRUE));
pDict->SetAt(FX_BSTRC("ColorSpace"), pCS);
}
pDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 1);
@@ -194,10 +194,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
}
}
const CFX_DIBitmap* pMaskBitmap = NULL;
- bool bDeleteMask = false;
+ FX_BOOL bDeleteMask = FALSE;
if (pBitmap->HasAlpha()) {
pMaskBitmap = pBitmap->GetAlphaMask();
- bDeleteMask = true;
+ bDeleteMask = TRUE;
}
if (!pMaskBitmap && pMask) {
FXDIB_Format maskFormat = pMask->GetFormat();
@@ -220,7 +220,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
if (pMaskBitmap->GetBPP() == 8 && (iCompress & PDF_IMAGE_MASK_LOSSY_COMPRESS) != 0) {
_DCTEncodeBitmap(pMaskDict, pMaskBitmap, pParam ? pParam->nQuality : 75, mask_buf, mask_size);
} else if (pMaskBitmap->GetFormat() == FXDIB_1bppMask) {
- _JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, true);
+ _JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, TRUE);
} else {
mask_buf = FX_Alloc2D(uint8_t, maskHeight, maskWidth);
mask_size = maskHeight * maskWidth; // Safe since checked alloc returned.
@@ -245,15 +245,15 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
delete pMaskBitmap;
}
}
- bool bStream = pFileWrite != NULL && pFileRead != NULL;
+ FX_BOOL bStream = pFileWrite != NULL && pFileRead != NULL;
if (opType == 0) {
if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) {
if (pBitmap->GetBPP() == 1) {
- _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, true);
+ _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, TRUE);
}
} else {
if (pBitmap->GetBPP() == 1) {
- _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, false);
+ _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, FALSE);
} else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) {
CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap();
pNewBitmap->Copy(pBitmap);