summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_edit
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-09 11:30:25 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-09 11:30:25 -0700
commitbb17868d736f698d5217c30d52c5bbfed62c5936 (patch)
tree9d4d3e2538a81e6241d4992570bc3f3c1af71d28 /core/src/fpdfapi/fpdf_edit
parentbf6c2a4873f8cc12ad910fb904218a78087a3735 (diff)
downloadpdfium-bb17868d736f698d5217c30d52c5bbfed62c5936.tar.xz
Use stdint.h types throughout PDFium.
It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002
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.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp180
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp22
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp76
5 files changed, 147 insertions, 147 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h
index faa23f929d..38c33439ec 100644
--- a/core/src/fpdfapi/fpdf_edit/editint.h
+++ b/core/src/fpdfapi/fpdf_edit/editint.h
@@ -14,8 +14,8 @@ public:
FX_BOOL Start();
- FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj);
- FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize);
+ int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj);
+ int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize);
FX_FILESIZE End(CPDF_Creator* pCreator);
@@ -23,7 +23,7 @@ public:
CFX_ByteTextBuf m_Buffer;
FX_DWORD m_dwObjNum;
- FX_INT32 m_index;
+ int32_t m_index;
protected:
CFX_DWordArray m_OffsetArray;
@@ -36,9 +36,9 @@ public:
FX_BOOL Start();
- FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator);
+ int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator);
- FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator);
+ int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator);
FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE);
FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum);
@@ -51,9 +51,9 @@ public:
FX_DWORD m_dwTempObjNum;
protected:
- FX_INT32 EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE);
+ int32_t EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE);
FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF);
- FX_INT32 m_iSeg;
+ 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 b64151ad06..65b482bf30 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -142,7 +142,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix)
size += pContentArray[i]->GetSize() + 1;
}
int pos = 0;
- FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, size);
+ FX_LPBYTE pBuf = FX_Alloc(uint8_t, size);
for (i = 0; i < iCount; ++i) {
FXSYS_memcpy32(pBuf + pos, pContentArray[i]->GetData(), pContentArray[i]->GetSize());
pos += pContentArray[i]->GetSize() + 1;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 3abbcee046..035baa398f 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -8,13 +8,13 @@
#include "editint.h"
#define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024)
#define PDF_XREFSTREAM_MAXSIZE 10000
-extern void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_data, FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
+extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
extern void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns,
FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict);
-FX_INT32 PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset)
+int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset)
{
- FX_INT32 len = 0;
+ int32_t len = 0;
if (pObj == NULL) {
if (pFile->AppendString(FX_BSTRC(" null")) < 0) {
return -1;
@@ -171,10 +171,10 @@ FX_INT32 PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive
}
return 1;
}
-FX_INT32 PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress)
+int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress)
{
FX_FILESIZE offset = 0;
- FX_INT32 len = 0;
+ int32_t len = 0;
FXSYS_assert(pDocument && pFile);
CPDF_Parser *pParser = (CPDF_Parser*)pDocument->GetParser();
if (pParser) {
@@ -259,14 +259,14 @@ FX_INT32 PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive
}
return offset;
}
-FX_INT32 PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dwObjNum, CFX_FileBufferArchive *pFile)
+int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dwObjNum, CFX_FileBufferArchive *pFile)
{
if (!pEncryptDict) {
return 0;
}
FXSYS_assert(pFile);
FX_FILESIZE offset = 0;
- FX_INT32 len = 0;
+ int32_t len = 0;
if (pFile->AppendString(FX_BSTRC("/Encrypt")) < 0) {
return -1;
}
@@ -289,7 +289,7 @@ FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_LPDWORD pBuffe
return FALSE;
}
FX_LPVOID pContext = FX_Random_MT_Start(dwSeed1);
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i < 2; i++) {
*pBuffer++ = FX_Random_MT_Generate(pContext);
}
@@ -414,7 +414,7 @@ FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_
return TRUE;
}
m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size);
- m_pData = FX_Alloc(FX_BYTE, m_dwSize);
+ 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;
@@ -439,14 +439,14 @@ FX_BOOL CPDF_ObjectStream::Start()
m_index = 0;
return TRUE;
}
-FX_INT32 CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj)
+int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj)
{
m_ObjNumArray.Add(dwObjNum);
m_OffsetArray.Add(m_Buffer.GetLength());
m_Buffer << pObj;
return 1;
}
-FX_INT32 CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize)
+int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize)
{
m_ObjNumArray.Add(dwObjNum);
m_OffsetArray.Add(m_Buffer.GetLength());
@@ -466,12 +466,12 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator)
m_dwObjNum = ++pCreator->m_dwLastObjNum;
}
CFX_ByteTextBuf tempBuffer;
- FX_INT32 iCount = m_ObjNumArray.GetSize();
- for (FX_INT32 i = 0; i < iCount; i++) {
+ int32_t iCount = m_ObjNumArray.GetSize();
+ for (int32_t i = 0; i < iCount; i++) {
tempBuffer << m_ObjNumArray.ElementAt(i) << FX_BSTRC(" ") << m_OffsetArray.ElementAt(i) << FX_BSTRC(" ");
}
FX_FILESIZE &offset = pCreator->m_Offset;
- FX_INT32 len = pFile->AppendDWord(m_dwObjNum);
+ int32_t len = pFile->AppendDWord(m_dwObjNum);
if (len < 0) {
return -1;
}
@@ -552,7 +552,7 @@ FX_BOOL CPDF_XRefStream::Start()
m_iSeg = 0;
return TRUE;
}
-FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator)
+int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator)
{
if (!pCreator) {
return 0;
@@ -564,7 +564,7 @@ FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_O
}
return EndObjectStream(pCreator);
}
-FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator)
+int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator)
{
if (!pCreator) {
return 0;
@@ -601,7 +601,7 @@ static void _AppendIndex1(CFX_ByteTextBuf& buffer, FX_FILESIZE offset)
buffer.AppendByte(0);
buffer.AppendByte(0);
}
-static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, FX_INT32 index)
+static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index)
{
buffer.AppendByte(2);
buffer.AppendByte(FX_GETBYTEOFFSET24(objnum));
@@ -611,7 +611,7 @@ static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, FX_INT32 ind
buffer.AppendByte(FX_GETBYTEOFFSET8(index));
buffer.AppendByte(FX_GETBYTEOFFSET0(index));
}
-FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
+int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
{
FX_FILESIZE objOffset = 0;
if (bEOF) {
@@ -624,8 +624,8 @@ FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
if (!dwObjStmNum) {
dwObjStmNum = ++pCreator->m_dwLastObjNum;
}
- FX_INT32 iSize = m_ObjStream.m_ObjNumArray.GetSize();
- FX_INT32 iSeg = m_IndexArray.GetSize() / 2;
+ int32_t iSize = m_ObjStream.m_ObjNumArray.GetSize();
+ int32_t iSeg = m_IndexArray.GetSize() / 2;
if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) {
if (m_dwTempObjNum == 0) {
_AppendIndex0(m_Buffer);
@@ -656,7 +656,7 @@ FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
}
return 1;
}
- FX_INT32 &j = m_ObjStream.m_index;
+ int32_t &j = m_ObjStream.m_index;
for (int i = m_iSeg; i < iSeg; i++) {
FX_DWORD start = m_IndexArray.ElementAt(i * 2);
FX_DWORD end = m_IndexArray.ElementAt(i * 2 + 1) + start;
@@ -700,7 +700,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
}
_AppendIndex1(m_Buffer, offset_tmp);
FX_FILESIZE &offset = pCreator->m_Offset;
- FX_INT32 len = pFile->AppendDWord(objnum);
+ int32_t len = pFile->AppendDWord(objnum);
if (len < 0) {
return FALSE;
}
@@ -722,8 +722,8 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
}
offset += len;
} else {
- FX_INT32 iSeg = m_IndexArray.GetSize() / 2;
- for (FX_INT32 i = 0; i < iSeg; i++) {
+ 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;
}
@@ -754,7 +754,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
FX_CHAR offset_buf[20];
FXSYS_memset32(offset_buf, 0, sizeof(offset_buf));
FXSYS_i64toa(m_PrevOffset, offset_buf, 10);
- FX_INT32 len = (FX_INT32)FXSYS_strlen(offset_buf);
+ int32_t len = (int32_t)FXSYS_strlen(offset_buf);
if (pFile->AppendBlock(offset_buf, len) < 0) {
return -1;
}
@@ -832,7 +832,7 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
}
}
} else {
- FX_INT32 iSeg = m_IndexArray.GetSize() / 2;
+ int32_t iSeg = m_IndexArray.GetSize() / 2;
for (int i = 0; i < iSeg; i++) {
FX_DWORD start = m_IndexArray.ElementAt(i * 2);
FX_DWORD end = m_IndexArray.ElementAt(i * 2 + 1) + start;
@@ -845,14 +845,14 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
}
FX_BOOL CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
{
- FX_INT32 iSize = m_IndexArray.GetSize();
+ int32_t iSize = m_IndexArray.GetSize();
if (iSize == 0) {
m_IndexArray.Add(objnum);
m_IndexArray.Add(1);
} else {
FXSYS_assert(iSize > 1);
FX_DWORD startobjnum = m_IndexArray.ElementAt(iSize - 2);
- FX_INT32 iCount = m_IndexArray.ElementAt(iSize - 1);
+ int32_t iCount = m_IndexArray.ElementAt(iSize - 1);
if (objnum == startobjnum + iCount) {
m_IndexArray[iSize - 1] = iCount + 1;
} else {
@@ -906,20 +906,20 @@ static FX_BOOL _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag)
if (!(flag & FPDFCREATE_INCREMENTAL)) {
return FALSE;
}
- FX_INT32 iSize = pXRef->m_IndexArray.GetSize() / 2;
- FX_INT32 iCount = 0;
- for (FX_INT32 i = 0; i < iSize; i++) {
+ int32_t iSize = pXRef->m_IndexArray.GetSize() / 2;
+ int32_t iCount = 0;
+ for (int32_t i = 0; i < iSize; i++) {
iCount += pXRef->m_IndexArray.ElementAt(i * 2 + 1);
}
return (iCount >= PDF_XREFSTREAM_MAXSIZE);
}
-FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj)
+int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj)
{
if (!m_pXRefStream) {
return 1;
}
FX_DWORD objnum = pObj->GetObjNum();
- if (m_pParser && m_pParser->m_ObjVersion.GetSize() > (FX_INT32)objnum && m_pParser->m_ObjVersion[objnum] > 0) {
+ if (m_pParser && m_pParser->m_ObjVersion.GetSize() > (int32_t)objnum && m_pParser->m_ObjVersion[objnum] > 0) {
return 1;
}
if (pObj->GetType() == PDFOBJ_NUMBER) {
@@ -958,13 +958,13 @@ FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj)
}
return 0;
}
-FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize)
+int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize)
{
if (!m_pXRefStream) {
return 1;
}
m_pXRefStream->AddObjectNumberToIndexArray(objnum);
- FX_INT32 iRet = m_pXRefStream->CompressIndirectObject(objnum, pBuffer, dwSize, this);
+ int32_t iRet = m_pXRefStream->CompressIndirectObject(objnum, pBuffer, dwSize, this);
if (iRet < 1) {
return iRet;
}
@@ -979,7 +979,7 @@ FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE p
}
return 0;
}
-FX_INT32 CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum)
+int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum)
{
if (!m_pXRefStream) {
return 1;
@@ -996,7 +996,7 @@ FX_INT32 CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum)
}
return 0;
}
-FX_INT32 CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto)
+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);
@@ -1026,9 +1026,9 @@ FX_INT32 CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum,
m_Offset += len;
return 1;
}
-FX_INT32 CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj)
+int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj)
{
- FX_INT32 len = m_File.AppendDWord(objnum);
+ int32_t len = m_File.AppendDWord(objnum);
if (len < 0) {
return -1;
}
@@ -1057,17 +1057,17 @@ FX_INT32 CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj
}
return 0;
}
-FX_INT32 CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj)
+int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj)
{
- FX_INT32 iRet = WriteIndirectObjectToStream(pObj);
+ int32_t iRet = WriteIndirectObjectToStream(pObj);
if (iRet < 1) {
return iRet;
}
return WriteIndirectObj(pObj->GetObjNum(), pObj);
}
-FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt)
+int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt)
{
- FX_INT32 len = 0;
+ int32_t len = 0;
if (pObj == NULL) {
if (m_File.AppendString(FX_BSTRC(" null")) < 0) {
return -1;
@@ -1246,14 +1246,14 @@ FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj,
}
return 1;
}
-FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
+int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
{
if(m_pParser->m_V5Type[objnum] == 0 || m_pParser->m_V5Type[objnum] == 255) {
return 0;
}
m_ObjectOffset[objnum] = m_Offset;
FX_LPVOID valuetemp = NULL;
- FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, valuetemp);
+ FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(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);
@@ -1269,7 +1269,7 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
m_pDocument->ReleaseIndirectObject(objnum);
}
} else {
- FX_BYTE* pBuffer;
+ uint8_t* pBuffer;
FX_DWORD size;
m_pParser->GetIndirectBinary(objnum, pBuffer, size);
if (pBuffer == NULL) {
@@ -1282,7 +1282,7 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
return -1;
}
} else {
- FX_INT32 len = m_File.AppendDWord(objnum);
+ int32_t len = m_File.AppendDWord(objnum);
if (len < 0) {
return -1;
}
@@ -1312,12 +1312,12 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
}
return 1;
}
-FX_INT32 CPDF_Creator::WriteOldObjs(IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause)
{
FX_DWORD nOldSize = m_pParser->m_CrossRef.GetSize();
- FX_DWORD objnum = (FX_DWORD)(FX_UINTPTR)m_Pos;
+ FX_DWORD objnum = (FX_DWORD)(uintptr_t)m_Pos;
for(; objnum < nOldSize; objnum ++) {
- FX_INT32 iRet = WriteOldIndirectObject(objnum);
+ int32_t iRet = WriteOldIndirectObject(objnum);
if (!iRet) {
continue;
}
@@ -1326,20 +1326,20 @@ FX_INT32 CPDF_Creator::WriteOldObjs(IFX_Pause *pPause)
}
m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]);
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (FX_LPVOID)(FX_UINTPTR)(objnum + 1);
+ m_Pos = (FX_LPVOID)(uintptr_t)(objnum + 1);
return 1;
}
}
return 0;
}
-FX_INT32 CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause)
{
- FX_INT32 iCount = m_NewObjNumArray.GetSize();
- FX_INT32 index = (FX_INT32)(FX_UINTPTR)m_Pos;
+ int32_t iCount = m_NewObjNumArray.GetSize();
+ int32_t index = (int32_t)(uintptr_t)m_Pos;
while (index < iCount) {
FX_DWORD objnum = m_NewObjNumArray.ElementAt(index);
CPDF_Object *pObj = NULL;
- m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj);
+ m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj);
if (NULL == pObj) {
++index;
continue;
@@ -1351,7 +1351,7 @@ FX_INT32 CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause)
m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]);
index++;
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (FX_POSITION)(FX_UINTPTR)index;
+ m_Pos = (FX_POSITION)(uintptr_t)index;
return 1;
}
}
@@ -1406,11 +1406,11 @@ void CPDF_Creator::InitNewObjNumOffsets()
}
AppendNewObjNum(objnum);
}
- FX_INT32 iCount = m_NewObjNumArray.GetSize();
+ int32_t iCount = m_NewObjNumArray.GetSize();
if (iCount == 0) {
return;
}
- FX_INT32 i = 0;
+ int32_t i = 0;
FX_DWORD dwStartObjNum = 0;
FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
while (i < iCount) {
@@ -1447,10 +1447,10 @@ void CPDF_Creator::InitNewObjNumOffsets()
}
void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum)
{
- FX_INT32 iStart = 0, iFind = 0;
- FX_INT32 iEnd = m_NewObjNumArray.GetUpperBound();
+ int32_t iStart = 0, iFind = 0;
+ int32_t iEnd = m_NewObjNumArray.GetUpperBound();
while (iStart <= iEnd) {
- FX_INT32 iMid = (iStart + iEnd) / 2;
+ int32_t iMid = (iStart + iEnd) / 2;
FX_DWORD dwMid = m_NewObjNumArray.ElementAt(iMid);
if (objbum < dwMid) {
iEnd = iMid - 1;
@@ -1469,7 +1469,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum)
}
m_NewObjNumArray.InsertAt(iFind, objbum);
}
-FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
{
FXSYS_assert(m_iStage > -1 || m_iStage < 20);
if (m_iStage == 0) {
@@ -1497,13 +1497,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
return -1;
}
m_Offset += 7;
- FX_INT32 version = 7;
+ int32_t version = 7;
if (m_FileVersion) {
version = m_FileVersion;
} else if (m_pParser) {
version = m_pParser->GetFileVersion();
}
- FX_INT32 len = m_File.AppendDWord(version % 10);
+ int32_t len = m_File.AppendDWord(version % 10);
if (len < 0) {
return -1;
}
@@ -1517,15 +1517,15 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
} else {
IFX_FileRead* pSrcFile = m_pParser->GetFileAccess();
m_Offset = pSrcFile->GetSize();
- m_Pos = (FX_LPVOID)(FX_UINTPTR)m_Offset;
+ m_Pos = (FX_LPVOID)(uintptr_t)m_Offset;
m_iStage = 15;
}
}
if (m_iStage == 15) {
if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) {
IFX_FileRead* pSrcFile = m_pParser->GetFileAccess();
- FX_BYTE buffer[4096];
- FX_DWORD src_size = (FX_DWORD)(FX_UINTPTR)m_Pos;
+ uint8_t buffer[4096];
+ FX_DWORD src_size = (FX_DWORD)(uintptr_t)m_Pos;
while (src_size) {
FX_DWORD block_size = src_size > 4096 ? 4096 : src_size;
if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) {
@@ -1536,7 +1536,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
}
src_size -= block_size;
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (FX_LPVOID)(FX_UINTPTR)src_size;
+ m_Pos = (FX_LPVOID)(uintptr_t)src_size;
return 1;
}
}
@@ -1564,30 +1564,30 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
InitNewObjNumOffsets();
return m_iStage;
}
-FX_INT32 CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause)
{
FXSYS_assert(m_iStage >= 20 || m_iStage < 30);
if (m_iStage == 20) {
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 && m_pParser) {
- m_Pos = (FX_LPVOID)(FX_UINTPTR)0;
+ m_Pos = (FX_LPVOID)(uintptr_t)0;
m_iStage = 21;
} else {
m_iStage = 25;
}
}
if (m_iStage == 21) {
- FX_INT32 iRet = WriteOldObjs(pPause);
+ int32_t iRet = WriteOldObjs(pPause);
if (iRet) {
return iRet;
}
m_iStage = 25;
}
if (m_iStage == 25) {
- m_Pos = (FX_LPVOID)(FX_UINTPTR)0;
+ m_Pos = (FX_LPVOID)(uintptr_t)0;
m_iStage = 26;
}
if (m_iStage == 26) {
- FX_INT32 iRet = WriteNewObjs((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0, pPause);
+ int32_t iRet = WriteNewObjs((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0, pPause);
if (iRet) {
return iRet;
}
@@ -1613,7 +1613,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause)
}
return m_iStage;
}
-FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
{
FXSYS_assert(m_iStage >= 80 || m_iStage < 90);
FX_DWORD dwLastObjNum = m_dwLastObjNum;
@@ -1630,13 +1630,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
if (m_File.AppendString(str) < 0) {
return -1;
}
- m_Pos = (FX_LPVOID)(FX_UINTPTR)1;
+ m_Pos = (FX_LPVOID)(uintptr_t)1;
m_iStage = 81;
} else {
if (m_File.AppendString(FX_BSTRC("xref\r\n")) < 0) {
return -1;
}
- m_Pos = (FX_LPVOID)(FX_UINTPTR)0;
+ m_Pos = (FX_LPVOID)(uintptr_t)0;
m_iStage = 82;
}
} else {
@@ -1645,7 +1645,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
}
if (m_iStage == 81) {
CFX_ByteString str;
- FX_DWORD i = (FX_DWORD)(FX_UINTPTR)m_Pos, j;
+ FX_DWORD i = (FX_DWORD)(uintptr_t)m_Pos, j;
while (i <= dwLastObjNum) {
while (i <= dwLastObjNum && !m_ObjectOffset.GetPtrAt(i)) {
i++;
@@ -1675,7 +1675,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
break;
}
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (FX_LPVOID)(FX_UINTPTR)i;
+ m_Pos = (FX_LPVOID)(uintptr_t)i;
return 1;
}
}
@@ -1683,10 +1683,10 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
}
if (m_iStage == 82) {
CFX_ByteString str;
- FX_INT32 iCount = m_NewObjNumArray.GetSize();
- FX_INT32 i = (FX_INT32)(FX_UINTPTR)m_Pos;
+ int32_t iCount = m_NewObjNumArray.GetSize();
+ int32_t i = (int32_t)(uintptr_t)m_Pos;
while (i < iCount) {
- FX_INT32 j = i;
+ int32_t j = i;
FX_DWORD objnum = m_NewObjNumArray.ElementAt(i);
while (j < iCount) {
if (++j == iCount) {
@@ -1715,7 +1715,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
}
}
if (pPause && (i % 100) == 0 && pPause->NeedToPauseNow()) {
- m_Pos = (FX_LPVOID)(FX_UINTPTR)i;
+ m_Pos = (FX_LPVOID)(uintptr_t)i;
return 1;
}
}
@@ -1723,7 +1723,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
}
return m_iStage;
}
-static FX_INT32 _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset)
+static int32_t _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset)
{
FXSYS_assert(pFile);
if (sizeof(offset) > 4) {
@@ -1759,7 +1759,7 @@ static FX_INT32 _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset)
}
return 0;
}
-FX_INT32 CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause)
{
FXSYS_assert(m_iStage >= 90);
if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) {
@@ -1918,7 +1918,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause)
}
} else {
int count = m_NewObjNumArray.GetSize();
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i < count; i++) {
FX_DWORD objnum = m_NewObjNumArray.ElementAt(i);
if (m_File.AppendDWord(objnum) < 0) {
@@ -2035,7 +2035,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
m_pIDArray->Add(pID1->Clone());
} else {
pBuffer = FX_Alloc(FX_DWORD, 4);
- PDF_GenerateFileID((FX_DWORD)(FX_UINTPTR)this, m_dwLastObjNum, pBuffer);
+ PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer);
CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD));
m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
}
@@ -2053,7 +2053,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
return;
}
FX_LPDWORD pBuffer = FX_Alloc(FX_DWORD, 4);
- PDF_GenerateFileID((FX_DWORD)(FX_UINTPTR)this, m_dwLastObjNum, pBuffer);
+ PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer);
CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD));
m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
FX_Free(pBuffer);
@@ -2076,12 +2076,12 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
}
}
}
-FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause)
+int32_t CPDF_Creator::Continue(IFX_Pause *pPause)
{
if (m_iStage < 0) {
return m_iStage;
}
- FX_INT32 iRet = 0;
+ int32_t iRet = 0;
while (m_iStage < 100) {
if (m_iStage < 20) {
iRet = WriteDoc_Stage1(pPause);
@@ -2103,7 +2103,7 @@ FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause)
}
return m_iStage;
}
-FX_BOOL CPDF_Creator::SetFileVersion(FX_INT32 fileVersion )
+FX_BOOL CPDF_Creator::SetFileVersion(int32_t fileVersion )
{
if (fileVersion < 10 || fileVersion > 17) {
return FALSE;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index e75fd079bf..d2d81d5566 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -178,7 +178,7 @@ static const FX_WCHAR g_FX_CP1257Unicodes[128] = {
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9,
};
typedef struct {
- FX_BYTE m_Charset;
+ uint8_t m_Charset;
const FX_WCHAR* m_pUnicodes;
} FX_CharsetUnicodes;
const FX_CharsetUnicodes g_FX_CharsetUnicodes[] = {
@@ -429,12 +429,12 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B
}
#endif
#if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_)
-FX_UINT32 FX_GetLangHashCode( FX_LPCSTR pStr)
+uint32_t FX_GetLangHashCode( FX_LPCSTR pStr)
{
FXSYS_assert( pStr != NULL);
- FX_INT32 iLength = FXSYS_strlen(pStr);
+ int32_t iLength = FXSYS_strlen(pStr);
FX_LPCSTR pStrEnd = pStr + iLength;
- FX_UINT32 uHashCode = 0;
+ uint32_t uHashCode = 0;
while ( pStr < pStrEnd) {
uHashCode = 31 * uHashCode + tolower(*pStr++);
}
@@ -512,12 +512,12 @@ static const FX_LANG2CS gs_FXLang2CharsetTable[] = {
{3923451837, 134},
{3923451838, 136},
};
-static FX_WORD FX_GetCsFromLangCode(FX_UINT32 uCode)
+static FX_WORD FX_GetCsFromLangCode(uint32_t uCode)
{
- FX_INT32 iStart = 0;
- FX_INT32 iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1;
+ int32_t iStart = 0;
+ int32_t iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1;
while (iStart <= iEnd) {
- FX_INT32 iMid = (iStart + iEnd) / 2;
+ int32_t iMid = (iStart + iEnd) / 2;
const FX_LANG2CS &charset = gs_FXLang2CharsetTable[iMid];
if (uCode == charset.uLang) {
return charset.uCharset;
@@ -529,13 +529,13 @@ static FX_WORD FX_GetCsFromLangCode(FX_UINT32 uCode)
};
return 0;
}
-static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, FX_INT32 iLength)
+static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, int32_t iLength)
{
FXSYS_assert(pLang);
if (iLength < 0) {
iLength = FXSYS_strlen(pLang);
}
- FX_UINT32 uHash = FX_GetLangHashCode(pLang);
+ uint32_t uHash = FX_GetLangHashCode(pLang);
return FX_GetCsFromLangCode(uHash);
}
static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest)
@@ -1028,7 +1028,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert)
pBBox->AddInteger(bbox.right);
pBBox->AddInteger(bbox.top);
pFontDesc->SetAt("FontBBox", pBBox);
- FX_INT32 nStemV = 0;
+ int32_t nStemV = 0;
if (pFont->m_pSubstFont) {
nStemV = pFont->m_pSubstFont->m_Weight / 5;
} else {
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 9096bf938e..8d105a5bd8 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -12,7 +12,7 @@
#include "../fpdf_render/render_int.h"
CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size)
{
- FX_INT32 width, height, color_trans, num_comps, bits;
+ int32_t width, height, color_trans, num_comps, bits;
if (!CPDF_ModuleMgr::Get()->GetJpegModule()->
LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) {
return NULL;
@@ -70,12 +70,12 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile)
if (dwEstimateSize > 8192) {
dwEstimateSize = 8192;
}
- FX_LPBYTE pData = FX_Alloc(FX_BYTE, dwEstimateSize);
+ FX_LPBYTE pData = FX_Alloc(uint8_t, dwEstimateSize);
pFile->ReadBlock(pData, 0, dwEstimateSize);
CPDF_Dictionary *pDict = InitJPEG(pData, dwEstimateSize);
FX_Free(pData);
if (!pDict && size > dwEstimateSize) {
- pData = FX_Alloc(FX_BYTE, size);
+ pData = FX_Alloc(uint8_t, size);
pFile->ReadBlock(pData, 0, size);
pDict = InitJPEG(pData, size);
FX_Free(pData);
@@ -91,16 +91,16 @@ void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap,
void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, FX_LPBYTE &buf, FX_STRSIZE &size, FX_BOOL bLossLess)
{
}
-void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam)
+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)
{
- FX_INT32 BitmapWidth = pBitmap->GetWidth();
- FX_INT32 BitmapHeight = pBitmap->GetHeight();
+ int32_t BitmapWidth = pBitmap->GetWidth();
+ int32_t BitmapHeight = pBitmap->GetHeight();
if (BitmapWidth < 1 || BitmapHeight < 1) {
return;
}
FX_LPBYTE src_buf = pBitmap->GetBuffer();
- FX_INT32 src_pitch = pBitmap->GetPitch();
- FX_INT32 bpp = pBitmap->GetBPP();
+ int32_t src_pitch = pBitmap->GetPitch();
+ int32_t bpp = pBitmap->GetBPP();
FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Dictionary* pDict = new CPDF_Dictionary;
pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
@@ -110,8 +110,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
FX_LPBYTE dest_buf = NULL;
FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1;
if (bpp == 1) {
- FX_INT32 reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0;
- FX_INT32 set_a = 0, set_r = 0, set_g = 0, set_b = 0;
+ int32_t reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0;
+ int32_t set_a = 0, set_r = 0, set_g = 0, set_b = 0;
if (!pBitmap->IsAlphaMask()) {
ArgbDecode(pBitmap->GetPaletteArgb(0), reset_a, reset_r, reset_g, reset_b);
ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b);
@@ -149,20 +149,20 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
opType = 0;
}
} else if (bpp == 8) {
- FX_INT32 iPalette = pBitmap->GetPaletteSize();
+ int32_t iPalette = pBitmap->GetPaletteSize();
if (iPalette > 0) {
CPDF_Array* pCS = new CPDF_Array;
m_pDocument->AddIndirectObject(pCS);
pCS->AddName(FX_BSTRC("Indexed"));
pCS->AddName(FX_BSTRC("DeviceRGB"));
pCS->AddInteger(iPalette - 1);
- FX_LPBYTE pColorTable = FX_Alloc2D(FX_BYTE, iPalette, 3);
+ FX_LPBYTE pColorTable = FX_Alloc2D(uint8_t, iPalette, 3);
FX_LPBYTE ptr = pColorTable;
- for (FX_INT32 i = 0; i < iPalette; i ++) {
+ for (int32_t i = 0; i < iPalette; i ++) {
FX_DWORD argb = pBitmap->GetPaletteArgb(i);
- ptr[0] = (FX_BYTE)(argb >> 16);
- ptr[1] = (FX_BYTE)(argb >> 8);
- ptr[2] = (FX_BYTE)argb;
+ ptr[0] = (uint8_t)(argb >> 16);
+ ptr[1] = (uint8_t)(argb >> 8);
+ ptr[2] = (uint8_t)argb;
ptr += 3;
}
CPDF_Stream *pCTS = CPDF_Stream::Create(pColorTable, iPalette * 3, CPDF_Dictionary::Create());
@@ -202,8 +202,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
}
}
if (pMaskBitmap) {
- FX_INT32 maskWidth = pMaskBitmap->GetWidth();
- FX_INT32 maskHeight = pMaskBitmap->GetHeight();
+ int32_t maskWidth = pMaskBitmap->GetWidth();
+ int32_t maskHeight = pMaskBitmap->GetHeight();
FX_LPBYTE mask_buf = NULL;
FX_STRSIZE mask_size;
CPDF_Dictionary* pMaskDict = new CPDF_Dictionary;
@@ -218,9 +218,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
} else if (pMaskBitmap->GetFormat() == FXDIB_1bppMask) {
_JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, TRUE);
} else {
- mask_buf = FX_Alloc2D(FX_BYTE, maskHeight, maskWidth);
+ mask_buf = FX_Alloc2D(uint8_t, maskHeight, maskWidth);
mask_size = maskHeight * maskWidth; // Safe since checked alloc returned.
- for (FX_INT32 a = 0; a < maskHeight; a ++) {
+ for (int32_t a = 0; a < maskHeight; a ++) {
FXSYS_memcpy32(mask_buf + a * maskWidth, pMaskBitmap->GetScanline(a), maskWidth);
}
}
@@ -271,15 +271,15 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap();
pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb);
FX_LPBYTE dst_buf = pNewBitmap->GetBuffer();
- FX_INT32 src_offset = 0;
- for (FX_INT32 row = 0; row < BitmapHeight; row ++) {
+ int32_t src_offset = 0;
+ for (int32_t row = 0; row < BitmapHeight; row ++) {
src_offset = row * src_pitch;
- for (FX_INT32 column = 0; column < BitmapWidth; column ++) {
+ for (int32_t column = 0; column < BitmapWidth; column ++) {
FX_FLOAT alpha = src_buf[src_offset + 3] / 255.0f;
- dst_buf[src_offset] = (FX_BYTE)(src_buf[src_offset] * alpha);
- dst_buf[src_offset + 1] = (FX_BYTE)(src_buf[src_offset + 1] * alpha);
- dst_buf[src_offset + 2] = (FX_BYTE)(src_buf[src_offset + 2] * alpha);
- dst_buf[src_offset + 3] = (FX_BYTE)(src_buf[src_offset + 3]);
+ dst_buf[src_offset] = (uint8_t)(src_buf[src_offset] * alpha);
+ dst_buf[src_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha);
+ dst_buf[src_offset + 2] = (uint8_t)(src_buf[src_offset + 2] * alpha);
+ dst_buf[src_offset + 3] = (uint8_t)(src_buf[src_offset + 3]);
src_offset += 4;
}
}
@@ -297,11 +297,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
}
} else if (opType == 1) {
if (!bStream) {
- dest_buf = FX_Alloc2D(FX_BYTE, dest_pitch, BitmapHeight);
+ dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight);
dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned.
}
FX_LPBYTE pDest = dest_buf;
- for (FX_INT32 i = 0; i < BitmapHeight; i ++) {
+ for (int32_t i = 0; i < BitmapHeight; i ++) {
if (!bStream) {
FXSYS_memcpy32(pDest, src_buf, dest_pitch);
pDest += dest_pitch;
@@ -312,21 +312,21 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
}
} else if (opType == 2) {
if (!bStream) {
- dest_buf = FX_Alloc2D(FX_BYTE, dest_pitch, BitmapHeight);
+ dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight);
dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned.
} else {
- dest_buf = FX_Alloc(FX_BYTE, dest_pitch);
+ dest_buf = FX_Alloc(uint8_t, dest_pitch);
}
FX_LPBYTE pDest = dest_buf;
- FX_INT32 src_offset = 0;
- FX_INT32 dest_offset = 0;
- for (FX_INT32 row = 0; row < BitmapHeight; row ++) {
+ int32_t src_offset = 0;
+ int32_t dest_offset = 0;
+ for (int32_t row = 0; row < BitmapHeight; row ++) {
src_offset = row * src_pitch;
- for (FX_INT32 column = 0; column < BitmapWidth; column ++) {
+ for (int32_t column = 0; column < BitmapWidth; column ++) {
FX_FLOAT alpha = bUseMatte ? src_buf[src_offset + 3] / 255.0f : 1;
- pDest[dest_offset] = (FX_BYTE)(src_buf[src_offset + 2] * alpha);
- pDest[dest_offset + 1] = (FX_BYTE)(src_buf[src_offset + 1] * alpha);
- pDest[dest_offset + 2] = (FX_BYTE)(src_buf[src_offset] * alpha);
+ pDest[dest_offset] = (uint8_t)(src_buf[src_offset + 2] * alpha);
+ pDest[dest_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha);
+ pDest[dest_offset + 2] = (uint8_t)(src_buf[src_offset] * alpha);
dest_offset += 3;
src_offset += bpp == 24 ? 3 : 4;
}