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

Unified Diff: fpdfsdk/src/fsdk_baseannot.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 | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fsdk_baseannot.cpp
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index e35e537765986baa97325a0f679bf9fdbf8e68fc..0d05de39f7c5db3310ef1525c124035a2d0b8ca2 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -17,14 +17,14 @@ int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute)
return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60);
}
-FX_BOOL _gAfxIsLeapYear(int16_t year)
+bool _gAfxIsLeapYear(int16_t year)
{
return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)));
}
FX_WORD _gAfxGetYearDays(int16_t year)
{
- return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365);
+ return (_gAfxIsLeapYear(year) == true ? 366 : 365);
}
uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month)
@@ -50,7 +50,7 @@ uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month)
break;
case 2:
- if (_gAfxIsLeapYear(year) == TRUE)
+ if (_gAfxIsLeapYear(year) == true)
mDays = 29;
else
mDays = 28;
@@ -128,17 +128,17 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::operator = (const FX_SYSTEMTIME& st)
return *this;
}
-FX_BOOL CPDFSDK_DateTime::operator == (CPDFSDK_DateTime& datetime)
+bool CPDFSDK_DateTime::operator == (CPDFSDK_DateTime& datetime)
{
return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0);
}
-FX_BOOL CPDFSDK_DateTime::operator != (CPDFSDK_DateTime& datetime)
+bool CPDFSDK_DateTime::operator != (CPDFSDK_DateTime& datetime)
{
return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0);
}
-FX_BOOL CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime)
+bool CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime)
{
CPDFSDK_DateTime dt1 = ToGMT();
CPDFSDK_DateTime dt2 = datetime.ToGMT();
@@ -147,12 +147,12 @@ FX_BOOL CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime)
int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second;
- if (d1 > d3) return TRUE;
- if (d2 > d4) return TRUE;
- return FALSE;
+ if (d1 > d3) return true;
+ if (d2 > d4) return true;
+ return false;
}
-FX_BOOL CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime)
+bool CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime)
{
CPDFSDK_DateTime dt1 = ToGMT();
CPDFSDK_DateTime dt2 = datetime.ToGMT();
@@ -161,12 +161,12 @@ FX_BOOL CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime)
int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second;
- if (d1 >= d3) return TRUE;
- if (d2 >= d4) return TRUE;
- return FALSE;
+ if (d1 >= d3) return true;
+ if (d2 >= d4) return true;
+ return false;
}
-FX_BOOL CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime)
+bool CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime)
{
CPDFSDK_DateTime dt1 = ToGMT();
CPDFSDK_DateTime dt2 = datetime.ToGMT();
@@ -175,12 +175,12 @@ FX_BOOL CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime)
int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second;
- if (d1 < d3) return TRUE;
- if (d2 < d4) return TRUE;
- return FALSE;
+ if (d1 < d3) return true;
+ if (d2 < d4) return true;
+ return false;
}
-FX_BOOL CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime)
+bool CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime)
{
CPDFSDK_DateTime dt1 = ToGMT();
CPDFSDK_DateTime dt2 = datetime.ToGMT();
@@ -189,9 +189,9 @@ FX_BOOL CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime)
int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second;
- if (d1 <= d3) return TRUE;
- if (d2 <= d4) return TRUE;
- return FALSE;
+ if (d1 <= d3) return true;
+ if (d2 <= d4) return true;
+ return false;
}
CPDFSDK_DateTime::operator time_t()
@@ -506,7 +506,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds)
CPDFSDK_Annot::CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) :
m_pAnnot(pAnnot),
m_pPageView(pPageView),
-m_bSelected(FALSE),
+m_bSelected(false),
m_nTabOrder(-1)
{
}
@@ -539,12 +539,12 @@ CPDFSDK_PageView* CPDFSDK_Annot::GetPageView()
return m_pPageView;
}
-FX_BOOL CPDFSDK_Annot::IsSelected()
+bool CPDFSDK_Annot::IsSelected()
{
return m_bSelected;
}
-void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected)
+void CPDFSDK_Annot::SetSelected(bool bSelected)
{
m_bSelected = bSelected;
}
@@ -606,15 +606,15 @@ void CPDFSDK_Annot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix*
m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, mode, pOptions);
}
-FX_BOOL CPDFSDK_Annot::IsAppearanceValid()
+bool CPDFSDK_Annot::IsAppearanceValid()
{
return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL;
}
-FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode)
+bool CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode)
{
CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
- if (pAP == NULL) return FALSE;
+ if (pAP == NULL) return false;
// Choose the right sub-ap
const FX_CHAR* ap_entry = "N";
@@ -627,9 +627,9 @@ FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode)
// Get the AP stream or subdirectory
CPDF_Object* psub = pAP->GetElementValue(ap_entry);
- if (psub == NULL) return FALSE;
+ if (psub == NULL) return false;
- return TRUE;
+ return true;
}
void CPDFSDK_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
@@ -884,7 +884,7 @@ void CPDFSDK_Annot::RemoveColor()
m_pAnnot->GetAnnotDict()->RemoveAt("C");
}
-FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
+bool CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
{
if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C"))
{
@@ -895,7 +895,7 @@ FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
color = FXSYS_RGB((int)g, (int)g, (int)g);
- return TRUE;
+ return true;
}
else if (nCount == 3)
{
@@ -905,7 +905,7 @@ FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
color = FXSYS_RGB((int)r, (int)g, (int)b);
- return TRUE;
+ return true;
}
else if (nCount == 4)
{
@@ -920,11 +920,11 @@ FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255));
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
@@ -985,7 +985,7 @@ void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re
pStreamDict->SetAtRect("BBox", rcBBox);
}
- pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE);
+ pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), false, false);
}
#define BA_ANNOT_MINWIDTH 1
@@ -1001,11 +1001,11 @@ FX_FLOAT CPDFSDK_Annot::GetMinHeight() const
return BA_ANNOT_MINHEIGHT;
}
-FX_BOOL CPDFSDK_Annot::CreateFormFiller()
+bool CPDFSDK_Annot::CreateFormFiller()
{
- return TRUE;
+ return true;
}
-FX_BOOL CPDFSDK_Annot::IsVisible() const
+bool CPDFSDK_Annot::IsVisible() const
{
int nFlags = GetFlags();
return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || (nFlags & ANNOTFLAG_NOVIEW));
« no previous file with comments | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698