summaryrefslogtreecommitdiff
path: root/core/src/fpdftext/fpdf_text.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-27 11:55:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-27 11:55:29 -0700
commitff46aaf499edcf153ee2f57c7016587aa96dcfa0 (patch)
tree0a0d92713af476897899b126d180cc6294433d10 /core/src/fpdftext/fpdf_text.cpp
parentaafeff816e22c1333c17d8a0eb4fe8927c28142d (diff)
downloadpdfium-ff46aaf499edcf153ee2f57c7016587aa96dcfa0.tar.xz
FX Bool considered harmful, part 3
Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 .
Diffstat (limited to 'core/src/fpdftext/fpdf_text.cpp')
-rw-r--r--core/src/fpdftext/fpdf_text.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index 7203a694ab..7d728a8ae7 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -289,7 +289,7 @@ void CTextPage::WriteOutput(CFX_WideStringArray& lines, int iMinWidth)
}
void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest)
{
- wChar = FX_GetMirrorChar(wChar, TRUE, FALSE);
+ wChar = FX_GetMirrorChar(wChar, true, false);
FX_WCHAR* pDst = NULL;
FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
if (nCount < 1 ) {
@@ -311,7 +311,7 @@ void NormalizeString(CFX_WideString& str)
CFX_WideString sBuffer;
nonstd::unique_ptr<IFX_BidiChar> pBidiChar(IFX_BidiChar::Create());
CFX_WordArray order;
- FX_BOOL bR2L = FALSE;
+ bool bR2L = false;
int32_t start = 0, count = 0, i = 0;
int nR2L = 0, nL2R = 0;
for (i = 0; i < str.GetLength(); i++) {
@@ -343,7 +343,7 @@ void NormalizeString(CFX_WideString& str)
}
}
if(nR2L > 0 && nR2L >= nL2R) {
- bR2L = TRUE;
+ bR2L = true;
}
if(bR2L) {
int count = order.GetSize();
@@ -357,7 +357,7 @@ void NormalizeString(CFX_WideString& str)
}
} else {
i = j;
- FX_BOOL bSymbol = FALSE;
+ bool bSymbol = false;
while(i > 0 && order.GetAt(i) != 2) {
bSymbol = !order.GetAt(i);
i -= 3;
@@ -389,7 +389,7 @@ void NormalizeString(CFX_WideString& str)
}
} else {
int count = order.GetSize();
- FX_BOOL bL2R = FALSE;
+ bool bL2R = false;
for(int j = 0; j < count; j += 3) {
int ret = order.GetAt(j + 2);
int start = order.GetAt(j);
@@ -405,7 +405,7 @@ void NormalizeString(CFX_WideString& str)
}
if(i == 3) {
j = -3;
- bL2R = TRUE;
+ bL2R = true;
continue;
}
int end = str.GetLength() - 1;
@@ -427,15 +427,15 @@ void NormalizeString(CFX_WideString& str)
str.Empty();
str += sBuffer;
}
-static FX_BOOL IsNumber(CFX_WideString& str)
+static bool IsNumber(CFX_WideString& str)
{
for (int i = 0; i < str.GetLength(); i ++) {
FX_WCHAR ch = str[i];
if ((ch < '0' || ch > '9') && ch != '-' && ch != '+' && ch != '.' && ch != ' ') {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
void CTextPage::FindColumns()
{
@@ -534,18 +534,18 @@ void CTextBaseLine::InsertTextBox(FX_FLOAT leftx, FX_FLOAT rightx, FX_FLOAT topy
pText->m_pColumn = NULL;
m_TextList.InsertAt(i, pText);
}
-FX_BOOL GetIntersection(FX_FLOAT low1, FX_FLOAT high1, FX_FLOAT low2, FX_FLOAT high2,
+bool GetIntersection(FX_FLOAT low1, FX_FLOAT high1, FX_FLOAT low2, FX_FLOAT high2,
FX_FLOAT& interlow, FX_FLOAT& interhigh);
-FX_BOOL CTextBaseLine::CanMerge(CTextBaseLine* pOther)
+bool CTextBaseLine::CanMerge(CTextBaseLine* pOther)
{
FX_FLOAT inter_top, inter_bottom;
if (!GetIntersection(m_Bottom, m_Top, pOther->m_Bottom, pOther->m_Top,
inter_bottom, inter_top)) {
- return FALSE;
+ return false;
}
FX_FLOAT inter_h = inter_top - inter_bottom;
if (inter_h < (m_Top - m_Bottom) / 2 && inter_h < (pOther->m_Top - pOther->m_Bottom) / 2) {
- return FALSE;
+ return false;
}
FX_FLOAT dy = (FX_FLOAT)FXSYS_fabs(m_BaseLine - pOther->m_BaseLine);
for (int i = 0; i < m_TextList.GetSize(); i ++) {
@@ -563,11 +563,11 @@ FX_BOOL CTextBaseLine::CanMerge(CTextBaseLine* pOther)
}
if (dy >= (pText->m_Bottom - pText->m_Top) / 2 ||
dy >= (pOtherText->m_Bottom - pOtherText->m_Top) / 2) {
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
void CTextBaseLine::Merge(CTextBaseLine* pOther)
{
@@ -577,7 +577,7 @@ void CTextBaseLine::Merge(CTextBaseLine* pOther)
pText->m_SpaceWidth, pText->m_FontSizeV, pText->m_Text);
}
}
-FX_BOOL CTextBaseLine::GetWidth(FX_FLOAT& leftx, FX_FLOAT& rightx)
+bool CTextBaseLine::GetWidth(FX_FLOAT& leftx, FX_FLOAT& rightx)
{
int i;
for (i = 0; i < m_TextList.GetSize(); i ++) {
@@ -587,7 +587,7 @@ FX_BOOL CTextBaseLine::GetWidth(FX_FLOAT& leftx, FX_FLOAT& rightx)
}
}
if (i == m_TextList.GetSize()) {
- return FALSE;
+ return false;
}
CTextBox* pText = (CTextBox*)m_TextList.GetAt(i);
leftx = pText->m_Left;
@@ -599,7 +599,7 @@ FX_BOOL CTextBaseLine::GetWidth(FX_FLOAT& leftx, FX_FLOAT& rightx)
}
pText = (CTextBox*)m_TextList.GetAt(i);
rightx = pText->m_Right;
- return TRUE;
+ return true;
}
void CTextBaseLine::MergeBoxes()
{
@@ -724,8 +724,8 @@ void PDF_GetPageText_Unicode(CFX_WideStringArray& lines, CPDF_Document* pDoc, CP
CPDF_Page page;
page.Load(pDoc, pPage);
CPDF_ParseOptions options;
- options.m_bTextOnly = TRUE;
- options.m_bSeparateForm = FALSE;
+ options.m_bTextOnly = true;
+ options.m_bSeparateForm = false;
page.ParseContent(&options);
CFX_FloatRect page_bbox = page.GetPageBBox();
if (flags & PDF2TXT_AUTO_ROTATE) {
@@ -734,7 +734,7 @@ void PDF_GetPageText_Unicode(CFX_WideStringArray& lines, CPDF_Document* pDoc, CP
CTextPage texts;
texts.m_bAutoWidth = flags & PDF2TXT_AUTO_WIDTH;
texts.m_bKeepColumn = flags & PDF2TXT_KEEP_COLUMN;
- texts.m_bBreakSpace = TRUE;
+ texts.m_bBreakSpace = true;
FX_POSITION pos = page.GetFirstObjectPosition();
while (pos) {
CPDF_PageObject* pObject = page.GetNextObject(pos);
@@ -763,7 +763,7 @@ void PDF_GetPageText(CFX_ByteStringArray& lines, CPDF_Document* pDoc, CPDF_Dicti
lines.Add(str);
}
}
-extern void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects* pPage, FX_BOOL bUseLF,
+extern void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects* pPage, bool bUseLF,
CFX_PtrArray* pObjArray);
void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPDF_Dictionary* pPage, FX_DWORD flags)
{
@@ -771,8 +771,8 @@ void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPD
CPDF_Page page;
page.Load(pDoc, pPage);
CPDF_ParseOptions options;
- options.m_bTextOnly = TRUE;
- options.m_bSeparateForm = FALSE;
+ options.m_bTextOnly = true;
+ options.m_bSeparateForm = false;
page.ParseContent(&options);
- _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL);
+ _PDF_GetTextStream_Unicode(buffer, &page, true, NULL);
}