Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2461)

Unified Diff: core/src/fpdftext/fpdf_text.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfdoc/tagged_int.h ('k') | core/src/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdftext/fpdf_text.cpp
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index c5e064a60ac8249c8771353fad6c33b89b2a0a29..7d728a8ae7414c98da358a8ef6cdbb83cb456634 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -26,10 +26,10 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* d
}
return CFX_ByteString(defchar, -1);
}
- FX_BOOL bDef = FALSE;
char buf[10];
- int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 10, NULL, &bDef);
- if (ret && !bDef) {
+ int iDef = 0;
+ int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 10, NULL, &iDef);
+ if (ret && !iDef) {
return CFX_ByteString(buf, ret);
}
const FX_CHAR* altstr = FCS_GetAltStr(unicode);
@@ -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);
}
« no previous file with comments | « core/src/fpdfdoc/tagged_int.h ('k') | core/src/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698