From 43854a5073602a4613131aa6dbac5f7b9a095bcd Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 27 Apr 2016 12:26:00 -0700 Subject: Standardize on ASSERT. There are currently three ways to assert in the code (ASSERT, FXSYS_assert and assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can be overridden if the platform requies and we can pickup the Chromium version if it has already been defined in the build. This does change behaviour. Currently FXSYS_assert is always defined but ASSERT is only defined in debug builds. So, the FXSYS_assert's would fire in Release builds. That will no longer happen. BUG=pdfium:219 Review-Url: https://codereview.chromium.org/1914303003 --- xfa/fgas/localization/fgas_datetime.cpp | 26 +++++++++++++------------- xfa/fgas/localization/fgas_locale.cpp | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'xfa/fgas/localization') diff --git a/xfa/fgas/localization/fgas_datetime.cpp b/xfa/fgas/localization/fgas_datetime.cpp index 456e476dee..f3c560b823 100644 --- a/xfa/fgas/localization/fgas_datetime.cpp +++ b/xfa/fgas/localization/fgas_datetime.cpp @@ -31,23 +31,23 @@ const int64_t g_FXMillisecondsPerMinute = 60000; const int64_t g_FXMillisecondsPerHour = 3600000; const int64_t g_FXMillisecondsPerDay = 86400000; FX_BOOL FX_IsLeapYear(int32_t iYear) { - FXSYS_assert(iYear != 0); + ASSERT(iYear != 0); return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0; } int32_t FX_DaysInYear(int32_t iYear) { - FXSYS_assert(iYear != 0); + ASSERT(iYear != 0); return FX_IsLeapYear(iYear) ? g_FXDaysPerLeapYear : g_FXDaysPerYear; } uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth) { - FXSYS_assert(iYear != 0); - FXSYS_assert(iMonth >= 1 && iMonth <= 12); + ASSERT(iYear != 0); + ASSERT(iMonth >= 1 && iMonth <= 12); const uint8_t* p = FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth; return p[iMonth - 1]; } static int32_t FX_DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) { - FXSYS_assert(iYear != 0); - FXSYS_assert(iMonth >= 1 && iMonth <= 12); + ASSERT(iYear != 0); + ASSERT(iMonth >= 1 && iMonth <= 12); const int32_t* p = FX_IsLeapYear(iYear) ? g_FXDaysBeforeLeapMonth : g_FXDaysBeforeMonth; return p[iMonth - 1]; @@ -56,9 +56,9 @@ static int64_t FX_DateToDays(int32_t iYear, uint8_t iMonth, uint8_t iDay, FX_BOOL bIncludeThisDay = FALSE) { - FXSYS_assert(iYear != 0); - FXSYS_assert(iMonth >= 1 && iMonth <= 12); - FXSYS_assert(iDay >= 1 && iDay <= FX_DaysInMonth(iYear, iMonth)); + ASSERT(iYear != 0); + ASSERT(iMonth >= 1 && iMonth <= 12); + ASSERT(iDay >= 1 && iDay <= FX_DaysInMonth(iYear, iMonth)); int64_t iDays = FX_DaysBeforeMonthInYear(iYear, iMonth); iDays += iDay; if (!bIncludeThisDay) { @@ -197,10 +197,10 @@ void CFX_Unitime::Set(int32_t year, uint8_t minute, uint8_t second, uint16_t millisecond) { - FXSYS_assert(hour <= 23); - FXSYS_assert(minute <= 59); - FXSYS_assert(second <= 59); - FXSYS_assert(millisecond <= 999); + ASSERT(hour <= 23); + ASSERT(minute <= 59); + ASSERT(second <= 59); + ASSERT(millisecond <= 999); m_iUnitime = (int64_t)hour * g_FXMillisecondsPerHour + (int64_t)minute * g_FXMillisecondsPerMinute + (int64_t)second * g_FXMillisecondsPerSecond + millisecond; diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 9a8e05cbc7..521b53536e 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -768,7 +768,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, if (!pLocale) { pLocale = m_pLocaleMgr->GetDefLocale(); } - FXSYS_assert(pLocale != NULL); + ASSERT(pLocale != NULL); pLocale->GetNumPattern(eSubCategory, wsSubCategory); iDotIndex = wsSubCategory.Find('.'); if (iDotIndex > 0) { @@ -2223,7 +2223,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( if (!pLocale) { pLocale = m_pLocaleMgr->GetDefLocale(); } - FXSYS_assert(pLocale != NULL); + ASSERT(pLocale != NULL); switch (eCategory) { case FX_LOCALECATEGORY_Date: pLocale->GetDatePattern(eSubCategory, wsDatePattern); @@ -4487,7 +4487,7 @@ static inline void fxmath_decimal_helper_raw_mul(uint64_t a[], uint8_t bl, uint64_t c[], uint8_t cl) { - assert(al + bl <= cl); + ASSERT(al + bl <= cl); { for (int i = 0; i < cl; i++) { c[i] = 0; -- cgit v1.2.3