summaryrefslogtreecommitdiff
path: root/core/src/fpdftext
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdftext')
-rw-r--r--core/src/fpdftext/fpdf_text.cpp10
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp74
-rw-r--r--core/src/fpdftext/fpdf_text_search.cpp4
-rw-r--r--core/src/fpdftext/text_int.h10
4 files changed, 49 insertions, 49 deletions
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index c391524b9e..5efbe51c03 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -75,7 +75,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject)
CFX_AffineMatrix matrix;
pText->GetTextMatrix(&matrix);
for (int i = 0; i < pText->m_nChars; i ++) {
- FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pText->m_pCharCodes : pText->m_pCharCodes[i];
+ FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(uintptr_t)pText->m_pCharCodes : pText->m_pCharCodes[i];
if (charcode == (FX_DWORD) - 1) {
continue;
}
@@ -113,7 +113,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject)
int space_count = 0;
FX_FLOAT last_left = 0, last_right = 0, segment_left = 0, segment_right = 0;
for (int i = 0; i < pText->m_nChars; i ++) {
- FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pText->m_pCharCodes : pText->m_pCharCodes[i];
+ FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(uintptr_t)pText->m_pCharCodes : pText->m_pCharCodes[i];
if (charcode == (FX_DWORD) - 1) {
continue;
}
@@ -314,11 +314,11 @@ void NormalizeString(CFX_WideString& str)
}
CFX_WordArray order;
FX_BOOL bR2L = FALSE;
- FX_INT32 start = 0, count = 0, i = 0;
+ int32_t start = 0, count = 0, i = 0;
int nR2L = 0, nL2R = 0;
for (i = 0; i < str.GetLength(); i++) {
if(BidiChar->AppendChar(str.GetAt(i))) {
- FX_INT32 ret = BidiChar->GetBidiInfo(start, count);
+ int32_t ret = BidiChar->GetBidiInfo(start, count);
order.Add(start);
order.Add(count);
order.Add(ret);
@@ -332,7 +332,7 @@ void NormalizeString(CFX_WideString& str)
}
}
if(BidiChar->EndChar()) {
- FX_INT32 ret = BidiChar->GetBidiInfo(start, count);
+ int32_t ret = BidiChar->GetBidiInfo(start, count);
order.Add(start);
order.Add(count);
order.Add(ret);
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index b0c4ae2753..10bd3c8b36 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -652,7 +652,7 @@ void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO & info) const
info.m_Matrix.Copy(charinfo.m_Matrix);
return;
}
-void CPDF_TextPage::CheckMarkedContentObject(FX_INT32& start, FX_INT32& nCount) const
+void CPDF_TextPage::CheckMarkedContentObject(int32_t& start, int32_t& nCount) const
{
PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(start);
PAGECHAR_INFO charinfo2 = *(PAGECHAR_INFO*)m_charList.GetAt(start + nCount - 1);
@@ -963,24 +963,24 @@ int CPDF_TextPage::GetWordBreak(int index, int direction) const
}
return breakPos;
}
-FX_INT32 CPDF_TextPage::FindTextlineFlowDirection()
+int32_t CPDF_TextPage::FindTextlineFlowDirection()
{
if (!m_pPage) {
return -1;
}
- const FX_INT32 nPageWidth = (FX_INT32)((CPDF_Page*)m_pPage)->GetPageWidth();
- const FX_INT32 nPageHeight = (FX_INT32)((CPDF_Page*)m_pPage)->GetPageHeight();
+ const int32_t nPageWidth = (int32_t)((CPDF_Page*)m_pPage)->GetPageWidth();
+ const int32_t nPageHeight = (int32_t)((CPDF_Page*)m_pPage)->GetPageHeight();
CFX_ByteArray nHorizontalMask;
if (!nHorizontalMask.SetSize(nPageWidth)) {
return -1;
}
- FX_BYTE* pDataH = nHorizontalMask.GetData();
+ uint8_t* pDataH = nHorizontalMask.GetData();
CFX_ByteArray nVerticalMask;
if (!nVerticalMask.SetSize(nPageHeight)) {
return -1;
}
- FX_BYTE* pDataV = nVerticalMask.GetData();
- FX_INT32 index = 0;
+ uint8_t* pDataV = nVerticalMask.GetData();
+ int32_t index = 0;
FX_FLOAT fLineHeight = 0.0f;
CPDF_PageObject* pPageObj = NULL;
FX_POSITION pos = NULL;
@@ -996,10 +996,10 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection()
if(PDFPAGE_TEXT != pPageObj->m_Type) {
continue;
}
- FX_INT32 minH = (FX_INT32)pPageObj->m_Left < 0 ? 0 : (FX_INT32)pPageObj->m_Left;
- FX_INT32 maxH = (FX_INT32)pPageObj->m_Right > nPageWidth ? nPageWidth : (FX_INT32)pPageObj->m_Right;
- FX_INT32 minV = (FX_INT32)pPageObj->m_Bottom < 0 ? 0 : (FX_INT32)pPageObj->m_Bottom;
- FX_INT32 maxV = (FX_INT32)pPageObj->m_Top > nPageHeight ? nPageHeight : (FX_INT32)pPageObj->m_Top;
+ int32_t minH = (int32_t)pPageObj->m_Left < 0 ? 0 : (int32_t)pPageObj->m_Left;
+ int32_t maxH = (int32_t)pPageObj->m_Right > nPageWidth ? nPageWidth : (int32_t)pPageObj->m_Right;
+ int32_t minV = (int32_t)pPageObj->m_Bottom < 0 ? 0 : (int32_t)pPageObj->m_Bottom;
+ int32_t maxV = (int32_t)pPageObj->m_Top > nPageHeight ? nPageHeight : (int32_t)pPageObj->m_Top;
if (minH >= maxH || minV >= maxV) {
continue;
}
@@ -1010,8 +1010,8 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection()
}
pPageObj = NULL;
}
- FX_INT32 nStartH = 0;
- FX_INT32 nEndH = 0;
+ int32_t nStartH = 0;
+ int32_t nEndH = 0;
FX_FLOAT nSumH = 0.0f;
for (index = 0; index < nPageWidth; index++)
if(1 == nHorizontalMask[index]) {
@@ -1027,8 +1027,8 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection()
nSumH += nHorizontalMask[index];
}
nSumH /= nEndH - nStartH;
- FX_INT32 nStartV = 0;
- FX_INT32 nEndV = 0;
+ int32_t nStartV = 0;
+ int32_t nEndV = 0;
FX_FLOAT nSumV = 0.0f;
for (index = 0; index < nPageHeight; index++)
if(1 == nVerticalMask[index]) {
@@ -1044,10 +1044,10 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection()
nSumV += nVerticalMask[index];
}
nSumV /= nEndV - nStartV;
- if ((nEndV - nStartV) < (FX_INT32)(2 * fLineHeight)) {
+ if ((nEndV - nStartV) < (int32_t)(2 * fLineHeight)) {
return 0;
}
- if ((nEndH - nStartH) < (FX_INT32)(2 * fLineHeight)) {
+ if ((nEndH - nStartH) < (int32_t)(2 * fLineHeight)) {
return 1;
}
if (nSumH > 0.8f) {
@@ -1141,8 +1141,8 @@ int CPDF_TextPage::GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const
}
void CPDF_TextPage::OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str)
{
- FX_INT32 start, count;
- FX_INT32 ret = pBidi->GetBidiInfo(start, count);
+ int32_t start, count;
+ int32_t ret = pBidi->GetBidiInfo(start, count);
if(ret == 2) {
for(int i = start + count - 1; i >= start; i--) {
m_TextBuf.AppendChar(str.GetAt(i));
@@ -1232,7 +1232,7 @@ void CPDF_TextPage::CloseTempLine()
CFX_WideString str = m_TempTextBuf.GetWideString();
CFX_WordArray order;
FX_BOOL bR2L = FALSE;
- FX_INT32 start = 0, count = 0;
+ int32_t start = 0, count = 0;
int nR2L = 0, nL2R = 0;
FX_BOOL bPrevSpace = FALSE;
for (int i = 0; i < str.GetLength(); i++) {
@@ -1250,7 +1250,7 @@ void CPDF_TextPage::CloseTempLine()
bPrevSpace = FALSE;
}
if(BidiChar && BidiChar->AppendChar(str.GetAt(i))) {
- FX_INT32 ret = BidiChar->GetBidiInfo(start, count);
+ int32_t ret = BidiChar->GetBidiInfo(start, count);
order.Add(start);
order.Add(count);
order.Add(ret);
@@ -1264,7 +1264,7 @@ void CPDF_TextPage::CloseTempLine()
}
}
if(BidiChar && BidiChar->EndChar()) {
- FX_INT32 ret = BidiChar->GetBidiInfo(start, count);
+ int32_t ret = BidiChar->GetBidiInfo(start, count);
order.Add(start);
order.Add(count);
order.Add(ret);
@@ -1438,7 +1438,7 @@ void CPDF_TextPage::ProcessTextObject(CPDF_TextObject* pTextObj, const CFX_Affin
m_LineObj.Add(Obj);
}
}
-FX_INT32 CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj)
+int32_t CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj)
{
CPDF_TextObject* pTextObj = Obj.m_pTextObj;
CPDF_ContentMarkData* pMarkData = (CPDF_ContentMarkData*)pTextObj->m_ContentMark.GetObject();
@@ -1598,7 +1598,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
CFX_AffineMatrix matrix;
pTextObj->GetTextMatrix(&matrix);
matrix.Concat(formMatrix);
- FX_INT32 bPreMKC = PreMarkedContent(Obj);
+ int32_t bPreMKC = PreMarkedContent(Obj);
if (FPDFTEXT_MC_DONE == bPreMKC) {
m_pPreTextObj = pTextObj;
m_perMatrix.Copy(formMatrix);
@@ -1645,7 +1645,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
}
}
} else if (result == 3 && !m_ParseOptions.m_bOutputHyphen) {
- FX_INT32 nChars = pTextObj->CountChars();
+ int32_t nChars = pTextObj->CountChars();
if (nChars == 1) {
CPDF_TextObjectItem item;
pTextObj->GetCharInfo(0, &item);
@@ -1684,11 +1684,11 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
FX_BOOL bIsBidiAndMirrosInverse = FALSE;
IFX_BidiChar* BidiChar = IFX_BidiChar::Create();
- FX_INT32 nR2L = 0;
- FX_INT32 nL2R = 0;
- FX_INT32 start = 0, count = 0;
+ int32_t nR2L = 0;
+ int32_t nL2R = 0;
+ int32_t start = 0, count = 0;
CPDF_TextObjectItem item;
- for (FX_INT32 i = 0; i < nItems; i++) {
+ for (int32_t i = 0; i < nItems; i++) {
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == (FX_DWORD)-1) {
continue;
@@ -1702,7 +1702,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
continue;
}
if (BidiChar && BidiChar->AppendChar(wChar)) {
- FX_INT32 ret = BidiChar->GetBidiInfo(start, count);
+ int32_t ret = BidiChar->GetBidiInfo(start, count);
if (ret == 2) {
nR2L++;
}
@@ -1712,7 +1712,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
}
}
if (BidiChar && BidiChar->EndChar()) {
- FX_INT32 ret = BidiChar->GetBidiInfo(start, count);
+ int32_t ret = BidiChar->GetBidiInfo(start, count);
if (ret == 2) {
nR2L++;
}
@@ -1725,8 +1725,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
bR2L = TRUE;
}
bIsBidiAndMirrosInverse = bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0;
- FX_INT32 iBufStartAppend = m_TempTextBuf.GetLength();
- FX_INT32 iCharListStartAppend = m_TempCharList.GetSize();
+ int32_t iBufStartAppend = m_TempTextBuf.GetLength();
+ int32_t iCharListStartAppend = m_TempCharList.GetSize();
FX_FLOAT spacing = 0;
for (int i = 0; i < nItems; i++) {
@@ -1870,7 +1870,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
}
}
if (bIsBidiAndMirrosInverse) {
- FX_INT32 i, j;
+ int32_t i, j;
i = iCharListStartAppend;
j = m_TempCharList.GetSize() - 1;
for (; i < j; i++, j--) {
@@ -1885,9 +1885,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj)
}
}
}
-FX_INT32 CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj)
+int32_t CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj)
{
- FX_INT32 nChars = pTextObj->CountChars();
+ int32_t nChars = pTextObj->CountChars();
if (nChars == 1) {
return m_TextlineDir;
}
@@ -2051,7 +2051,7 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj, const CFX_Af
}
return 2;
}
- FX_INT32 nChars = pObj->CountChars();
+ int32_t nChars = pObj->CountChars();
if (nChars == 1 && ( 0x2D == curChar || 0xAD == curChar))
if (IsHyphen(curChar)) {
return 3;
diff --git a/core/src/fpdftext/fpdf_text_search.cpp b/core/src/fpdftext/fpdf_text_search.cpp
index bfd742f1ab..89e132991d 100644
--- a/core/src/fpdftext/fpdf_text_search.cpp
+++ b/core/src/fpdftext/fpdf_text_search.cpp
@@ -266,14 +266,14 @@ FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFir
m_Buffer.AppendChar((FX_WCHAR)item.m_CharCode);
if (m_pObjArray) {
m_pObjArray->Add((void*)pObj);
- m_pObjArray->Add((void*)(FX_INTPTR)item_index);
+ m_pObjArray->Add((void*)(intptr_t)item_index);
}
} else {
m_Buffer << unicode_str;
if (m_pObjArray) {
for (int i = 0; i < unicode_str.GetLength(); i ++) {
m_pObjArray->Add((void*)pObj);
- m_pObjArray->Add((void*)(FX_INTPTR)item_index);
+ m_pObjArray->Add((void*)(intptr_t)item_index);
}
}
}
diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h
index 59dcd329b3..03f6ce1dc8 100644
--- a/core/src/fpdftext/text_int.h
+++ b/core/src/fpdftext/text_int.h
@@ -33,7 +33,7 @@ typedef struct _PAGECHAR_INFO {
FX_WCHAR m_Unicode;
FX_FLOAT m_OriginX;
FX_FLOAT m_OriginY;
- FX_INT32 m_Flag;
+ int32_t m_Flag;
CFX_FloatRect m_CharBox;
CPDF_TextObject* m_pTextObj;
CFX_AffineMatrix m_Matrix;
@@ -108,14 +108,14 @@ private:
int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const;
void CloseTempLine();
void OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str);
- FX_INT32 PreMarkedContent(PDFTEXT_Obj pObj);
+ int32_t PreMarkedContent(PDFTEXT_Obj pObj);
void ProcessMarkedContent(PDFTEXT_Obj pObj);
- void CheckMarkedContentObject(FX_INT32& start, FX_INT32& nCount) const;
+ void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const;
void FindPreviousTextObject(void);
void AddCharInfoByLRDirection(CFX_WideString& str, int i);
void AddCharInfoByRLDirection(CFX_WideString& str, int i);
- FX_INT32 GetTextObjectWritingMode(const CPDF_TextObject* pTextObj);
- FX_INT32 FindTextlineFlowDirection();
+ int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj);
+ int32_t FindTextlineFlowDirection();
protected:
CPDFText_ParseOptions m_ParseOptions;
CFX_WordArray m_CharIndex;