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

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

Issue 1254703002: FX_BOOL considered harmful, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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/fpdftext/fpdf_text_int.cpp ('k') | core/src/fpdftext/text_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdftext/fpdf_text_search.cpp
diff --git a/core/src/fpdftext/fpdf_text_search.cpp b/core/src/fpdftext/fpdf_text_search.cpp
index 21a2564ae6cd7dd2f2de6a692d73dd51a3adaae0..d88e9e1760e523c57ac88596712cb25addca18a9 100644
--- a/core/src/fpdftext/fpdf_text_search.cpp
+++ b/core/src/fpdftext/fpdf_text_search.cpp
@@ -9,56 +9,56 @@
class CPDF_TextStream
{
public:
- CPDF_TextStream(CFX_WideTextBuf& buffer, FX_BOOL bUseLF, CFX_PtrArray* pObjArray);
+ CPDF_TextStream(CFX_WideTextBuf& buffer, bool bUseLF, CFX_PtrArray* pObjArray);
~CPDF_TextStream() {}
- FX_BOOL ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine);
+ bool ProcessObject(const CPDF_TextObject* pObj, bool bFirstLine);
CFX_WideTextBuf& m_Buffer;
- FX_BOOL m_bUseLF;
+ bool m_bUseLF;
CFX_PtrArray* m_pObjArray;
const CPDF_TextObject* m_pLastObj;
};
-CPDF_TextStream::CPDF_TextStream(CFX_WideTextBuf& buffer, FX_BOOL bUseLF, CFX_PtrArray* pObjArray) : m_Buffer(buffer)
+CPDF_TextStream::CPDF_TextStream(CFX_WideTextBuf& buffer, bool bUseLF, CFX_PtrArray* pObjArray) : m_Buffer(buffer)
{
m_pLastObj = NULL;
m_bUseLF = bUseLF;
m_pObjArray = pObjArray;
}
-FX_BOOL FPDFText_IsSameTextObject(const CPDF_TextObject* pTextObj1, const CPDF_TextObject* pTextObj2)
+bool FPDFText_IsSameTextObject(const CPDF_TextObject* pTextObj1, const CPDF_TextObject* pTextObj2)
{
if (!pTextObj1 || !pTextObj2) {
- return FALSE;
+ return false;
}
CFX_FloatRect rcPreObj(pTextObj2->m_Left, pTextObj2->m_Bottom, pTextObj2->m_Right, pTextObj2->m_Top);
CFX_FloatRect rcCurObj(pTextObj1->m_Left, pTextObj1->m_Bottom, pTextObj1->m_Right, pTextObj1->m_Top);
if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) {
- return TRUE;
+ return true;
}
if (!rcPreObj.IsEmpty() || !rcCurObj.IsEmpty()) {
rcPreObj.Intersect(rcCurObj);
if (rcPreObj.IsEmpty()) {
- return FALSE;
+ return false;
}
if (FXSYS_fabs(rcPreObj.Width() - rcCurObj.Width()) > rcCurObj.Width() / 2) {
- return FALSE;
+ return false;
}
if (pTextObj2->GetFontSize() != pTextObj1->GetFontSize()) {
- return FALSE;
+ return false;
}
}
int nPreCount = pTextObj2->CountItems();
int nCurCount = pTextObj1->CountItems();
if (nPreCount != nCurCount) {
- return FALSE;
+ return false;
}
for (int i = 0; i < nPreCount; i++) {
CPDF_TextObjectItem itemPer, itemCur;
pTextObj2->GetItemInfo(i, &itemPer);
pTextObj1->GetItemInfo(i, &itemCur);
if (itemCur.m_CharCode != itemPer.m_CharCode) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont)
{
@@ -133,7 +133,7 @@ int FPDFText_ProcessInterObj(const CPDF_TextObject* pPrevObj, const CPDF_TextObj
}
return 0;
}
-FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine)
+bool CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, bool bFirstLine)
{
CPDF_Font* pFont = pObj->GetFont();
CFX_AffineMatrix matrix;
@@ -150,7 +150,7 @@ FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFir
}
} else {
if (bFirstLine) {
- return TRUE;
+ return true;
}
if (m_bUseLF) {
m_Buffer.AppendChar(L'\r');
@@ -176,7 +176,7 @@ FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFir
}
} else if (result == -1) {
m_pLastObj = pObj;
- return FALSE;
+ return false;
} else if (result == 3) {
item_index = 1;
}
@@ -277,9 +277,9 @@ FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFir
}
}
}
- return FALSE;
+ return false;
}
-void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects* pPage, FX_BOOL bUseLF,
+void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects* pPage, bool bUseLF,
CFX_PtrArray* pObjArray)
{
CPDF_TextStream textstream(buffer, bUseLF, pObjArray);
@@ -292,7 +292,7 @@ void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects* pPage
if (pObject->m_Type != PDFPAGE_TEXT) {
continue;
}
- textstream.ProcessObject((CPDF_TextObject*)pObject, FALSE);
+ textstream.ProcessObject((CPDF_TextObject*)pObject, false);
}
}
CFX_WideString PDF_GetFirstTextLine_Unicode(CPDF_Document* pDoc, CPDF_Dictionary* pPage)
@@ -302,17 +302,17 @@ CFX_WideString PDF_GetFirstTextLine_Unicode(CPDF_Document* pDoc, CPDF_Dictionary
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);
- CPDF_TextStream textstream(buffer, FALSE, NULL);
+ CPDF_TextStream textstream(buffer, false, NULL);
FX_POSITION pos = page.GetFirstObjectPosition();
while (pos) {
CPDF_PageObject* pObject = page.GetNextObject(pos);
if (pObject->m_Type != PDFPAGE_TEXT) {
continue;
}
- if (textstream.ProcessObject((CPDF_TextObject*)pObject, TRUE)) {
+ if (textstream.ProcessObject((CPDF_TextObject*)pObject, true)) {
break;
}
}
« no previous file with comments | « core/src/fpdftext/fpdf_text_int.cpp ('k') | core/src/fpdftext/text_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698