From bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 13:24:12 -0700 Subject: Merge to XFA: Use stdint.h types throughout PDFium. Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002 --- core/src/fpdfapi/fpdf_edit/editint.h | 14 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 2 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 180 ++++++------ core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 22 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 76 ++--- core/src/fpdfapi/fpdf_font/common.h | 6 +- core/src/fpdfapi/fpdf_font/font_int.h | 16 +- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 34 +-- core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp | 12 +- core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 68 ++--- core/src/fpdfapi/fpdf_font/ttgsubtable.cpp | 6 +- core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 16 +- core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 38 +-- core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 4 +- core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 6 +- .../fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 8 +- core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 +- .../src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 20 +- core/src/fpdfapi/fpdf_page/pageint.h | 14 +- core/src/fpdfapi/fpdf_parser/filters_int.h | 8 +- .../src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 34 +-- .../fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 2 +- .../fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 166 +++++------ .../fpdfapi/fpdf_parser/fpdf_parser_filters.cpp | 64 ++--- .../fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 40 +-- .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 318 ++++++++++----------- .../fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 6 +- core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 18 +- core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 12 +- core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 8 +- .../fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 44 +-- .../fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 20 +- core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 10 +- core/src/fpdfapi/fpdf_render/render_int.h | 18 +- 34 files changed, 656 insertions(+), 656 deletions(-) (limited to 'core/src/fpdfapi') 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; } diff --git a/core/src/fpdfapi/fpdf_font/common.h b/core/src/fpdfapi/fpdf_font/common.h index 923a394662..57461d1908 100644 --- a/core/src/fpdfapi/fpdf_font/common.h +++ b/core/src/fpdfapi/fpdf_font/common.h @@ -11,9 +11,9 @@ typedef signed char TT_int8_t; typedef unsigned char TT_uint8_t; typedef signed short TT_int16_t; typedef unsigned short TT_uint16_t; -typedef FX_INT32 TT_int32_t; +typedef int32_t TT_int32_t; typedef FX_DWORD TT_uint32_t; -typedef FX_INT64 TT_int64_t; -typedef FX_UINT64 TT_uint64_t; +typedef int64_t TT_int64_t; +typedef uint64_t TT_uint64_t; #endif // CORE_SRC_FPDFAPI_FPDF_FONT_COMMON_H_ diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 697ccffafd..1e52607d98 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -48,8 +48,8 @@ private: }; struct _CMap_CodeRange { int m_CharSize; - FX_BYTE m_Lower[4]; - FX_BYTE m_Upper[4]; + uint8_t m_Lower[4]; + uint8_t m_Upper[4]; }; class CPDF_CMapParser { @@ -113,7 +113,7 @@ protected: int m_Charset, m_Coding; CodingScheme m_CodingScheme; int m_nCodeRanges; - FX_BYTE* m_pLeadingBytes; + uint8_t* m_pLeadingBytes; FX_WORD* m_pMapping; FX_LPBYTE m_pAddMapping; FX_BOOL m_bLoaded; @@ -128,13 +128,13 @@ public: int m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; FX_DWORD m_LeadingSegCount; - FX_BYTE m_LeadingSegs[4]; + uint8_t m_LeadingSegs[4]; }; typedef struct _FileHeader { - FX_BYTE btTag[4]; - FX_BYTE btVersion; - FX_BYTE btFormat; - FX_BYTE btReserved1[2]; + uint8_t btTag[4]; + uint8_t btVersion; + uint8_t btFormat; + uint8_t btReserved1[2]; FX_DWORD dwStartIndex; FX_DWORD dwEndIndex; FX_DWORD dwDataSize; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 80dd1df803..0058e140d4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -412,7 +412,7 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, FX_BSTR name) pFontGlobals->Set(pDoc, font_id, pFont); return pFont; } -const FX_BYTE ChineseFontNames[][5] = { +const uint8_t ChineseFontNames[][5] = { {0xCB, 0xCE, 0xCC, 0xE5, 0x00}, {0xBF, 0xAC, 0xCC, 0xE5, 0x00}, {0xBA, 0xDA, 0xCC, 0xE5, 0x00}, @@ -816,7 +816,7 @@ FX_BOOL CPDF_Font::IsStandardFont() const } return TRUE; } -extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, FX_BYTE charcode); +extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) { FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); @@ -838,7 +838,7 @@ int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) if (charcode > 0xff) { return -1; } - int index = m_GlyphIndex[(FX_BYTE)charcode]; + int index = m_GlyphIndex[(uint8_t)charcode]; if (index == 0xffff) { return -1; } @@ -892,14 +892,14 @@ int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) m_CharWidth[charcode] = 0; } } - return (FX_INT16)m_CharWidth[charcode]; + return (int16_t)m_CharWidth[charcode]; } void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) { if (charcode > 0xff) { charcode = 0; } - if (m_CharBBox[charcode].Left == (FX_SHORT)0xffff) { + if (m_CharBBox[charcode].Left == (int16_t)0xffff) { LoadCharMetrics(charcode); } rect.left = m_CharBBox[charcode].Left; @@ -1073,7 +1073,7 @@ int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) if (charcode > 0xff) { return -1; } - int index = m_ExtGID[(FX_BYTE)charcode]; + int index = m_ExtGID[(uint8_t)charcode]; if (index == 0xffff) { return -1; } @@ -1130,7 +1130,7 @@ void CPDF_Type1Font::LoadGlyphMap() if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) { FX_BOOL bGotOne = FALSE; for (int charcode = 0; charcode < 256; charcode ++) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j ++) { FX_WORD unicode = prefix[j] * 256 + charcode; m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); @@ -1482,7 +1482,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() } m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); if (bMSSymbol) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j ++) { FX_WORD unicode = prefix[j] * 256 + charcode; m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); @@ -1525,7 +1525,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() return; } if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; FX_BOOL bGotOne = FALSE; for (int charcode = 0; charcode < 256; charcode ++) { for (int j = 0; j < 4; j ++) { @@ -1627,10 +1627,10 @@ FX_BOOL CPDF_Type3Font::_Load() } CPDF_Array* pBBox = m_pFontDict->GetArray(FX_BSTRC("FontBBox")); if (pBBox) { - m_FontBBox.left = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); - m_FontBBox.bottom = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); - m_FontBBox.right = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); - m_FontBBox.top = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); + m_FontBBox.left = (int32_t)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); + m_FontBBox.bottom = (int32_t)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); + m_FontBBox.right = (int32_t)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); + m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); } int StartChar = m_pFontDict->GetInteger(FX_BSTRC("FirstChar")); CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths")); @@ -1671,10 +1671,10 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) return NULL; } CPDF_Type3Char* pChar = NULL; - if (m_CacheMap.Lookup((FX_LPVOID)(FX_UINTPTR)charcode, (FX_LPVOID&)pChar)) { + if (m_CacheMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (FX_LPVOID&)pChar)) { if (pChar->m_bPageRequired && m_pPageResources) { delete pChar; - m_CacheMap.RemoveKey((FX_LPVOID)(FX_UINTPTR)charcode); + m_CacheMap.RemoveKey((FX_LPVOID)(uintptr_t)charcode); return LoadChar(charcode, level + 1); } return pChar; @@ -1691,7 +1691,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) pChar->m_pForm = new CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, NULL); pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1); FX_FLOAT scale = m_FontMatrix.GetXUnit(); - pChar->m_Width = (FX_INT32)(pChar->m_Width * scale + 0.5f); + pChar->m_Width = (int32_t)(pChar->m_Width * scale + 0.5f); FX_RECT &rcBBox = pChar->m_BBox; CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bottom / 1000.0f, (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f); @@ -1703,7 +1703,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) rcBBox.right = FXSYS_round(char_rect.right * 1000); rcBBox.top = FXSYS_round(char_rect.top * 1000); rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000); - m_CacheMap.SetAt((FX_LPVOID)(FX_UINTPTR)charcode, pChar); + m_CacheMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pChar); if (pChar->m_pForm->CountObjects() == 0) { delete pChar->m_pForm; pChar->m_pForm = NULL; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp index c7110d39c9..8e8fccd8a3 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp @@ -475,7 +475,7 @@ const FX_LPCSTR ZapfEncodingNames[224] = { NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL }; -const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, FX_BYTE charcode) +const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) { if (encoding == PDFFONT_ENCODING_PDFDOC) { if (charcode < 24) { @@ -512,15 +512,15 @@ FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode) case FXFT_ENCODING_UNICODE: return (FX_WORD)charcode; case FXFT_ENCODING_ADOBE_STANDARD: - return StandardEncoding[(FX_BYTE)charcode]; + return StandardEncoding[(uint8_t)charcode]; case FXFT_ENCODING_ADOBE_EXPERT: - return MacExpertEncoding[(FX_BYTE)charcode]; + return MacExpertEncoding[(uint8_t)charcode]; case FXFT_ENCODING_ADOBE_LATIN_1: - return AdobeWinAnsiEncoding[(FX_BYTE)charcode]; + return AdobeWinAnsiEncoding[(uint8_t)charcode]; case FXFT_ENCODING_APPLE_ROMAN: - return MacRomanEncoding[(FX_BYTE)charcode]; + return MacRomanEncoding[(uint8_t)charcode]; case PDFFONT_ENCODING_PDFDOC: - return PDFDocEncoding[(FX_BYTE)charcode]; + return PDFDocEncoding[(uint8_t)charcode]; } return 0; } diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index a08660c52f..a6209cb536 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -124,7 +124,7 @@ static FX_DWORD CMap_GetCode(FX_BSTR word) int num = 0; if (word.GetAt(0) == '<') { for (int i = 1; i < word.GetLength(); i ++) { - FX_BYTE digit = word.GetAt(i); + uint8_t digit = word.GetAt(i); if (digit >= '0' && digit <= '9') { digit = digit - '0'; } else if (digit >= 'a' && digit <= 'f') { @@ -161,17 +161,17 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, FX_BSTR first, FX_BSTR return FALSE; } for (i = 0; i < range.m_CharSize; i ++) { - FX_BYTE digit1 = first.GetAt(i * 2 + 1); - FX_BYTE digit2 = first.GetAt(i * 2 + 2); - FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); + uint8_t digit1 = first.GetAt(i * 2 + 1); + uint8_t digit2 = first.GetAt(i * 2 + 2); + uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10)); range.m_Lower[i] = byte; } FX_DWORD size = second.GetLength(); for (i = 0; i < range.m_CharSize; i ++) { - FX_BYTE digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : 0; - FX_BYTE digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : 0; - FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); + uint8_t digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : 0; + uint8_t digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : 0; + uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10)); range.m_Upper[i] = byte; } @@ -254,7 +254,7 @@ void CPDF_CMapParser::ParseWord(FX_BSTR word) if (nSegs > 1) { m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; m_pCMap->m_nCodeRanges = nSegs; - m_pCMap->m_pLeadingBytes = FX_Alloc2D(FX_BYTE, nSegs, sizeof(_CMap_CodeRange)); + m_pCMap->m_pLeadingBytes = FX_Alloc2D(uint8_t, nSegs, sizeof(_CMap_CodeRange)); FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(), nSegs * sizeof(_CMap_CodeRange)); } else if (nSegs == 1) { m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CPDF_CMap::TwoBytes : CPDF_CMap::OneByte; @@ -376,7 +376,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO m_Coding = map.m_Coding; m_CodingScheme = map.m_CodingScheme; if (m_CodingScheme == MixedTwoBytes) { - m_pLeadingBytes = FX_Alloc(FX_BYTE, 256); + m_pLeadingBytes = FX_Alloc(uint8_t, 256); for (FX_DWORD i = 0; i < map.m_LeadingSegCount; i ++) { for (int b = map.m_LeadingSegs[i * 2]; b <= map.m_LeadingSegs[i * 2 + 1]; b ++) { m_pLeadingBytes[b] = 1; @@ -410,7 +410,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(FX_LPCBYTE pData, FX_DWORD size) parser.ParseWord(word); } if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { - m_pAddMapping = FX_Alloc(FX_BYTE, parser.m_AddMaps.GetSize() + 4); + m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4); *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; FXSYS_memcpy32(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m_AddMaps.GetSize()); FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compare_dword); @@ -500,15 +500,15 @@ FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con offset += 2; return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)[offset - 1]; case MixedTwoBytes: { - FX_BYTE byte1 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte1 = ((FX_LPBYTE)pString)[offset++]; if (!m_pLeadingBytes[byte1]) { return byte1; } - FX_BYTE byte2 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte2 = ((FX_LPBYTE)pString)[offset++]; return byte1 * 256 + byte2; } case MixedFourBytes: { - FX_BYTE codes[4]; + uint8_t codes[4]; int char_size = 1; codes[0] = ((FX_LPBYTE)pString)[offset++]; _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; @@ -589,10 +589,10 @@ int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) if (!iRangesSize) { return 1; } - FX_BYTE codes[4]; + uint8_t codes[4]; codes[0] = codes[1] = 0x00; - codes[2] = (FX_BYTE)(charcode >> 8 & 0xFF); - codes[3] = (FX_BYTE)charcode; + codes[2] = (uint8_t)(charcode >> 8 & 0xFF); + codes[3] = (uint8_t)charcode; int offset = 0, size = 4; for (int i = 0; i < 4; ++i) { int iSeg = iRangesSize - 1; @@ -623,11 +623,11 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const { switch (m_CodingScheme) { case OneByte: - str[0] = (FX_BYTE)charcode; + str[0] = (uint8_t)charcode; return 1; case TwoBytes: - str[0] = (FX_BYTE)(charcode / 256); - str[1] = (FX_BYTE)(charcode % 256); + str[0] = (uint8_t)(charcode / 256); + str[1] = (uint8_t)(charcode % 256); return 2; case MixedTwoBytes: case MixedFourBytes: @@ -638,24 +638,24 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const iSize = 1; } if (iSize > 1) { - FXSYS_memset32(str, 0, sizeof(FX_BYTE) * iSize); + FXSYS_memset32(str, 0, sizeof(uint8_t) * iSize); } - str[iSize - 1] = (FX_BYTE)charcode; + str[iSize - 1] = (uint8_t)charcode; return iSize; } else if (charcode < 0x10000) { - str[0] = (FX_BYTE)(charcode >> 8); - str[1] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 8); + str[1] = (uint8_t)charcode; return 2; } else if (charcode < 0x1000000) { - str[0] = (FX_BYTE)(charcode >> 16); - str[1] = (FX_BYTE)(charcode >> 8); - str[2] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 16); + str[1] = (uint8_t)(charcode >> 8); + str[2] = (uint8_t)charcode; return 3; } else { - str[0] = (FX_BYTE)(charcode >> 24); - str[1] = (FX_BYTE)(charcode >> 16); - str[2] = (FX_BYTE)(charcode >> 8); - str[3] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 24); + str[1] = (uint8_t)(charcode >> 16); + str[2] = (uint8_t)(charcode >> 8); + str[3] = (uint8_t)charcode; return 4; } } @@ -837,7 +837,7 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const return 0; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE buffer[32]; + uint8_t buffer[32]; int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &unicode, 1, (char*)buffer, 4, NULL, NULL); if (ret == 1) { return buffer[0]; @@ -990,7 +990,7 @@ FX_BOOL CPDF_CIDFont::_Load() } return TRUE; } -FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) +FX_FLOAT _CIDTransformToFloat(uint8_t ch) { if (ch < 128) { return ch * 1.0f / 127; @@ -1150,7 +1150,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph) unsigned long length = 0; int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); if (!error) { - m_Font.m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); + m_Font.m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); } } int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, m_Font.m_pGsubData, NULL); @@ -1421,7 +1421,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312() } const struct _CIDTransform { FX_WORD CID; - FX_BYTE a, b, c, d, e, f; + uint8_t a, b, c, d, e, f; } Japan1_VertCIDs[] = { {97, 129, 0, 0, 127, 55, 0}, diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index ae67d2f0ef..ab15c47cb3 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -20,8 +20,8 @@ extern "C" { } }; struct _IntPair { - FX_INT32 key; - FX_INT32 value; + int32_t key; + int32_t value; }; void CFX_GlyphMap::SetAt(int key, int value) { @@ -431,7 +431,7 @@ IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) unsigned long length = 0; int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); if (!error) { - pFont->m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); + pFont->m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); } if (!pFont->m_pGsubData) { return NULL; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 5a9f1a8cb8..82f90d17a6 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -113,7 +113,7 @@ CPDF_TextObject::~CPDF_TextObject() } void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { - pInfo->m_CharCode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[index]; + pInfo->m_CharCode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0; pInfo->m_OriginY = 0; if (pInfo->m_CharCode == -1) { @@ -150,7 +150,7 @@ int CPDF_TextObject::CountChars() const void CPDF_TextObject::GetCharInfo(int index, FX_DWORD& charcode, FX_FLOAT& kerning) const { if (m_nChars == 1) { - charcode = (FX_DWORD)(FX_UINTPTR)m_pCharCodes; + charcode = (FX_DWORD)(uintptr_t)m_pCharCodes; kerning = 0; return; } @@ -254,7 +254,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKernin } } else { int offset = 0; - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pFont->GetNextChar(pStrs[0], pStrs[0].GetLength(), offset); + m_pCharCodes = (FX_DWORD*)(uintptr_t)pFont->GetNextChar(pStrs[0], pStrs[0].GetLength(), offset); } } void CPDF_TextObject::SetText(const CFX_ByteString& str) @@ -311,7 +311,7 @@ void CPDF_TextObject::SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKerni } } } else { - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0]; + m_pCharCodes = (FX_DWORD*)(uintptr_t)pCharCodes[0]; } RecalcPositionData(); } @@ -360,7 +360,7 @@ void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; int count = 0; for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -404,7 +404,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextA } FX_FLOAT fontsize = m_TextState.GetFontSize(); for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000; continue; @@ -531,7 +531,7 @@ void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const FX_FLOAT fontsize = m_TextState.GetFontSize(); int index = 0; for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -583,7 +583,7 @@ void CPDF_TextObject::SetData(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharP return; } if (nChars == 1) { - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR) * pCharCodes; + m_pCharCodes = (FX_DWORD*)(uintptr_t) * pCharCodes; } else { m_pCharCodes = FX_Alloc(FX_DWORD, nChars); FXSYS_memcpy32(m_pCharCodes, pCharCodes, sizeof(FX_DWORD)*nChars); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 8b9ff8ea96..ea61078209 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -129,7 +129,7 @@ static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) { if (pDestBuf == pSrcBuf) for (int i = 0; i < pixels; i ++) { - FX_BYTE temp = pDestBuf[2]; + uint8_t temp = pDestBuf[2]; pDestBuf[2] = pDestBuf[0]; pDestBuf[0] = temp; pDestBuf += 3; @@ -168,7 +168,7 @@ void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, i if (!m_dwStdConversion) { AdobeCMYK_to_sRGB1(pSrcBuf[0], pSrcBuf[1], pSrcBuf[2], pSrcBuf[3], pDestBuf[2], pDestBuf[1], pDestBuf[0]); } else { - FX_BYTE k = pSrcBuf[3]; + uint8_t k = pSrcBuf[3]; pDestBuf[2] = 255 - FX_MIN(255, pSrcBuf[0] + k); pDestBuf[1] = 255 - FX_MIN(255, pSrcBuf[1] + k); pDestBuf[0] = 255 - FX_MIN(255, pSrcBuf[2] + k); @@ -178,7 +178,7 @@ void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, i } } } -const FX_BYTE g_sRGBSamples1[] = { +const uint8_t g_sRGBSamples1[] = { 0, 3, 6, 10, 13, 15, 18, 20, 22, 23, 25, 27, 28, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, @@ -192,7 +192,7 @@ const FX_BYTE g_sRGBSamples1[] = { 110, 110, 111, 111, 111, 112, 112, 112, 113, 113, 113, 114, 114, 114, 115, 115, 115, 115, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 120, }; -const FX_BYTE g_sRGBSamples2[] = { +const uint8_t g_sRGBSamples2[] = { 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, @@ -514,9 +514,9 @@ void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128); lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128); GetRGB(lab, R, G, B); - pDestBuf[0] = (FX_INT32)(B * 255); - pDestBuf[1] = (FX_INT32)(G * 255); - pDestBuf[2] = (FX_INT32)(R * 255); + pDestBuf[0] = (int32_t)(B * 255); + pDestBuf[1] = (int32_t)(G * 255); + pDestBuf[2] = (int32_t)(R * 255); pDestBuf += 3; pSrcBuf += 3; } @@ -611,7 +611,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } else { // No valid alternative colorspace pAlterCS->ReleaseCS(); - FX_INT32 nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0; + int32_t nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0; if (nDictComponents != 1 && nDictComponents != 3 && nDictComponents != 4) { return FALSE; } @@ -715,14 +715,14 @@ void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(m_pProfile->m_pTransform, pDestBuf, pSrcBuf, pixels); } else { if (m_pCache == NULL) { - ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(FX_BYTE, nMaxColors, 3); - FX_LPBYTE temp_src = FX_Alloc2D(FX_BYTE, nMaxColors, m_nComponents); + ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(uint8_t, nMaxColors, 3); + FX_LPBYTE temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents); FX_LPBYTE pSrc = temp_src; for (int i = 0; i < nMaxColors; i ++) { FX_DWORD color = i; FX_DWORD order = nMaxColors / 52; for (int c = 0; c < m_nComponents; c ++) { - *pSrc++ = (FX_BYTE)(color / order * 5); + *pSrc++ = (uint8_t)(color / order * 5); color %= order; order /= 52; } @@ -826,7 +826,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const { - int index = (FX_INT32)(*pBuf); + int index = (int32_t)(*pBuf); if (index < 0 || index > m_MaxIndex) { return FALSE; } @@ -1204,7 +1204,7 @@ int CPDF_ColorSpace::GetBufSize() const FX_FLOAT* CPDF_ColorSpace::CreateBuf() { int size = GetBufSize(); - FX_BYTE* pBuf = FX_Alloc(FX_BYTE, size); + uint8_t* pBuf = FX_Alloc(uint8_t, size); return (FX_FLOAT*)pBuf; } FX_BOOL CPDF_ColorSpace::sRGB() const @@ -1270,9 +1270,9 @@ void CPDF_ColorSpace::TranslateImageLine(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, src[j] = (FX_FLOAT)(*src_buf ++) / 255; } GetRGB(src, R, G, B); - *dest_buf ++ = (FX_INT32)(B * 255); - *dest_buf ++ = (FX_INT32)(G * 255); - *dest_buf ++ = (FX_INT32)(R * 255); + *dest_buf ++ = (int32_t)(B * 255); + *dest_buf ++ = (int32_t)(G * 255); + *dest_buf ++ = (int32_t)(R * 255); } } void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) @@ -1420,9 +1420,9 @@ FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) { return FALSE; } - R = (FX_INT32)(r * 255 + 0.5f); - G = (FX_INT32)(g * 255 + 0.5f); - B = (FX_INT32)(b * 255 + 0.5f); + R = (int32_t)(r * 255 + 0.5f); + G = (int32_t)(g * 255 + 0.5f); + B = (int32_t)(b * 255 + 0.5f); return TRUE; } CPDF_Pattern* CPDF_Color::GetPattern() const diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 241b5895c5..00ea4c5fce 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -572,7 +572,7 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream) } CPDF_StreamAcc stream; stream.LoadAllData(pIccProfileStream, FALSE); - FX_BYTE digest[20]; + uint8_t digest[20]; CPDF_Stream* pCopiedStream = NULL; CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest); if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStream)) { @@ -621,7 +621,7 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream) ftData = new CPDF_CountedObject; CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; CPDF_Dictionary* pFontDict = pFontStream->GetDict(); - FX_INT32 org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); + int32_t org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); if (org_size < 0) { org_size = 0; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index d29dee77d8..dadf6bf9cb 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -77,7 +77,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) { int size = m_Operators.GetSize(); for (int i = 0; i < size; i ++) { - PDF_PSOP op = (PDF_PSOP)(FX_UINTPTR)m_Operators[i]; + PDF_PSOP op = (PDF_PSOP)(uintptr_t)m_Operators[i]; if (op == PSOP_PROC) { i ++; } else if (op == PSOP_CONST) { @@ -492,7 +492,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) if (!pSize && i == 0) { m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size")); } - if (nTotalSamples > 0 && (FX_UINT32)(m_pEncodeInfo[i].sizes) > UINT_MAX / nTotalSamples) { + if (nTotalSamples > 0 && (uint32_t)(m_pEncodeInfo[i].sizes) > UINT_MAX / nTotalSamples) { return FALSE; } nTotalSamples *= m_pEncodeInfo[i].sizes; @@ -512,7 +512,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) return FALSE; } nTotalSamples *= m_nBitsPerSample; - if (nTotalSamples > 0 && ((FX_UINT32)m_nOutputs) > UINT_MAX / nTotalSamples) { + if (nTotalSamples > 0 && ((uint32_t)m_nOutputs) > UINT_MAX / nTotalSamples) { return FALSE; } nTotalSamples *= m_nOutputs; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index 2bf3b1d4c3..bb4b9dee23 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -60,7 +60,7 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) for (int i = 0; i < m_PathCount; i ++) { m_pPathList[i] = src.m_pPathList[i]; } - m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); + m_pTypeList = FX_Alloc(uint8_t, alloc_size); FXSYS_memcpy32(m_pTypeList, src.m_pTypeList, m_PathCount); } else { m_pPathList = NULL; @@ -88,7 +88,7 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count) m_PathCount = path_count; int alloc_size = (path_count + 7) / 8 * 8; m_pPathList = new CPDF_Path[alloc_size]; - m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); + m_pTypeList = FX_Alloc(uint8_t, alloc_size); } if (text_count) { m_TextCount = text_count; @@ -155,7 +155,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) pNewPath[i] = pData->m_pPathList[i]; } delete[] pData->m_pPathList; - FX_BYTE* pNewType = FX_Alloc(FX_BYTE, pData->m_PathCount + 8); + uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8); FXSYS_memcpy32(pNewType, pData->m_pTypeList, pData->m_PathCount); if (pData->m_pTypeList) { FX_Free(pData->m_pTypeList); @@ -164,7 +164,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) pData->m_pTypeList = pNewType; } pData->m_pPathList[pData->m_PathCount] = path; - pData->m_pTypeList[pData->m_PathCount] = (FX_BYTE)type; + pData->m_pTypeList[pData->m_PathCount] = (uint8_t)type; pData->m_PathCount ++; } void CPDF_ClipPath::DeletePath(int index) diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index b3e3cd6a2c..a92e9e783d 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -1553,7 +1553,7 @@ CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) FX_LPCBYTE str = src_buf.GetBuffer(); FX_DWORD size = src_buf.GetSize(); for (FX_DWORD i = 0; i < size; i ++) { - FX_BYTE ch = str[i]; + uint8_t ch = str[i]; if (ch >= '0' && ch <= '9') { if (bFirst) { code = (ch - '0') * 16; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index d8b24593ef..bc2138e19e 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -23,7 +23,7 @@ FX_BOOL _PDF_HasInvalidOpChar(FX_LPCSTR op) if(!op) { return FALSE; } - FX_BYTE ch; + uint8_t ch; while((ch = *op++)) { if(_PDF_OpCharType[ch] == 'I') { return TRUE; @@ -235,7 +235,7 @@ void CPDF_StreamContentParser::ParsePathObject() } } } -CPDF_StreamParser::CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize) +CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) { m_pBuf = pData; m_Size = dwSize; @@ -262,7 +262,7 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b delete pDecoder; return -1; } - dest_buf = FX_Alloc2D(FX_BYTE, pitch, height); + dest_buf = FX_Alloc2D(uint8_t, pitch, height); dest_size = pitch * height; // Safe since checked alloc returned. for (int row = 0; row < height; row ++) { FX_LPBYTE pLine = pDecoder->GetScanline(row); @@ -277,11 +277,11 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b } ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, +FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD PDF_DecodeInlineStream(const FX_BYTE* src_buf, FX_DWORD limit, +FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit, int width, int height, CFX_ByteString& decoder, CPDF_Dictionary* pParam, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { @@ -373,7 +373,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti if (OrigSize > m_Size - m_Pos) { OrigSize = m_Size - m_Pos; } - pData = FX_Alloc(FX_BYTE, OrigSize); + pData = FX_Alloc(uint8_t, OrigSize); FXSYS_memcpy32(pData, m_pBuf + m_Pos, OrigSize); dwStreamSize = OrigSize; m_Pos += OrigSize; @@ -421,7 +421,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti dwStreamSize += m_Pos - dwPrevPos; } m_Pos = dwSavePos; - pData = FX_Alloc(FX_BYTE, dwStreamSize); + pData = FX_Alloc(uint8_t, dwStreamSize); FXSYS_memcpy32(pData, m_pBuf + m_Pos, dwStreamSize); m_Pos += dwStreamSize; } @@ -1049,7 +1049,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) } m_Size += size + 1; } - m_pData = FX_Alloc(FX_BYTE, m_Size); + m_pData = FX_Alloc(uint8_t, m_Size); FX_DWORD pos = 0; for (i = 0; i < m_nStreams; i ++) { FXSYS_memcpy32(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize()); diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 7c527150b3..1f5428d56f 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -16,7 +16,7 @@ class CPDF_StreamParser { public: - CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize); + CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); ~CPDF_StreamParser(); CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); @@ -52,10 +52,10 @@ protected: void GetNextWord(FX_BOOL& bIsNumber); CFX_ByteString ReadString(); CFX_ByteString ReadHexString(); - const FX_BYTE* m_pBuf; + const uint8_t* m_pBuf; FX_DWORD m_Size; FX_DWORD m_Pos; - FX_BYTE m_WordBuffer[256]; + uint8_t m_WordBuffer[256]; FX_DWORD m_WordSize; CPDF_Object* m_pLastObj; }; @@ -153,7 +153,7 @@ public: FX_FLOAT GetNumber16(FX_DWORD index); int GetInteger(FX_DWORD index) { - return (FX_INT32)(GetNumber(index)); + return (int32_t)(GetNumber(index)); } FX_BOOL OnOperator(FX_LPCSTR op); void BigCaseCaller(int index); @@ -338,7 +338,7 @@ KeyType PDF_DocPageData_FindValue(const CFX_MapPtrTemplate FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE) @@ -422,11 +422,11 @@ class CPDF_IccProfile public: CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); ~CPDF_IccProfile(); - FX_INT32 GetComponents() const { return m_nSrcComponents; } + int32_t GetComponents() const { return m_nSrcComponents; } FX_BOOL m_bsRGB; FX_LPVOID m_pTransform; private: - FX_INT32 m_nSrcComponents; + int32_t m_nSrcComponents; }; class CPDF_DeviceCS : public CPDF_ColorSpace { diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h index 1139371fda..6652cc0ccc 100644 --- a/core/src/fpdfapi/fpdf_parser/filters_int.h +++ b/core/src/fpdfapi/fpdf_parser/filters_int.h @@ -26,7 +26,7 @@ public: virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; - FX_BYTE m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; + uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; }; class CPDF_LzwFilter : public CFX_DataFilter { @@ -40,11 +40,11 @@ public: FX_DWORD m_nCodes; FX_DWORD m_CodeLen; FX_DWORD m_OldCode; - FX_BYTE m_LastChar; + uint8_t m_LastChar; FX_DWORD m_nLeftBits, m_LeftBits; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); void DecodeString(FX_DWORD code); }; class CPDF_PredictorFilter : public CFX_DataFilter diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index d18caab217..b1fde0be71 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include #define _STREAM_MAX_SIZE_ 20 * 1024 * 1024 -FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = 0; dest_buf = NULL; @@ -19,7 +19,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b FX_DWORD zcount = 0; FX_DWORD pos = 0; while (pos < src_size) { - FX_BYTE ch = src_buf[pos]; + uint8_t ch = src_buf[pos]; if (ch < '!' && ch != '\n' && ch != '\r' && ch != ' ' && ch != '\t') { break; } @@ -39,12 +39,12 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b if (zcount * 4 > UINT_MAX - (pos - zcount)) { return (FX_DWORD) - 1; } - dest_buf = FX_Alloc(FX_BYTE, zcount * 4 + (pos - zcount)); + dest_buf = FX_Alloc(uint8_t, zcount * 4 + (pos - zcount)); int state = 0; - FX_UINT32 res = 0; + uint32_t res = 0; pos = dest_size = 0; while (pos < src_size) { - FX_BYTE ch = src_buf[pos++]; + uint8_t ch = src_buf[pos++]; if (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t') { continue; } @@ -61,7 +61,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b state ++; if (state == 5) { for (int i = 0; i < 4; i ++) { - dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8); + dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8); } state = 0; res = 0; @@ -74,7 +74,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b res = res * 85 + 84; } for (i = 0; i < state - 1; i ++) { - dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8); + dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8); } } if (pos < src_size && src_buf[pos] == '>') { @@ -82,18 +82,18 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return pos; } -FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { FX_DWORD i; for (i = 0; i < src_size; i ++) if (src_buf[i] == '>') { break; } - dest_buf = FX_Alloc( FX_BYTE, i / 2 + 1); + dest_buf = FX_Alloc( uint8_t, i / 2 + 1); dest_size = 0; FX_BOOL bFirstDigit = TRUE; for (i = 0; i < src_size; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') { continue; } @@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return i; } -FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { FX_DWORD i = 0; FX_DWORD old; @@ -149,7 +149,7 @@ FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& d if (dest_size >= _STREAM_MAX_SIZE_) { return -1; } - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); i = 0; int dest_count = 0; while (i < src_size) { @@ -245,7 +245,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); } -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, +FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { int predictor = 0; @@ -468,7 +468,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap dest_buf2 += 2; for (int i = 0; i < len; i ++) { *dest_buf2++ = pString[i] >> 8; - *dest_buf2++ = (FX_BYTE)pString[i]; + *dest_buf2++ = (uint8_t)pString[i]; } result.ReleaseBuffer(encLen); return result; @@ -488,7 +488,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) } result.AppendChar('('); for (int i = 0; i < srclen; i ++) { - FX_BYTE ch = src[i]; + uint8_t ch = src[i]; if (ch == ')' || ch == '\\' || ch == '(') { result.AppendChar('\\'); } else if (ch == 0x0a) { @@ -503,7 +503,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) result.AppendChar(')'); return result.GetByteString(); } -void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { @@ -518,7 +518,7 @@ void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Color pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size); } } -FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index b11c7eeb44..f2643694ec 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -343,7 +343,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { { CPDF_Object* pObj; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj)) { bForm = pObj->GetType() == PDFOBJ_STREAM && ((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Form"); return TRUE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index e35b0a9d10..4ca97fe9e8 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -7,7 +7,7 @@ #include #include "../../../include/fpdfapi/fpdf_parser.h" #include "../../../include/fdrm/fx_crypt.h" -const FX_BYTE defpasscode[32] = { +const uint8_t defpasscode[32] = { 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, @@ -17,11 +17,11 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) { int revision = pEncrypt->GetInteger(FX_BSTRC("R")); - FX_BYTE passcode[32]; + uint8_t passcode[32]; for (FX_DWORD i = 0; i < 32; i ++) { passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size]; } - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); @@ -36,7 +36,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas FX_DWORD tag = (FX_DWORD) - 1; CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4); } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Finish(md5, digest); FX_DWORD copy_len = keylen; if (copy_len > sizeof(digest)) { @@ -55,8 +55,8 @@ CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() return new CPDF_StandardCryptoHandler; } typedef struct _PDF_CRYPTOITEM { - FX_INT32 m_Cipher; - FX_INT32 m_KeyLen; + int32_t m_Cipher; + int32_t m_KeyLen; FX_BOOL m_bChecked; CPDF_StandardCryptoHandler* m_pCryptoHandler; } PDF_CRYPTOITEM; @@ -85,7 +85,7 @@ FX_BOOL CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictiona } return CheckSecurity(m_KeyLen); } -FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(FX_INT32 key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) { CFX_ByteString password = m_pParser->GetPassword(); if (CheckPassword(password, password.GetLength(), TRUE, m_EncryptKey, key_len)) { @@ -198,14 +198,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff } #define FX_GET_32WORD(n,b,i) \ { \ - (n) = (FX_DWORD)(( (FX_UINT64) (b)[(i)] << 24 ) \ - | ( (FX_UINT64) (b)[(i) + 1] << 16 ) \ - | ( (FX_UINT64) (b)[(i) + 2] << 8 ) \ - | ( (FX_UINT64) (b)[(i) + 3] )); \ + (n) = (FX_DWORD)(( (uint64_t) (b)[(i)] << 24 ) \ + | ( (uint64_t) (b)[(i) + 1] << 16 ) \ + | ( (uint64_t) (b)[(i) + 2] << 8 ) \ + | ( (uint64_t) (b)[(i) + 3] )); \ } int BigOrder64BitsMod3(FX_LPBYTE data) { - FX_UINT64 ret = 0; + uint64_t ret = 0; for (int i = 0; i < 4; ++i) { FX_DWORD value; FX_GET_32WORD(value, data, 4 * i); @@ -218,14 +218,14 @@ int BigOrder64BitsMod3(FX_LPBYTE data) void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash) { int iBlockSize = 32; - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); CRYPT_SHA256Update(sha, salt, 8); if (vector) { CRYPT_SHA256Update(sha, vector, 48); } - FX_BYTE digest[32]; + uint8_t digest[32]; CRYPT_SHA256Finish(sha, digest); CFX_ByteTextBuf buf; FX_LPBYTE input = digest; @@ -235,7 +235,7 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB int iBufLen = buf.GetLength(); CFX_ByteTextBuf interDigest; int i = 0; - FX_LPBYTE aes = FX_Alloc(FX_BYTE, 2048); + FX_LPBYTE aes = FX_Alloc(uint8_t, 2048); while (i < 64 || i < E[iBufLen - 1] + 32) { int iRoundSize = size + iBlockSize; if (vector) { @@ -300,8 +300,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, return FALSE; } FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey; - FX_BYTE sha[128]; - FX_BYTE digest[32]; + uint8_t sha[128]; + uint8_t digest[32]; if (m_Revision >= 6) { Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 32, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest); } else { @@ -334,9 +334,9 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (ekey.GetLength() < 32) { return FALSE; } - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest, 32, FALSE); - FX_BYTE iv[16]; + uint8_t iv[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESDecrypt(aes, key, ekey, 32); @@ -346,14 +346,14 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (perms.IsEmpty()) { return FALSE; } - FX_BYTE perms_buf[16]; + uint8_t perms_buf[16]; FXSYS_memset32(perms_buf, 0, sizeof(perms_buf)); FX_DWORD copy_len = sizeof(perms_buf); if (copy_len > (FX_DWORD)perms.GetLength()) { copy_len = perms.GetLength(); } FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len); - FX_BYTE buf[16]; + uint8_t buf[16]; CRYPT_AESDecrypt(aes, buf, perms_buf, 16); FX_Free(aes); if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') { @@ -371,12 +371,12 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pa { return CheckPassword(password, pass_size, bOwner, key, m_KeyLen); } -int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, FX_INT32 key_len) +int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, int32_t key_len) { if (m_Revision >= 5) { return AES256_CheckPassword(password, size, bOwner, key); } - FX_BYTE keybuf[32]; + uint8_t keybuf[32]; if (key == NULL) { key = keybuf; } @@ -386,7 +386,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD si return CheckUserPassword(password, size, FALSE, key, key_len) || CheckUserPassword(password, size, TRUE, key, key_len); } FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, FX_INT32 key_len) + FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len) { CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta, m_pParser->GetIDArray()); @@ -394,12 +394,12 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ if (ukey.GetLength() < 16) { return FALSE; } - FX_BYTE ukeybuf[32]; + uint8_t ukeybuf[32]; if (m_Revision == 2) { FXSYS_memcpy32(ukeybuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len); } else { - FX_BYTE test[32], tmpkey[32]; + uint8_t test[32], tmpkey[32]; FX_DWORD copy_len = sizeof(test); if (copy_len > (FX_DWORD)ukey.GetLength()) { copy_len = ukey.GetLength(); @@ -413,7 +413,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ } CRYPT_ArcFourCryptBlock(test, 32, tmpkey, key_len); } - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, defpasscode, 32); CPDF_Array* pIdArray = m_pParser->GetIDArray(); @@ -433,22 +433,22 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa { return GetUserPassword(owner_pass, pass_size, m_KeyLen); } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, FX_INT32 key_len) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len) { CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O")); - FX_BYTE passcode[32]; + uint8_t passcode[32]; FX_DWORD i; for (i = 0; i < 32; i ++) { passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size]; } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Generate(passcode, 32, digest); if (m_Revision >= 3) { for (int i = 0; i < 50; i ++) { CRYPT_MD5Generate(digest, 16, digest); } } - FX_BYTE enckey[32]; + uint8_t enckey[32]; FXSYS_memset32(enckey, 0, sizeof(enckey)); FX_DWORD copy_len = key_len; if (copy_len > sizeof(digest)) { @@ -459,14 +459,14 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa if (okeylen > 32) { okeylen = 32; } - FX_BYTE okeybuf[64]; + uint8_t okeybuf[64]; FXSYS_memset32(okeybuf, 0, sizeof(okeybuf)); FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen); if (m_Revision == 2) { CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len); } else { for (int i = 19; i >= 0; i --) { - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; FXSYS_memset32(tempkey, 0, sizeof(tempkey)); for (int j = 0; j < m_KeyLen; j ++) { tempkey[j] = enckey[j] ^ i; @@ -481,7 +481,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa return CFX_ByteString(okeybuf, len); } FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_LPBYTE key, FX_INT32 key_len) + FX_LPBYTE key, int32_t key_len) { CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len); if (CheckUserPassword(user_pass, user_pass.GetLength(), FALSE, key, key_len)) { @@ -511,11 +511,11 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } if (m_Revision >= 5) { int t = (int)time(NULL); - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA256Start(sha); - CRYPT_SHA256Update(sha, (FX_BYTE*)&t, sizeof t); + CRYPT_SHA256Update(sha, (uint8_t*)&t, sizeof t); CRYPT_SHA256Update(sha, m_EncryptKey, 32); - CRYPT_SHA256Update(sha, (FX_BYTE*)"there", 5); + CRYPT_SHA256Update(sha, (uint8_t*)"there", 5); CRYPT_SHA256Finish(sha, m_EncryptKey); AES256_SetPassword(pEncryptDict, user_pass, user_size, FALSE, m_EncryptKey); if (bDefault) { @@ -525,29 +525,29 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ return; } if (bDefault) { - FX_BYTE passcode[32]; + uint8_t passcode[32]; FX_DWORD i; for (i = 0; i < 32; i ++) { passcode[i] = i < owner_size ? owner_pass[i] : defpasscode[i - owner_size]; } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Generate(passcode, 32, digest); if (m_Revision >= 3) { for (int i = 0; i < 50; i ++) { CRYPT_MD5Generate(digest, 16, digest); } } - FX_BYTE enckey[32]; + uint8_t enckey[32]; FXSYS_memcpy32(enckey, digest, key_len); for (i = 0; i < 32; i ++) { passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size]; } CRYPT_ArcFourCryptBlock(passcode, 32, enckey, key_len); - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; if (m_Revision >= 3) { for (i = 1; i <= 19; i ++) { for (int j = 0; j < key_len; j ++) { - tempkey[j] = enckey[j] ^ (FX_BYTE)i; + tempkey[j] = enckey[j] ^ (uint8_t)i; } CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len); } @@ -556,25 +556,25 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); if (m_Revision < 3) { - FX_BYTE tempbuf[32]; + uint8_t tempbuf[32]; FXSYS_memcpy32(tempbuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len); pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(tempbuf, 32)); } else { - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } - FX_BYTE digest[32]; + uint8_t digest[32]; CRYPT_MD5Finish(md5, digest); CRYPT_ArcFourCryptBlock(digest, 16, m_EncryptKey, key_len); - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; for (int i = 1; i <= 19; i ++) { for (int j = 0; j < key_len; j ++) { - tempkey[j] = m_EncryptKey[j] ^ (FX_BYTE)i; + tempkey[j] = m_EncryptKey[j] ^ (uint8_t)i; } CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len); } @@ -594,14 +594,14 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key) { - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA1Start(sha); CRYPT_SHA1Update(sha, key, 32); - CRYPT_SHA1Update(sha, (FX_BYTE*)"hello", 5); - FX_BYTE digest[20]; + CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5); + uint8_t digest[20]; CRYPT_SHA1Finish(sha, digest); CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U")); - FX_BYTE digest1[48]; + uint8_t digest1[48]; if (m_Revision >= 6) { Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); } else { @@ -626,9 +626,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD } CRYPT_SHA256Finish(sha, digest1); } - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE); - FX_BYTE iv[16]; + uint8_t iv[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, digest1, key, 32); @@ -638,11 +638,11 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions, FX_BOOL bEncryptMetadata, FX_LPCBYTE key) { - FX_BYTE buf[16]; - buf[0] = (FX_BYTE)permissions; - buf[1] = (FX_BYTE)(permissions >> 8); - buf[2] = (FX_BYTE)(permissions >> 16); - buf[3] = (FX_BYTE)(permissions >> 24); + uint8_t buf[16]; + buf[0] = (uint8_t)permissions; + buf[1] = (uint8_t)(permissions >> 8); + buf[2] = (uint8_t)(permissions >> 16); + buf[3] = (uint8_t)(permissions >> 24); buf[4] = 0xff; buf[5] = 0xff; buf[6] = 0xff; @@ -651,9 +651,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict buf[9] = 'a'; buf[10] = 'd'; buf[11] = 'b'; - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, key, 32, TRUE); - FX_BYTE iv[16], buf1[16]; + uint8_t iv[16], buf1[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, buf1, buf, 16); @@ -667,16 +667,16 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F FXSYS_memcpy32(dest_buf, src_buf, src_size); return; } - FX_BYTE realkey[16]; + uint8_t realkey[16]; int realkeylen = 16; if (m_Cipher != FXCIPHER_AES || m_KeyLen != 32) { - FX_BYTE key1[32]; + uint8_t key1[32]; FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen); - key1[m_KeyLen + 0] = (FX_BYTE)objnum; - key1[m_KeyLen + 1] = (FX_BYTE)(objnum >> 8); - key1[m_KeyLen + 2] = (FX_BYTE)(objnum >> 16); - key1[m_KeyLen + 3] = (FX_BYTE)gennum; - key1[m_KeyLen + 4] = (FX_BYTE)(gennum >> 8); + key1[m_KeyLen + 0] = (uint8_t)objnum; + key1[m_KeyLen + 1] = (uint8_t)(objnum >> 8); + key1[m_KeyLen + 2] = (uint8_t)(objnum >> 16); + key1[m_KeyLen + 3] = (uint8_t)gennum; + key1[m_KeyLen + 4] = (uint8_t)(gennum >> 8); FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3); FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2); if (m_Cipher == FXCIPHER_AES) { @@ -691,15 +691,15 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F if (m_Cipher == FXCIPHER_AES) { CRYPT_AESSetKey(m_pAESContext, 16, m_KeyLen == 32 ? m_EncryptKey : realkey, m_KeyLen, bEncrypt); if (bEncrypt) { - FX_BYTE iv[16]; + uint8_t iv[16]; for (int i = 0; i < 16; i ++) { - iv[i] = (FX_BYTE)rand(); + iv[i] = (uint8_t)rand(); } CRYPT_AESSetIV(m_pAESContext, iv); FXSYS_memcpy32(dest_buf, iv, 16); int nblocks = src_size / 16; CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 16); - FX_BYTE padding[16]; + uint8_t padding[16]; FXSYS_memcpy32(padding, src_buf + nblocks * 16, src_size % 16); FXSYS_memset8(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16); CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding, 16); @@ -719,9 +719,9 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F } } typedef struct _AESCryptContext { - FX_BYTE m_Context[2048]; + uint8_t m_Context[2048]; FX_BOOL m_bIV; - FX_BYTE m_Block[16]; + uint8_t m_Block[16]; FX_DWORD m_BlockOffset; } AESCryptContext; FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) @@ -736,20 +736,20 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt); if (bEncrypt) { for (int i = 0; i < 16; i ++) { - pContext->m_Block[i] = (FX_BYTE)rand(); + pContext->m_Block[i] = (uint8_t)rand(); } CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block); } return pContext; } - FX_BYTE key1[48]; + uint8_t key1[48]; FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen); FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3); FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2); if (m_Cipher == FXCIPHER_AES) { FXSYS_memcpy32(key1 + m_KeyLen + 5, "sAlT", 4); } - FX_BYTE realkey[16]; + uint8_t realkey[16]; CRYPT_MD5Generate(key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey); int realkeylen = m_KeyLen + 5; if (realkeylen > 16) { @@ -762,13 +762,13 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt); if (bEncrypt) { for (int i = 0; i < 16; i ++) { - pContext->m_Block[i] = (FX_BYTE)rand(); + pContext->m_Block[i] = (uint8_t)rand(); } CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block); } return pContext; } - void* pContext = FX_Alloc(FX_BYTE, 1040); + void* pContext = FX_Alloc(uint8_t, 1040); CRYPT_ArcFourSetup(pContext, realkey, realkeylen); return pContext; } @@ -809,7 +809,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr pContext->m_bIV = FALSE; pContext->m_BlockOffset = 0; } else if (src_off < src_size) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; if (bEncrypt) { CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); } else { @@ -839,17 +839,17 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf } AESCryptContext* pContext = (AESCryptContext*)context; if (bEncrypt) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; if (pContext->m_BlockOffset == 16) { CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); pContext->m_BlockOffset = 0; } - FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (FX_BYTE)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset); + FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (uint8_t)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset); CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); } else if (pContext->m_BlockOffset == 16) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; CRYPT_AESDecrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); if (block_buf[15] <= 16) { dest_buf.AppendBlock(block_buf, 16 - block_buf[15]); @@ -879,7 +879,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec FXSYS_memcpy32(m_EncryptKey, key, m_KeyLen); } if (m_Cipher == FXCIPHER_AES) { - m_pAESContext = FX_Alloc(FX_BYTE, 2048); + m_pAESContext = FX_Alloc(uint8_t, 2048); } return TRUE; } @@ -911,7 +911,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) m_KeyLen = keylen; FXSYS_memcpy32(m_EncryptKey, key, keylen); if (m_Cipher == FXCIPHER_AES) { - m_pAESContext = FX_Alloc(FX_BYTE, 2048); + m_pAESContext = FX_Alloc(uint8_t, 2048); } return TRUE; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index 6fa7419a41..8cb0cee82a 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -296,7 +296,7 @@ void CPDF_DecryptFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf) extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -361,8 +361,8 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar m_nLeftBits = 8 - new_bits; m_LeftBits = src_buf[i] % (1 << m_nLeftBits); if (code < 256) { - dest_buf.AppendByte((FX_BYTE)code); - m_LastChar = (FX_BYTE)code; + dest_buf.AppendByte((uint8_t)code); + m_LastChar = (uint8_t)code; if (m_OldCode != -1) { AddCode(m_OldCode, m_LastChar); } @@ -406,7 +406,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar } } } -void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_bEarlyChange == 4094) { return; @@ -431,13 +431,13 @@ void CPDF_LzwFilter::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } CPDF_PredictorFilter::CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols) { @@ -461,23 +461,23 @@ CPDF_PredictorFilter::~CPDF_PredictorFilter() FX_Free(m_pRefLine); } } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp) { - FX_BYTE tag = cur_buf[0]; + uint8_t tag = cur_buf[0]; if (tag == 0) { return; } @@ -486,10 +486,10 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i ref_buf ++; } for (int byte = 0; byte < pitch; byte ++) { - FX_BYTE raw_byte = cur_buf[byte]; + uint8_t raw_byte = cur_buf[byte]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } @@ -497,7 +497,7 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } @@ -505,11 +505,11 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } @@ -517,15 +517,15 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= Bpp && ref_buf) { upper_left = ref_buf[byte - Bpp]; } @@ -538,9 +538,9 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pCurLine == NULL) { - m_pCurLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pCurLine = FX_Alloc(uint8_t, m_Pitch); if (!m_bTiff) { - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); } } while (1) { @@ -579,7 +579,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter() void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; if (PDF_CharType[byte] == 'W') { continue; } @@ -604,7 +604,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B m_CharCount ++; if (m_CharCount == 5) { for (int i = 0; i < 4; i ++) { - dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8)); + dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8)); } m_State = 0; } @@ -615,7 +615,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B m_CurDWord = m_CurDWord * 85 + 84; } for (i = 0; i < m_CharCount - 1; i ++) { - dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8)); + dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8)); } } m_State = 2; @@ -638,7 +638,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter() void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; if (PDF_CharType[byte] == 'W') { continue; } @@ -673,7 +673,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter() void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; switch (m_State) { case 0: if (byte < 128) { @@ -755,7 +755,7 @@ void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Bina m_Pitch = m_Width * m_nComps; } if (m_pScanline == NULL) { - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch + 4); + m_pScanline = FX_Alloc(uint8_t, m_Pitch + 4); } while (1) { if (!CPDF_ModuleMgr::Get()->GetJpegModule()->ReadScanline(m_pContext, m_pScanline)) { @@ -803,8 +803,8 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, m_nRows = nRows; m_nColumns = nColumns; m_Pitch = (m_nColumns + 7) / 8; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pScanlineBuf, 0xff, m_Pitch); FXSYS_memset8(m_pRefBuf, 0xff, m_Pitch); m_iRow = 0; @@ -839,9 +839,9 @@ void CPDF_FaxFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf) { ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, TRUE, dest_buf); } -FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos); -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns); -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns); +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos); +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns); +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns); void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, CFX_BinaryBuf& dest_buf) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index c18668d683..d636f96b68 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -295,8 +295,8 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite case PDFOBJ_REFERENCE: { CPDF_Reference* pRef = (CPDF_Reference*)this; FX_DWORD obj_num = pRef->m_RefObjNum; - if (bDirect && !visited->GetValueAt((void*)(FX_UINTPTR)obj_num)) { - visited->SetAt((void*)(FX_UINTPTR)obj_num, (void*)1); + if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { + visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); CPDF_Object* ret; if (pRef->GetDirect()) ret = pRef->GetDirect()->CloneInternal(TRUE, visited); @@ -896,7 +896,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD { InitStream(pDict); m_GenNum = (FX_DWORD) - 1; - m_pDataBuf = FX_Alloc(FX_BYTE, size); + m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } @@ -918,7 +918,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, if (bKeepBuf) { m_pDataBuf = (FX_LPBYTE)pData; } else { - m_pDataBuf = FX_Alloc(FX_BYTE, size); + m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } @@ -970,8 +970,8 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const if (!m_pFile || !pOther->m_pFile) { return FALSE; } - FX_BYTE srcBuf[1024]; - FX_BYTE destBuf[1024]; + uint8_t srcBuf[1024]; + uint8_t destBuf[1024]; FX_DWORD size = m_dwSize; FX_DWORD srcOffset = m_FileOffset; FX_DWORD destOffset = pOther->m_FileOffset; @@ -1008,7 +1008,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const if (NULL == pBuf) { return FALSE; } - FX_BYTE srcBuf[1024]; + uint8_t srcBuf[1024]; FX_DWORD size = m_dwSize; while (size > 0) { FX_DWORD actualSize = size > 1024 ? 1024 : size; @@ -1040,7 +1040,7 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); if (pSF) { - FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, 4096); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096); FX_DWORD dwRead; do { dwRead = pSF->ReadBlock(pBuf, 4096); @@ -1086,7 +1086,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, return; } if (!pStream->IsMemoryBased()) { - pSrcData = m_pSrcData = FX_Alloc(FX_BYTE, dwSrcSize); + pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize); if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) { return; } @@ -1165,7 +1165,7 @@ FX_LPBYTE CPDF_StreamAcc::DetachData() m_dwSize = 0; return p; } - FX_LPBYTE p = FX_Alloc(FX_BYTE, m_dwSize); + FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize); FXSYS_memcpy32(p, m_pData, m_dwSize); return p; } @@ -1200,7 +1200,7 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR } FX_LPVOID value; { - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (((CPDF_Object*)value)->GetObjNum() == -1) { return NULL; } @@ -1218,25 +1218,25 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (value) { ((CPDF_Object *)value)->Destroy(); } } - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); return pObj; } int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum) { FX_LPVOID value; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { return ((CPDF_Object*)value)->GetType(); } if (m_pParser) { PARSE_CONTEXT context; FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); context.m_Flags = PDFPARSE_TYPEONLY; - return (int)(FX_UINTPTR)m_pParser->ParseIndirectObject(this, objnum, &context); + return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &context); } return 0; } @@ -1246,21 +1246,21 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj) return pObj->m_ObjNum; } m_LastObjNum ++; - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)m_LastObjNum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj); pObj->m_ObjNum = m_LastObjNum; return m_LastObjNum; } void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum) { FX_LPVOID value; - if (!m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { return; } if (((CPDF_Object*)value)->GetObjNum() == -1) { return; } ((CPDF_Object*)value)->Destroy(); - m_IndirectObjs.RemoveKey((FX_LPVOID)(FX_UINTPTR)objnum); + m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum); } void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj) { @@ -1268,7 +1268,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO return; } FX_LPVOID value = NULL; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (value) { if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) @@ -1278,7 +1278,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO } } pObj->m_ObjNum = objnum; - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 9c35615a72..4afc3a668b 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -27,7 +27,7 @@ FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) } return FALSE; } -static FX_INT32 _CompareDWord(const void* p1, const void* p2) +static int32_t _CompareDWord(const void* p1, const void* p2) { return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); } @@ -98,8 +98,8 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) m_CrossRef.RemoveAll(); m_V5Type.RemoveAll(); m_ObjVersion.RemoveAll(); - FX_INT32 iLen = m_Trailers.GetSize(); - for (FX_INT32 i = 0; i < iLen; ++i) { + int32_t iLen = m_Trailers.GetSize(); + for (int32_t i = 0; i < iLen; ++i) { if (CPDF_Dictionary* trailer = m_Trailers.GetAt(i)) trailer->Release(); } @@ -109,11 +109,11 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) m_pLinearized = NULL; } } -static FX_INT32 GetHeaderOffset(IFX_FileRead* pFile) +static int32_t GetHeaderOffset(IFX_FileRead* pFile) { FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025); - FX_BYTE buf[4]; - FX_INT32 offset = 0; + uint8_t buf[4]; + int32_t offset = 0; while (1) { if (!pFile->ReadBlock(buf, offset, 4)) { return -1; @@ -152,7 +152,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX m_bXRefStream = FALSE; m_LastXRefOffset = 0; m_bOwnFileRead = bOwnFileRead; - FX_INT32 offset = GetHeaderOffset(pFileAccess); + int32_t offset = GetHeaderOffset(pFileAccess); if (offset == -1) { if (bOwnFileRead && pFileAccess) { pFileAccess->Release(); @@ -160,7 +160,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX return PDFPARSE_ERROR_FORMAT; } m_Syntax.InitParser(pFileAccess, offset); - FX_BYTE ch; + uint8_t ch; if (!m_Syntax.GetCharAt(5, ch)) { return PDFPARSE_ERROR_FORMAT; } @@ -331,11 +331,11 @@ FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) return m_CrossRef[objnum]; } if (m_V5Type[objnum] == 2) { - return m_CrossRef[(FX_INT32)m_CrossRef[objnum]]; + return m_CrossRef[(int32_t)m_CrossRef[objnum]]; } return 0; } -static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) +static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) { CPDF_Object* pObj = pDict->GetElement(key); if (pObj == NULL) { @@ -346,7 +346,7 @@ static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) } return 0; } -static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, FX_INT32 iType) +static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, int32_t iType) { CPDF_Object* pObj = pDict->GetElement(key); if (!pObj) { @@ -363,7 +363,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize <= 0 || xrefsize > (1 << 20)) { return FALSE; } @@ -400,7 +400,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); m_Trailers.Add(pDict); } - for (FX_INT32 i = 0; i < CrossRefList.GetSize(); i ++) + for (int32_t i = 0; i < CrossRefList.GetSize(); i ++) if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { return FALSE; } @@ -415,7 +415,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize == 0) { return FALSE; } @@ -434,7 +434,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); m_Trailers.Add(pDict); } - for (FX_INT32 i = 1; i < CrossRefList.GetSize(); i ++) + for (int32_t i = 1; i < CrossRefList.GetSize(); i ++) if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { return FALSE; } @@ -451,12 +451,12 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_DWORD start_objnum = 0; FX_DWORD count = dwObjCount; FX_FILESIZE SavedPos = m_Syntax.SavePos(); - FX_INT32 recordsize = 20; + int32_t recordsize = 20; char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); pBuf[1024 * recordsize] = '\0'; - FX_INT32 nBlocks = count / 1024 + 1; - for (FX_INT32 block = 0; block < nBlocks; block ++) { - FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; + int32_t nBlocks = count / 1024 + 1; + for (int32_t block = 0; block < nBlocks; block ++) { + int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; FX_DWORD dwReadSize = block_size * recordsize; if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) { FX_Free(pBuf); @@ -466,16 +466,16 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_Free(pBuf); return FALSE; } - for (FX_INT32 i = 0; i < block_size; i ++) { + for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; if (pEntry[17] == 'f') { m_CrossRef.SetAtGrow(objnum, 0); m_V5Type.SetAtGrow(objnum, 0); } else { - FX_INT32 offset = FXSYS_atoi(pEntry); + int32_t offset = FXSYS_atoi(pEntry); if (offset == 0) { - for (FX_INT32 c = 0; c < 10; c ++) { + for (int32_t c = 0; c < 10; c ++) { if (pEntry[c] < '0' || pEntry[c] > '9') { FX_Free(pBuf); return FALSE; @@ -483,7 +483,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou } } m_CrossRef.SetAtGrow(objnum, offset); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (version >= 1) { m_bVersionUpdated = TRUE; } @@ -537,7 +537,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B m_Syntax.ToNextWord(); SavedPos = m_Syntax.SavePos(); FX_BOOL bFirstItem = FALSE; - FX_INT32 recordsize = 20; + int32_t recordsize = 20; if (bFirst) { bFirstItem = TRUE; } @@ -545,12 +545,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B if (!bSkip) { char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); pBuf[1024 * recordsize] = '\0'; - FX_INT32 nBlocks = count / 1024 + 1; + int32_t nBlocks = count / 1024 + 1; FX_BOOL bFirstBlock = TRUE; - for (FX_INT32 block = 0; block < nBlocks; block ++) { - FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; + for (int32_t block = 0; block < nBlocks; block ++) { + int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; m_Syntax.ReadBlock((FX_LPBYTE)pBuf, block_size * recordsize); - for (FX_INT32 i = 0; i < block_size; i ++) { + for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; if (pEntry[17] == 'f') { @@ -560,7 +560,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } if (bFirstBlock) { FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (offset == 0 && version == 65535 && start_objnum != 0) { start_objnum--; objnum = 0; @@ -571,7 +571,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } else { FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); if (offset == 0) { - for (FX_INT32 c = 0; c < 10; c ++) { + for (int32_t c = 0; c < 10; c ++) { if (pEntry[c] < '0' || pEntry[c] > '9') { FX_Free(pBuf); return FALSE; @@ -579,7 +579,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } } m_CrossRef.SetAtGrow(objnum, offset); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (version >= 1) { m_bVersionUpdated = TRUE; } @@ -630,11 +630,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() m_pTrailer->Release(); m_pTrailer = NULL; } - FX_INT32 status = 0; - FX_INT32 inside_index = 0; + int32_t status = 0; + int32_t inside_index = 0; FX_DWORD objnum = 0, gennum = 0; - FX_INT32 depth = 0; - FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096); + int32_t depth = 0; + FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096); FX_FILESIZE pos = m_Syntax.m_HeaderOffset; FX_FILESIZE start_pos = 0, start_pos1 = 0; FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1; @@ -648,7 +648,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() break; } for (FX_DWORD i = 0; i < size; i ++) { - FX_BYTE byte = buffer[i]; + uint8_t byte = buffer[i]; switch (status) { case 0: if (PDF_CharType[byte] == 'W') { @@ -822,11 +822,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } else { i += (FX_DWORD)nLen; } - if (m_CrossRef.GetSize() > (FX_INT32)objnum && m_CrossRef[objnum]) { + if (m_CrossRef.GetSize() > (int32_t)objnum && m_CrossRef[objnum]) { if (pObject) { FX_DWORD oldgen = m_ObjVersion.GetAt(objnum); m_CrossRef[objnum] = obj_pos; - m_ObjVersion.SetAt(objnum, (FX_SHORT)gennum); + m_ObjVersion.SetAt(objnum, (int16_t)gennum); if (oldgen != gennum) { m_bVersionUpdated = TRUE; } @@ -834,7 +834,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } else { m_CrossRef.SetAtGrow(objnum, obj_pos); m_V5Type.SetAtGrow(objnum, 1); - m_ObjVersion.SetAtGrow(objnum, (FX_SHORT)gennum); + m_ObjVersion.SetAtGrow(objnum, (int16_t)gennum); } if (pObject) { pObject->Release(); @@ -990,10 +990,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() FX_Free(buffer); return TRUE; } -static FX_DWORD _GetVarInt(FX_LPCBYTE p, FX_INT32 n) +static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n) { FX_DWORD result = 0; - for (FX_INT32 i = 0; i < n; i ++) { + for (int32_t i = 0; i < n; i ++) { result = result * 256 + p[i]; } return result; @@ -1019,7 +1019,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL return FALSE; } prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); - FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); + int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); if (size < 0) { pStream->Release(); return FALSE; @@ -1033,7 +1033,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL } else { m_Trailers.Add((CPDF_Dictionary*)pStream->GetDict()->Clone()); } - std::vector > arrIndex; + std::vector > arrIndex; CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); if (pArray) { FX_DWORD nPairSize = pArray->GetCount() / 2; @@ -1075,12 +1075,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_DWORD dwTotalSize = acc.GetSize(); FX_DWORD segindex = 0; for (FX_DWORD i = 0; i < arrIndex.size(); i ++) { - FX_INT32 startnum = arrIndex[i].first; + int32_t startnum = arrIndex[i].first; if (startnum < 0) { continue; } - m_dwXrefStartObjNum = pdfium::base::checked_cast (startnum); - FX_DWORD count = pdfium::base::checked_cast (arrIndex[i].second); + m_dwXrefStartObjNum = pdfium::base::checked_cast (startnum); + FX_DWORD count = pdfium::base::checked_cast (arrIndex[i].second); FX_SAFE_DWORD dwCaculatedSize = segindex; dwCaculatedSize += count; dwCaculatedSize *= totalWidth; @@ -1090,12 +1090,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_LPCBYTE segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; - FX_DWORD dwV5Size = pdfium::base::checked_cast (m_V5Type.GetSize()); + FX_DWORD dwV5Size = pdfium::base::checked_cast (m_V5Type.GetSize()); if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) { continue; } for (FX_DWORD j = 0; j < count; j ++) { - FX_INT32 type = 1; + int32_t type = 1; FX_LPCBYTE entrystart = segstart + j * totalWidth; if (WidthArray[0]) { type = _GetVarInt(entrystart, WidthArray[0]); @@ -1212,8 +1212,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX if (pObjStream == NULL) { return NULL; } - FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); - FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); + int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); + int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; CFX_SmartPointer file(FX_CreateMemoryStream((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); syntax.InitParser(file.Get(), 0); @@ -1235,7 +1235,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) { CPDF_StreamAcc* pStreamAcc = NULL; - if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) { + if (m_ObjectStreamMap.Lookup((void*)(uintptr_t)objnum, (void*&)pStreamAcc)) { return pStreamAcc; } const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum) : NULL; @@ -1244,7 +1244,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) } pStreamAcc = new CPDF_StreamAcc; pStreamAcc->LoadAllData(pStream); - m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc); + m_ObjectStreamMap.SetAt((void*)(uintptr_t)objnum, pStreamAcc); return pStreamAcc; } FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) @@ -1283,8 +1283,8 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR if (pObjStream == NULL) { return; } - FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); - FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); + int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); + int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; FX_LPCBYTE pData = pObjStream->GetData(); FX_DWORD totalsize = pObjStream->GetSize(); @@ -1301,7 +1301,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR FX_DWORD nextoff = syntax.GetDirectNum(); size = nextoff - thisoff; } - pBuffer = FX_Alloc(FX_BYTE, size); + pBuffer = FX_Alloc(uint8_t, size); FXSYS_memcpy32(pBuffer, pData + thisoff + offset, size); return; } @@ -1368,7 +1368,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR nextoff = m_Syntax.SavePos(); } size = (FX_DWORD)(nextoff - pos); - pBuffer = FX_Alloc(FX_BYTE, size); + pBuffer = FX_Alloc(uint8_t, size); m_Syntax.RestorePos(pos); m_Syntax.ReadBlock(pBuffer, size); m_Syntax.RestorePos(SavedPos); @@ -1553,7 +1553,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse m_bXRefStream = FALSE; m_LastXRefOffset = 0; m_bOwnFileRead = bOwnFileRead; - FX_INT32 offset = GetHeaderOffset(pFileAccess); + int32_t offset = GetHeaderOffset(pFileAccess); if (offset == -1) { return PDFPARSE_ERROR_FORMAT; } @@ -1579,7 +1579,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize > 0) { m_CrossRef.SetSize(xrefsize); m_V5Type.SetSize(xrefsize); @@ -1651,10 +1651,10 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() m_pTrailer = NULL; } m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset); - FX_BYTE ch = 0; + uint8_t ch = 0; FX_DWORD dwCount = 0; m_Syntax.GetNextChar(ch); - FX_INT32 type = PDF_CharType[ch]; + int32_t type = PDF_CharType[ch]; while (type == 'W') { ++dwCount; if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_HeaderOffset)) { @@ -1702,7 +1702,7 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser() FX_Free(m_pFileBuf); } } -FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) { FX_FILESIZE save_pos = m_Pos; m_Pos = pos; @@ -1710,7 +1710,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) m_Pos = save_pos; return ret; } -FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) { FX_FILESIZE pos = m_Pos + m_HeaderOffset; if (pos >= m_FileLen) { @@ -1739,7 +1739,7 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) m_Pos ++; return TRUE; } -FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) { pos += m_HeaderOffset; if (pos >= m_FileLen) { @@ -1782,11 +1782,11 @@ void CPDF_SyntaxParser::GetNextWord() { m_WordSize = 0; m_bIsNumber = TRUE; - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { if (!GetNextChar(ch)) { @@ -1864,13 +1864,13 @@ void CPDF_SyntaxParser::GetNextWord() } CFX_ByteString CPDF_SyntaxParser::ReadString() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return CFX_ByteString(); } CFX_ByteTextBuf buf; - FX_INT32 parlevel = 0; - FX_INT32 status = 0, iEscCode = 0; + int32_t parlevel = 0; + int32_t status = 0, iEscCode = 0; while (1) { switch (status) { case 0: @@ -1951,13 +1951,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() } CFX_ByteString CPDF_SyntaxParser::ReadHexString() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return CFX_ByteString(); } CFX_BinaryBuf buf; FX_BOOL bFirst = TRUE; - FX_BYTE code = 0; + uint8_t code = 0; while (1) { if (ch == '>') { break; @@ -1967,7 +1967,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - '0') * 16; } else { code += ch - '0'; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } else if (ch >= 'A' && ch <= 'F') { @@ -1975,7 +1975,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - 'A' + 10) * 16; } else { code += ch - 'A' + 10; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } else if (ch >= 'a' && ch <= 'f') { @@ -1983,7 +1983,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - 'a' + 10) * 16; } else { code += ch - 'a' + 10; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } @@ -1992,13 +1992,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() } } if (!bFirst) { - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } return buf.GetByteString(); } void CPDF_SyntaxParser::ToNextLine() { - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { return; @@ -2019,11 +2019,11 @@ void CPDF_SyntaxParser::ToNextLine() } void CPDF_SyntaxParser::ToNextWord() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { m_dwWordPos = m_Pos; @@ -2168,7 +2168,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO pContext->m_DictStart = SavedPos; } CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); - FX_INT32 nKeys = 0; + int32_t nKeys = 0; FX_FILESIZE dwSignValuePos = 0; while (1) { FX_BOOL bIsNumber; @@ -2377,7 +2377,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList if (pDict) { pDict->Release(); } - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { break; @@ -2461,7 +2461,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT } else { m_Pos = curPos; } - FX_BYTE byte1, byte2; + uint8_t byte1, byte2; GetCharAt(StreamStartPos + offset - 1, byte1); GetCharAt(StreamStartPos + offset - 2, byte2); if (byte1 == 0x0a && byte2 == 0x0d) { @@ -2481,7 +2481,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT m_Pos = StreamStartPos; } CPDF_Stream* pStream; - FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); + FX_LPBYTE pData = FX_Alloc(uint8_t, len); ReadBlock(pData, len); if (pCryptoHandler) { CFX_BinaryBuf dest_buf; @@ -2511,7 +2511,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff FX_Free(m_pFileBuf); m_pFileBuf = NULL; } - m_pFileBuf = FX_Alloc(FX_BYTE, m_BufSize); + m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); m_HeaderOffset = HeaderOffset; m_FileLen = pFileAccess->GetSize(); m_Pos = 0; @@ -2519,7 +2519,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff m_BufOffset = 0; pFileAccess->ReadBlock(m_pFileBuf, 0, (size_t)((FX_FILESIZE)m_BufSize > m_FileLen ? m_FileLen : m_BufSize)); } -FX_INT32 CPDF_SyntaxParser::GetDirectNum() +int32_t CPDF_SyntaxParser::GetDirectNum() { GetNextWord(); if (!m_bIsNumber) { @@ -2530,19 +2530,19 @@ FX_INT32 CPDF_SyntaxParser::GetDirectNum() } FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen) { - FX_BYTE type = PDF_CharType[tag[0]]; + uint8_t type = PDF_CharType[tag[0]]; FX_BOOL bCheckLeft = type != 'D' && type != 'W'; type = PDF_CharType[tag[taglen - 1]]; FX_BOOL bCheckRight = type != 'D' && type != 'W'; - FX_BYTE ch; - if (bCheckRight && startpos + (FX_INT32)taglen <= limit && GetCharAt(startpos + (FX_INT32)taglen, ch)) { - FX_BYTE type = PDF_CharType[ch]; + uint8_t ch; + if (bCheckRight && startpos + (int32_t)taglen <= limit && GetCharAt(startpos + (int32_t)taglen, ch)) { + uint8_t type = PDF_CharType[ch]; if (type == 'N' || type == 'R') { return FALSE; } } if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) { - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; if (type == 'N' || type == 'R') { return FALSE; } @@ -2551,17 +2551,17 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, } FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit) { - FX_INT32 taglen = tag.GetLength(); + int32_t taglen = tag.GetLength(); if (taglen == 0) { return FALSE; } FX_FILESIZE pos = m_Pos; - FX_INT32 offset = 0; + int32_t offset = 0; if (!bForward) { offset = taglen - 1; } FX_LPCBYTE tag_data = tag.GetPtr(); - FX_BYTE byte; + uint8_t byte; while (1) { if (bForward) { if (limit) { @@ -2620,9 +2620,9 @@ struct _SearchTagRecord { FX_DWORD m_Len; FX_DWORD m_Offset; }; -FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) +int32_t CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) { - FX_INT32 ntags = 1, i; + int32_t ntags = 1, i; for (i = 0; i < tags.GetLength(); i ++) if (tags[i] == 0) { ntags ++; @@ -2643,9 +2643,9 @@ FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX } } FX_FILESIZE pos = m_Pos; - FX_BYTE byte; + uint8_t byte; GetCharAt(pos++, byte); - FX_INT32 found = -1; + int32_t found = -1; while (1) { for (i = 0; i < ntags; i ++) { if (pPatterns[i].m_pTag[pPatterns[i].m_Offset] == byte) { @@ -2684,12 +2684,12 @@ end: } FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) { - FX_INT32 taglen = tag.GetLength(); - FX_INT32 match = 0; + int32_t taglen = tag.GetLength(); + int32_t match = 0; limit += m_Pos; FX_FILESIZE startpos = m_Pos; while (1) { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return -1; } @@ -2707,10 +2707,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) } return -1; } -void CPDF_SyntaxParser::GetBinary(FX_BYTE* buffer, FX_DWORD size) +void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size) { FX_DWORD offset = 0; - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { return; @@ -2734,9 +2734,9 @@ public: virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override; - virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) override; + virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override; - virtual FX_INT32 IsLinearizedPDF() override; + virtual int32_t IsLinearizedPDF() override; virtual FX_BOOL IsLinearized() override { @@ -2770,11 +2770,11 @@ protected: FX_BOOL CheckPageStatus(IFX_DownloadHints* pHints); FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints); - FX_INT32 CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); + int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen); void SetStartOffset(FX_FILESIZE dwOffset); FX_BOOL GetNextToken(CFX_ByteString &token); - FX_BOOL GetNextChar(FX_BYTE &ch); + FX_BOOL GetNextChar(uint8_t &ch); CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum); CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile); FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages); @@ -2788,10 +2788,10 @@ protected: FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints); FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pDict); - FX_BOOL CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints); + FX_BOOL CheckPage(int32_t iPage, IFX_DownloadHints* pHints); FX_BOOL LoadDocPages(IFX_DownloadHints* pHints); - FX_BOOL LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints); - FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints); + FX_BOOL LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints); + FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints); FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); FX_BOOL CheckPageCount(IFX_DownloadHints* pHints); @@ -2842,11 +2842,11 @@ protected: CFX_ByteString m_WordBuf; - FX_BYTE m_WordBuffer[257]; + uint8_t m_WordBuffer[257]; FX_DWORD m_WordSize; - FX_BYTE m_bufferData[512]; + uint8_t m_bufferData[512]; CFX_FileSizeArray m_CrossOffset; @@ -2994,8 +2994,8 @@ CPDF_DataAvail::~CPDF_DataAvail() if (m_pagesLoadState) { delete m_pagesLoadState; } - FX_INT32 i = 0; - FX_INT32 iSize = m_arrayAcroforms.GetSize(); + int32_t i = 0; + int32_t iSize = m_arrayAcroforms.GetSize(); for (i = 0; i < iSize; ++i) { ((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); } @@ -3039,13 +3039,13 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa } FX_DWORD count = 0; CFX_PtrArray new_obj_array; - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < obj_array.GetSize(); i++) { CPDF_Object *pObj = (CPDF_Object *)obj_array[i]; if (!pObj) { continue; } - FX_INT32 type = pObj->GetType(); + int32_t type = pObj->GetType(); switch (type) { case PDFOBJ_ARRAY: { CPDF_Array *pArray = pObj->GetArray(); @@ -3111,10 +3111,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa } } if (count > 0) { - FX_INT32 iSize = new_obj_array.GetSize(); + int32_t iSize = new_obj_array.GetSize(); for (i = 0; i < iSize; ++i) { CPDF_Object *pObj = (CPDF_Object *)new_obj_array[i]; - FX_INT32 type = pObj->GetType(); + int32_t type = pObj->GetType(); if (type == PDFOBJ_REFERENCE) { CPDF_Reference *pRef = (CPDF_Reference *)pObj; FX_DWORD dwNum = pRef->GetRefObjNum(); @@ -3162,8 +3162,8 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) CFX_PtrArray new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); if (bRet) { - FX_INT32 iSize = m_arrayAcroforms.GetSize(); - for (FX_INT32 i = 0; i < iSize; ++i) { + int32_t iSize = m_arrayAcroforms.GetSize(); + for (int32_t i = 0; i < iSize; ++i) { ((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); } m_arrayAcroforms.RemoveAll(); @@ -3475,9 +3475,9 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) if (pObj->GetType() == PDFOBJ_ARRAY) { CPDF_Array *pArray = pObj->GetArray(); if (pArray) { - FX_INT32 iSize = pArray->GetCount(); + int32_t iSize = pArray->GetCount(); CPDF_Object *pItem = NULL; - for (FX_INT32 j = 0; j < iSize; ++j) { + for (int32_t j = 0; j < iSize; ++j) { pItem = pArray->GetElement(j); if (pItem && pItem->GetType() == PDFOBJ_REFERENCE) { UnavailObjList.Add(((CPDF_Reference *)pItem)->GetRefObjNum()); @@ -3589,7 +3589,7 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints) req_size = (FX_DWORD)m_dwFileLen; } if (m_pFileAvail->IsDataAvail(0, req_size)) { - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, 0, req_size); if (IsLinearizedFile(buffer, req_size)) { m_docStatus = PDF_DATAAVAIL_FIRSTPAGE; @@ -3629,8 +3629,8 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints) if ((FX_FILESIZE)dwEnd > m_dwFileLen) { dwEnd = (FX_DWORD)m_dwFileLen; } - FX_INT32 iStartPos = (FX_INT32)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); - FX_INT32 iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; + int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); + int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) { pHints->AddSegment(iStartPos, iSize); bNeedDownLoad = TRUE; @@ -3690,7 +3690,7 @@ CPDF_Object * CPDF_DataAvail::ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD ob m_syntaxParser.RestorePos(SavedPos); return pObj; } -FX_INT32 CPDF_DataAvail::IsLinearizedPDF() +int32_t CPDF_DataAvail::IsLinearizedPDF() { FX_DWORD req_size = 1024; if (!m_pFileAvail->IsDataAvail(0, req_size)) { @@ -3703,7 +3703,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() if (dwSize < (FX_FILESIZE)req_size) { return PDF_UNKNOW_LINEARIZED; } - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, 0, req_size); if (IsLinearizedFile(buffer, req_size)) { return PDF_IS_LINEARIZED; @@ -3713,7 +3713,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen) { CFX_SmartPointer file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); - FX_INT32 offset = GetHeaderOffset(file.Get()); + int32_t offset = GetHeaderOffset(file.Get()); if (offset == -1) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; @@ -3757,7 +3757,7 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0); FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos); if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) { - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, req_pos, dwSize); CFX_SmartPointer file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE)); m_syntaxParser.InitParser(file.Get(), 0); @@ -3787,12 +3787,12 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) pHints->AddSegment(req_pos, dwSize); return FALSE; } -FX_INT32 CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) +int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) { xref_offset = 0; FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { - FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam); + int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); CFX_BinaryBuf buf(iSize); FX_LPBYTE pBuf = buf.GetBuffer(); m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); @@ -3836,11 +3836,11 @@ inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) { m_WordSize = 0; - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return FALSE; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { if (!GetNextChar(ch)) { @@ -3919,7 +3919,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) token = ret; return TRUE; } -FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) +FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch) { FX_FILESIZE pos = m_Pos; if (pos >= m_dwFileLen) { @@ -3946,11 +3946,11 @@ FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) } FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) { - FX_INT32 iSize = 0; + int32_t iSize = 0; CFX_ByteString token; while (1) { if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); return FALSE; } @@ -3964,7 +3964,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) { FX_FILESIZE xref_offset = 0; - FX_INT32 nRet = CheckCrossRefStream(pHints, xref_offset); + int32_t nRet = CheckCrossRefStream(pHints, xref_offset); if (nRet == 1) { if (!xref_offset) { m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF; @@ -3980,10 +3980,10 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) } FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) { - FX_INT32 iSize = 0; + int32_t iSize = 0; CFX_ByteString token; if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); return FALSE; } @@ -3991,7 +3991,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) m_CrossOffset.InsertAt(0, m_dwXRefOffset); while (1) { if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM; return FALSE; @@ -4012,7 +4012,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) { if (m_Pos < m_dwFileLen) { FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos(); - FX_INT32 iSize = (FX_INT32)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); + int32_t iSize = (int32_t)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); if (!m_pFileAvail->IsDataAvail(dwAppendPos, iSize)) { pHints->AddSegment(dwAppendPos, iSize); return FALSE; @@ -4028,9 +4028,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) } FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) { - FX_INT32 iTrailerSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + int32_t iTrailerSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) { - FX_INT32 iSize = (FX_INT32)(m_Pos + iTrailerSize - m_dwTrailerOffset); + int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset); CFX_BinaryBuf buf(iSize); FX_LPBYTE pBuf = buf.GetBuffer(); if (!pBuf) { @@ -4086,7 +4086,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) pHints->AddSegment(m_Pos, iTrailerSize); return FALSE; } -FX_BOOL CPDF_DataAvail::CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints) { while (TRUE) { switch (m_docStatus) { @@ -4215,14 +4215,14 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP pPage->Release(); return TRUE; } -FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints) { - FX_INT32 iSize = pageNodes.m_childNode.GetSize(); + int32_t iSize = pageNodes.m_childNode.GetSize(); if (iSize <= 0 || iPage >= iSize) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - for (FX_INT32 i = 0; i < iSize; ++i) { + for (int32_t i = 0; i < iSize; ++i) { CPDF_PageNode *pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i); if (!pNode) { continue; @@ -4259,7 +4259,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, } return TRUE; } -FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints) { if (m_pDocument->GetPageCount() <= iPage || m_pDocument->m_PageList.GetAt(iPage)) { m_docStatus = PDF_DATAAVAIL_DONE; @@ -4273,7 +4273,7 @@ FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) m_docStatus = PDF_DATAAVAIL_ERROR; return TRUE; } - FX_INT32 iCount = -1; + int32_t iCount = -1; return CheckPageNode(m_pageNodes, iPage, iCount, pHints); } FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints) @@ -4361,7 +4361,7 @@ FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints) return m_bLinearedDataOK; } -FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_objs_array.GetSize()) { m_objs_array.RemoveAll(); @@ -4391,7 +4391,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint return bRet; } } -FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_bAnnotsLoad) { if (!CheckPageAnnots(iPage, pHints)) { @@ -4427,7 +4427,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict) } return HaveResourceAncestor(pParentDict); } -FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_pDocument) { return FALSE; @@ -4576,7 +4576,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSiz *pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset); } } -FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) +int32_t CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) { if (!m_pDocument) { return PDFFORM_AVAIL; @@ -4609,7 +4609,7 @@ FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) } void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) { - FX_INT32 iNext = 0; + int32_t iNext = 0; if (BinarySearch(dwObjNum, iNext)) { return; } @@ -4617,15 +4617,15 @@ void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) } FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum) { - FX_INT32 iNext = 0; + int32_t iNext = 0; return BinarySearch(dwObjNum, iNext); } -FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) +FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext) { - FX_INT32 iLen = m_number_array.GetSize(); - FX_INT32 iLow = 0; - FX_INT32 iHigh = iLen - 1; - FX_INT32 iMid = 0; + int32_t iLen = m_number_array.GetSize(); + int32_t iLow = 0; + int32_t iHigh = iLen - 1; + int32_t iMid = 0; while (iLow <= iHigh) { iMid = (iLow + iHigh) / 2; if (m_number_array.GetAt(iMid) == value) { @@ -4642,8 +4642,8 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) } CPDF_PageNode::~CPDF_PageNode() { - FX_INT32 iSize = m_childNode.GetSize(); - for (FX_INT32 i = 0; i < iSize; ++i) { + int32_t iSize = m_childNode.GetSize(); + for (int32_t i = 0; i < iSize; ++i) { CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; if (pNode) { delete pNode; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index df154eae90..b02139db0f 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -60,7 +60,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ pStart = NULL; dwSize = 0; type = PDFWORD_EOF; - FX_BYTE ch; + uint8_t ch; char chartype; while (1) { if (m_dwSize <= m_dwCurPos) { @@ -322,7 +322,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) int dest_len = 0; int i; for (i = 0; i < src_len; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' || PDF_CharType[ch] == 'D') { dest_len += 3; @@ -337,7 +337,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) FX_LPSTR dest_buf = res.GetBuffer(dest_len); dest_len = 0; for (i = 0; i < src_len; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' || PDF_CharType[ch] == 'D') { dest_buf[dest_len++] = '#'; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index a9212522b8..a98c57d86c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -361,10 +361,10 @@ FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, con FX_FLOAT a = FXSYS_fabs(dCTM.a); FX_FLOAT d = FXSYS_fabs(dCTM.d); if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (FX_INT32)FXSYS_ceil((FX_FLOAT)rect.Width() * a); - rect.bottom = rect.top + (FX_INT32)FXSYS_ceil((FX_FLOAT)rect.Height() * d); - rtClip.right = rtClip.left + (FX_INT32)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); - rtClip.bottom = rtClip.top + (FX_INT32)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); + rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a); + rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d); + rtClip.right = rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); + rtClip.bottom = rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); } } rect.Intersect(rtClip); @@ -568,7 +568,7 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; int alpha; if (pGeneralData) { - alpha = (FX_INT32)(pGeneralData->m_FillAlpha * 255); + alpha = (int32_t)(pGeneralData->m_FillAlpha * 255); if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -597,7 +597,7 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; int alpha; if (pGeneralData) { - alpha = (FX_INT32)(pGeneralData->m_StrokeAlpha * 255); + alpha = (int32_t)(pGeneralData->m_StrokeAlpha * 255); if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -857,7 +857,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, pTextMask = NULL; } if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { - bitmap->MultiplyAlpha((FX_INT32)(group_alpha * 255)); + bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); } Transparency = m_Transparency; if (pPageObj->m_Type == PDFPAGE_FORM) { @@ -1371,13 +1371,13 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re } m_pBitmapDevice = new CFX_FxgeDevice; FXDIB_Format dibFormat = FXDIB_Rgb; - FX_INT32 bpp = 24; + int32_t bpp = 24; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { dibFormat = FXDIB_Argb; bpp = 32; } CFX_FloatRect rect; - FX_INT32 iWidth, iHeight, iPitch; + int32_t iWidth, iHeight, iPitch; while (1) { rect = *pRect; m_Matrix.TransformRect(rect); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index 83d5f0a4c1..d22bd4b760 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -37,13 +37,13 @@ void CPDF_PageRenderCache::ClearAll() m_nCacheSize = 0; m_nTimeCount = 0; } -void CPDF_PageRenderCache::CacheOptimization(FX_INT32 dwLimitCacheSize) +void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) { return; } int nCount = m_ImageCaches.GetCount(); - CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(FX_BYTE, sizeof(CACHEINFO), nCount); + CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(uint8_t, sizeof(CACHEINFO), nCount); FX_POSITION pos = m_ImageCaches.GetStartPosition(); int i = 0; while (pos) { @@ -106,7 +106,7 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const } void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); @@ -122,7 +122,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& m_nCacheSize += pImageCache->EstimateSize(); } } -FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) +FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { m_bCurFindCache = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)m_pCurImageCache); if (!m_bCurFindCache) { @@ -226,7 +226,7 @@ static FX_DWORD FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) } FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { if (m_pCachedBitmap) { pBitmap = m_pCachedBitmap; @@ -278,7 +278,7 @@ CFX_DIBSource* CPDF_ImageCache::DetachMask() } int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { if (m_pCachedBitmap) { m_pCurBitmap = m_pCachedBitmap; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 214e4314da..699f84830f 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -40,7 +40,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int } else { FX_DWORD fill_argb = m_Options.TranslateColor(mask_argb); if (bitmap_alpha < 255) { - ((FX_BYTE*)&fill_argb)[3] = ((FX_BYTE*)&fill_argb)[3] * bitmap_alpha / 255; + ((uint8_t*)&fill_argb)[3] = ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; } if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { return; @@ -1010,7 +1010,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (pCS) { FX_FLOAT R, G, B; FX_DWORD comps = 8; - if (pCS->CountComponents() > static_cast(comps)) { + if (pCS->CountComponents() > static_cast(comps)) { comps = (FX_DWORD)pCS->CountComponents(); } CFX_FixedBufGrow float_array(comps); @@ -1026,7 +1026,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, pFloats[i] = pBC->GetNumber(i); } pCS->GetRGB(pFloats, R, G, B); - back_color = 0xff000000 | ((FX_INT32)(R * 255) << 16) | ((FX_INT32)(G * 255) << 8) | (FX_INT32)(B * 255); + back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | ((int32_t)(G * 255) << 8) | (int32_t)(B * 255); m_pContext->m_pDocument->GetPageData()->ReleaseColorSpace(pCSObj); } } @@ -1053,7 +1053,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, int dest_pitch = pMask->GetPitch(); FX_LPBYTE src_buf = bitmap.GetBuffer(); int src_pitch = bitmap.GetPitch(); - FX_LPBYTE pTransfer = FX_Alloc(FX_BYTE, 256); + FX_LPBYTE pTransfer = FX_Alloc(uint8_t, 256); if (pFunc) { CFX_FixedBufGrow results(pFunc->CountOutputs()); for (int i = 0; i < 256; i ++) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index b1fd51ebe9..d45cc1151f 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -270,7 +270,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!pitch.IsValid()) { return FALSE; } - m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && bStdCS) { m_pColorSpace->EnableStdConversion(TRUE); } @@ -282,7 +282,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!pitch.IsValid()) { return FALSE; } - m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } m_Pitch = pitch.ValueOrDie(); if (ppMask) { @@ -314,7 +314,7 @@ int CPDF_DIBSource::ContinueToLoadMask() if (!pitch.IsValid()) { return 0; } - m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && m_bStdCS) { m_pColorSpace->EnableStdConversion(TRUE); } @@ -326,7 +326,7 @@ int CPDF_DIBSource::ContinueToLoadMask() if (!pitch.IsValid()) { return 0; } - m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } m_Pitch = pitch.ValueOrDie(); return 1; @@ -730,7 +730,7 @@ void CPDF_DIBSource::LoadJpxBitmap() return; } m_pCachedBitmap->Clear(0xFFFFFFFF); - context->set_output_offsets(FX_Alloc(unsigned char, output_nComps)); + context->set_output_offsets(FX_Alloc(uint8_t, output_nComps)); for (int i = 0; i < output_nComps; ++i) context->output_offsets()[i] = i; if (bSwapRGB) { @@ -1037,9 +1037,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ R = NORMALCOLOR_MAX(R, 1); G = NORMALCOLOR_MAX(G, 1); B = NORMALCOLOR_MAX(B, 1); - dest_scan[dest_byte_pos] = (FX_INT32)(B * 255); - dest_scan[dest_byte_pos + 1] = (FX_INT32)(G * 255); - dest_scan[dest_byte_pos + 2] = (FX_INT32)(R * 255); + dest_scan[dest_byte_pos] = (int32_t)(B * 255); + dest_scan[dest_byte_pos + 1] = (int32_t)(G * 255); + dest_scan[dest_byte_pos + 2] = (int32_t)(R * 255); dest_byte_pos += 3; } } else { @@ -1063,9 +1063,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ R = NORMALCOLOR_MAX(R, 1); G = NORMALCOLOR_MAX(G, 1); B = NORMALCOLOR_MAX(B, 1); - dest_scan[dest_byte_pos] = (FX_INT32)(B * 255); - dest_scan[dest_byte_pos + 1] = (FX_INT32)(G * 255); - dest_scan[dest_byte_pos + 2] = (FX_INT32)(R * 255); + dest_scan[dest_byte_pos] = (int32_t)(B * 255); + dest_scan[dest_byte_pos + 1] = (int32_t)(G * 255); + dest_scan[dest_byte_pos + 2] = (int32_t)(R * 255); dest_byte_pos += 3; } } @@ -1155,7 +1155,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const FX_LPBYTE pDestPixel = m_pMaskedLine; FX_LPCBYTE pSrcPixel = m_pLineBuf; for (int col = 0; col < m_Width; col ++) { - FX_BYTE index = *pSrcPixel++; + uint8_t index = *pSrcPixel++; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); *pDestPixel++ = FXARGB_G(m_pPalette[index]); @@ -1254,7 +1254,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ return; } - CFX_FixedBufGrow temp(orig_Bpp); + CFX_FixedBufGrow temp(orig_Bpp); if (m_bpc * m_nComponents == 1) { FX_DWORD set_argb = (FX_DWORD) - 1, reset_argb = 0; if (m_bImageMask) { @@ -1302,7 +1302,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ int dest_pos = i * dest_Bpp; if (pSrcLine[src_x / 8] & (1 << (7 - src_x % 8))) { if (dest_Bpp == 1) { - dest_scan[dest_pos] = (FX_BYTE)set_argb; + dest_scan[dest_pos] = (uint8_t)set_argb; } else if (dest_Bpp == 3) { dest_scan[dest_pos] = FXARGB_B(set_argb); dest_scan[dest_pos + 1] = FXARGB_G(set_argb); @@ -1312,7 +1312,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ } } else { if (dest_Bpp == 1) { - dest_scan[dest_pos] = (FX_BYTE)reset_argb; + dest_scan[dest_pos] = (uint8_t)reset_argb; } else if (dest_Bpp == 3) { dest_scan[dest_pos] = FXARGB_B(reset_argb); dest_scan[dest_pos + 1] = FXARGB_G(reset_argb); @@ -1345,7 +1345,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ } src_x %= src_width; FX_LPBYTE pDestPixel = dest_scan + i * 4; - FX_BYTE index = pSrcLine[src_x]; + uint8_t index = pSrcLine[src_x]; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); *pDestPixel++ = FXARGB_G(m_pPalette[index]); @@ -1365,7 +1365,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_x = src_width - src_x - 1; } src_x %= src_width; - FX_BYTE index = pSrcLine[src_x]; + uint8_t index = pSrcLine[src_x]; if (dest_Bpp == 1) { dest_scan[i] = index; } else { @@ -1384,7 +1384,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); for (int i = 0; i < clip_width; i ++) { int dest_x = clip_left + i; - FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (FX_INT64)src_width / dest_width; + FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (int64_t)src_width / dest_width; src_x %= src_width; FX_LPCBYTE pSrcPixel = NULL; if (m_bpc % 8 == 0) { @@ -1398,7 +1398,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ argb = last_argb; } else { if (m_pColorSpace) { - FX_BYTE color[4]; + uint8_t color[4]; if (!m_bDefaultDecode) { for (int i = 0; i < m_nComponents; i ++) { int color_value = (int)((m_pCompData[i].m_DecodeMin + m_pCompData[i].m_DecodeStep * (FX_FLOAT)pSrcPixel[i]) * 255.0f + 0.5f); @@ -1412,7 +1412,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_bit_pos = 4; } for (FX_DWORD i = 0; i < m_nComponents; i ++) { - temp[i] = (FX_BYTE)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); + temp[i] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); src_bit_pos += m_bpc; } m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK); @@ -1473,7 +1473,7 @@ CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle() CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle() { } -FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 nDownsampleWidth, FX_INT32 nDownsampleHeight) +FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_pImageLoader = pImageLoader; m_pCache = pCache; @@ -1536,7 +1536,7 @@ FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCa } return FALSE; } -FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 nDownsampleWidth, FX_INT32 nDownsampleHeight) +FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index f9eec23f7a..e02cd421ff 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -77,7 +77,7 @@ static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2B FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; matrix.Transform(x, y); FX_FLOAT scale = FXSYS_Div(FXSYS_Mul(x - start_x, x_span) + FXSYS_Mul(y - start_y, y_span), axis_len_square); - int index = (FX_INT32)(scale * (SHADING_STEPS - 1)); + int index = (int32_t)(scale * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) { continue; @@ -205,7 +205,7 @@ static void _DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2 continue; } } - int index = (FX_INT32)(s * (SHADING_STEPS - 1)); + int index = (int32_t)(s * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) { continue; @@ -277,7 +277,7 @@ static void _DrawFuncShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bi } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pCS->GetRGB(pResults, R, G, B); - dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(alpha, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255))); + dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); } } } @@ -368,7 +368,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian R += r_unit; G += g_unit; B += b_unit; - FXARGB_SETDIB(dib_buf, FXARGB_MAKE(alpha, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255))); + FXARGB_SETDIB(dib_buf, FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); dib_buf += 4; } } @@ -746,9 +746,9 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff for (i = iStartColor; i < 4; i ++) { FX_FLOAT r=0.0f, g=0.0f, b=0.0f; stream.GetColor(r, g, b); - patch.patch_colors[i].comp[0] = (FX_INT32)(r * 255); - patch.patch_colors[i].comp[1] = (FX_INT32)(g * 255); - patch.patch_colors[i].comp[2] = (FX_INT32)(b * 255); + patch.patch_colors[i].comp[0] = (int32_t)(r * 255); + patch.patch_colors[i].comp[1] = (int32_t)(g * 255); + patch.patch_colors[i].comp[2] = (int32_t)(b * 255); } CFX_FloatRect bbox = CFX_FloatRect::GetBBox(coords, point_count); if (bbox.right <= 0 || bbox.left >= (FX_FLOAT)pBitmap->GetWidth() || bbox.top <= 0 || @@ -787,7 +787,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMat } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); - background = ArgbEncode(255, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255)); + background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255)); } } if (pDict->KeyExist(FX_BSTRC("BBox"))) { @@ -939,8 +939,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag CFX_Matrix dCTM = m_pDevice->GetCTM(); FX_FLOAT sa = FXSYS_fabs(dCTM.a); FX_FLOAT sd = FXSYS_fabs(dCTM.d); - clip_box.right = clip_box.left + (FX_INT32)FXSYS_ceil(clip_box.Width() * sa); - clip_box.bottom = clip_box.top + (FX_INT32)FXSYS_ceil(clip_box.Height() * sd); + clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); + clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); CFX_AffineMatrix mtPattern2Device = pPattern->m_Pattern2Form; mtPattern2Device.Concat(*pObj2Device); GetScaledMatrix(mtPattern2Device); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 09843c9c62..410e78a67b 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -33,11 +33,11 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, const CFX_AffineM m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap; - if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)charcode, (void*&)pGlyphBitmap)) { + if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)charcode, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pGlyphBitmap); return pGlyphBitmap; } CPDF_Type3Glyphs::~CPDF_Type3Glyphs() @@ -512,7 +512,7 @@ public: FXTEXT_CHARPOS* m_pCharPos; FX_DWORD m_nChars; }; -FX_FLOAT _CIDTransformToFloat(FX_BYTE ch); +FX_FLOAT _CIDTransformToFloat(uint8_t ch); CPDF_CharPosList::CPDF_CharPosList() { m_pCharPos = NULL; @@ -531,7 +531,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); for (int iChar = 0; iChar < nChars; iChar ++) { - FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pCharCodes : pCharCodes[iChar]; + FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar]; if (CharCode == (FX_DWORD) - 1) { continue; } @@ -614,7 +614,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, FX_FLOAT origi FX_FLOAT* pCharPos; if (nChars == 1) { charcode = pFont->GetNextChar(str, str.GetLength(), offset); - pCharCodes = (FX_DWORD*)(FX_UINTPTR)charcode; + pCharCodes = (FX_DWORD*)(uintptr_t)charcode; pCharPos = NULL; } else { pCharCodes = FX_Alloc(FX_DWORD, nChars); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 529128e8f9..0b6873409b 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -46,7 +46,7 @@ class CPDF_TransferFunc { public: CPDF_Document* m_pPDFDoc; - FX_BYTE m_Samples[256 * 3]; + uint8_t m_Samples[256 * 3]; FX_BOOL m_bIdentity; CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc); @@ -197,7 +197,7 @@ public: FX_BOOL Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL); - FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); + FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause); ~CPDF_ImageLoader(); CFX_DIBSource* m_pBitmap; @@ -205,8 +205,8 @@ public: FX_DWORD m_MatteColor; FX_BOOL m_bCached; protected: - FX_INT32 m_nDownsampleWidth; - FX_INT32 m_nDownsampleHeight; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; }; class CPDF_ProgressiveImageLoaderHandle { @@ -214,14 +214,14 @@ public: CPDF_ProgressiveImageLoaderHandle(); ~CPDF_ProgressiveImageLoaderHandle(); - FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); + FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(IFX_Pause* pPause); protected: CPDF_ImageLoader* m_pImageLoader; CPDF_PageRenderCache* m_pCache; CPDF_ImageObject* m_pImage; - FX_INT32 m_nDownsampleWidth; - FX_INT32 m_nDownsampleHeight; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; }; class CFX_ImageTransformer; class CPDF_ImageRenderer : public IPDF_ObjectRenderer @@ -336,7 +336,7 @@ public: void Reset(const CFX_DIBitmap* pBitmap); FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); FX_DWORD EstimateSize() const { return m_dwCacheSize; @@ -357,7 +357,7 @@ public: public: int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); int Continue(IFX_Pause* pPause); int ContinueGetCachedBitmap(); CFX_DIBSource* DetachBitmap(); -- cgit v1.2.3