Replace pdfium::nullopt with absl::nullopt.
Just search and replace. Then delete unused using statements from
third_party/base/optional.h.
Bug: pdfium:1726
Change-Id: Ia25c974142c37956e8fb41c200736633d6769785
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85515
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.cpp b/core/fpdfapi/font/cfx_cttgsubtable.cpp
index f79484f..b948e60 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.cpp
+++ b/core/fpdfapi/font/cfx_cttgsubtable.cpp
@@ -81,7 +81,7 @@
if (result.has_value())
return result.value();
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<uint32_t> CFX_CTTGSUBTable::GetVerticalGlyphSub2(
@@ -106,7 +106,7 @@
}
}
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
int CFX_CTTGSUBTable::GetCoverageIndex(TCoverageFormatBase* Coverage,
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index fb3810a..706903e8 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -168,7 +168,7 @@
ByteStringView first,
ByteStringView second) {
if (first.IsEmpty() || first[0] != '<')
- return pdfium::nullopt;
+ return absl::nullopt;
size_t i;
for (i = 1; i < first.GetLength(); ++i) {
@@ -177,7 +177,7 @@
}
size_t char_size = (i - 1) / 2;
if (char_size > 4)
- return pdfium::nullopt;
+ return absl::nullopt;
CPDF_CMap::CodeRange range;
range.m_CharSize = char_size;
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index 26bb35c..d2dcb73 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -75,16 +75,16 @@
Optional<uint32_t> CPDF_ToUnicodeMap::StringToCode(ByteStringView str) {
size_t len = str.GetLength();
if (len <= 2 || str[0] != '<' || str[len - 1] != '>')
- return pdfium::nullopt;
+ return absl::nullopt;
FX_SAFE_UINT32 code = 0;
for (char c : str.Substr(1, len - 2)) {
if (!FXSYS_IsHexDigit(c))
- return pdfium::nullopt;
+ return absl::nullopt;
code = code * 16 + FXSYS_HexCharToInt(c);
if (!code.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
}
return Optional<uint32_t>(code.ValueOrDie());
}
diff --git a/core/fpdfapi/page/cpdf_form.cpp b/core/fpdfapi/page/cpdf_form.cpp
index 3562208..9d95c4d 100644
--- a/core/fpdfapi/page/cpdf_form.cpp
+++ b/core/fpdfapi/page/cpdf_form.cpp
@@ -109,11 +109,11 @@
Optional<std::pair<RetainPtr<CFX_DIBitmap>, CFX_Matrix>>
CPDF_Form::GetBitmapAndMatrixFromSoleImageOfForm() const {
if (GetPageObjectCount() != 1)
- return pdfium::nullopt;
+ return absl::nullopt;
CPDF_ImageObject* pImageObject = (*begin())->AsImage();
if (!pImageObject)
- return pdfium::nullopt;
+ return absl::nullopt;
return {{pImageObject->GetIndependentBitmap(), pImageObject->matrix()}};
}
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp
index 77cdb1e..da75360 100644
--- a/core/fpdfapi/page/cpdf_function.cpp
+++ b/core/fpdfapi/page/cpdf_function.cpp
@@ -129,19 +129,19 @@
Optional<uint32_t> CPDF_Function::Call(pdfium::span<const float> inputs,
pdfium::span<float> results) const {
if (m_nInputs != inputs.size())
- return pdfium::nullopt;
+ return absl::nullopt;
std::vector<float> clamped_inputs(m_nInputs);
for (uint32_t i = 0; i < m_nInputs; i++) {
float domain1 = m_Domains[i * 2];
float domain2 = m_Domains[i * 2 + 1];
if (domain1 > domain2)
- return pdfium::nullopt;
+ return absl::nullopt;
clamped_inputs[i] = pdfium::clamp(inputs[i], domain1, domain2);
}
if (!v_Call(clamped_inputs, results))
- return pdfium::nullopt;
+ return absl::nullopt;
if (m_Ranges.empty())
return m_nOutputs;
@@ -150,7 +150,7 @@
float range1 = m_Ranges[i * 2];
float range2 = m_Ranges[i * 2 + 1];
if (range1 > range2)
- return pdfium::nullopt;
+ return absl::nullopt;
results[i] = pdfium::clamp(results[i], range1, range2);
}
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index 3cb302c..4e9563a 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -88,7 +88,7 @@
const GraphicsData& gd) {
auto it = m_GraphicsMap.find(gd);
if (it == m_GraphicsMap.end())
- return pdfium::nullopt;
+ return absl::nullopt;
return it->second;
}
@@ -101,7 +101,7 @@
Optional<ByteString> CPDF_PageObjectHolder::FontsMapSearch(const FontData& fd) {
auto it = m_FontsMap.find(fd);
if (it == m_FontsMap.end())
- return pdfium::nullopt;
+ return absl::nullopt;
return it->second;
}
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 8c2dc7a..632ebfa 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -372,7 +372,7 @@
return DecoderArray();
if (!pFilter->IsArray() && !pFilter->IsName())
- return pdfium::nullopt;
+ return absl::nullopt;
const CPDF_Object* pParams =
pDict->GetDirectObjectFor(pdfium::stream::kDecodeParms);
@@ -380,7 +380,7 @@
DecoderArray decoder_array;
if (const CPDF_Array* pDecoders = pFilter->AsArray()) {
if (!ValidateDecoderPipeline(pDecoders))
- return pdfium::nullopt;
+ return absl::nullopt;
const CPDF_Array* pParamsArray = ToArray(pParams);
for (size_t i = 0; i < pDecoders->size(); ++i) {
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index 8204ad8..f16e53a 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -76,7 +76,7 @@
std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
uint32_t* dest_size);
-// Returns pdfium::nullopt if the filter in |pDict| is the wrong type or an
+// Returns absl::nullopt if the filter in |pDict| is the wrong type or an
// invalid decoder pipeline.
// Returns an empty vector if there is no filter, or if the filter is an empty
// array.
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 22d9fb2..09c3017 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -80,12 +80,12 @@
uint8_t buf[kBufSize];
for (FX_FILESIZE offset = 0; offset <= 1024; ++offset) {
if (!pFile->ReadBlockAtOffset(buf, offset, kBufSize))
- return pdfium::nullopt;
+ return absl::nullopt;
if (memcmp(buf, "%PDF", 4) == 0)
return offset;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
int32_t GetDirectInteger(const CPDF_Dictionary* pDict, const ByteString& key) {
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 0881dab..7cb7e25 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -611,7 +611,7 @@
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOuterRect();
if (!image_rect.Valid())
- return pdfium::nullopt;
+ return absl::nullopt;
return image_rect;
}
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index e8b4058..4fea331 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -143,7 +143,7 @@
Optional<WideString> CPDF_Action::MaybeGetJavaScript() const {
const CPDF_Object* pObject = GetJavaScriptObject();
if (!pObject)
- return pdfium::nullopt;
+ return absl::nullopt;
return pObject->GetUnicodeText();
}
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp
index 35e8a0e..3904bf9 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -66,7 +66,7 @@
Optional<ByteString> CPDF_DefaultAppearance::GetFont(float* fFontSize) {
*fFontSize = 0.0f;
if (m_csDA.IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
ByteString csFontNameTag;
CPDF_SimpleParser syntax(m_csDA.AsStringView().raw_span());
@@ -80,7 +80,7 @@
Optional<CFX_Color> CPDF_DefaultAppearance::GetColor() const {
if (m_csDA.IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
float fc[4];
CPDF_SimpleParser syntax(m_csDA.AsStringView().raw_span());
@@ -101,13 +101,13 @@
fc[3] = StringToFloat(syntax.GetWord());
return CFX_Color(CFX_Color::Type::kCMYK, fc[0], fc[1], fc[2], fc[3]);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<CFX_Color::TypeAndARGB> CPDF_DefaultAppearance::GetColorARGB() const {
Optional<CFX_Color> maybe_color = GetColor();
if (!maybe_color.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
const CFX_Color& color = maybe_color.value();
if (color.nColorType == CFX_Color::Type::kGray) {
@@ -133,7 +133,7 @@
static_cast<int>(b * 255 + 0.5f)));
}
NOTREACHED();
- return pdfium::nullopt;
+ return absl::nullopt;
}
bool CPDF_DefaultAppearance::FindTagParamFromStartForTesting(
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 875b65b..16c95da 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -190,7 +190,7 @@
Optional<WideString> CPDF_FormControl::GetDefaultControlFontName() const {
RetainPtr<CPDF_Font> pFont = GetDefaultControlFont();
if (!pFont)
- return pdfium::nullopt;
+ return absl::nullopt;
return WideString::FromDefANSI(pFont->GetBaseFontName().AsStringView());
}
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index df8e5ad..40e550c 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -55,7 +55,7 @@
value < static_cast<int>(kFormFieldTypeCount)) {
return static_cast<FormFieldType>(value);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
// static
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index be45003..9e90b92 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -80,18 +80,18 @@
Optional<WideString> CPDF_PageLabel::GetLabel(int nPage) const {
if (!m_pDocument)
- return pdfium::nullopt;
+ return absl::nullopt;
if (nPage < 0 || nPage >= m_pDocument->GetPageCount())
- return pdfium::nullopt;
+ return absl::nullopt;
const CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
if (!pPDFRoot)
- return pdfium::nullopt;
+ return absl::nullopt;
const CPDF_Dictionary* pLabels = pPDFRoot->GetDictFor("PageLabels");
if (!pLabels)
- return pdfium::nullopt;
+ return absl::nullopt;
CPDF_NumberTree numberTree(pLabels);
const CPDF_Object* pValue = nullptr;
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index 9b97762..55156db 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -44,11 +44,11 @@
const ByteString& bsKey) const {
const CPDF_Dictionary* pDict = GetViewerPreferences();
if (!pDict)
- return pdfium::nullopt;
+ return absl::nullopt;
const CPDF_Name* pName = ToName(pDict->GetObjectFor(bsKey));
if (!pName)
- return pdfium::nullopt;
+ return absl::nullopt;
return pName->GetString();
}
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 19e43b9..c64dce5 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -1412,7 +1412,7 @@
wchar_t unicode) {
const CharInfo* pPrevCharInfo = GetPrevCharInfo();
if (!pPrevCharInfo)
- return pdfium::nullopt;
+ return absl::nullopt;
CharInfo info;
info.m_Index = m_TextBuf.GetLength();
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index ebb72a1..6d3b586 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -98,7 +98,7 @@
while (iSubString--) {
lpszFullString = wcschr(lpszFullString, L' ');
if (!lpszFullString)
- return pdfium::nullopt;
+ return absl::nullopt;
lpszFullString++;
while (*lpszFullString == L' ')
@@ -109,7 +109,7 @@
int nLen = lpchEnd ? static_cast<int>(lpchEnd - lpszFullString)
: static_cast<int>(wcslen(lpszFullString));
if (nLen < 0)
- return pdfium::nullopt;
+ return absl::nullopt;
return WideString(lpszFullString, static_cast<size_t>(nLen));
}
diff --git a/core/fxcodec/fx_codec.cpp b/core/fxcodec/fx_codec.cpp
index c94eb71..13aea98 100644
--- a/core/fxcodec/fx_codec.cpp
+++ b/core/fxcodec/fx_codec.cpp
@@ -75,14 +75,14 @@
int width) {
FX_SAFE_UINT32 pitch = CalculatePitch8Safely(bpc, components, width);
if (!pitch.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
return pitch.ValueOrDie();
}
Optional<uint32_t> CalculatePitch32(int bpp, int width) {
FX_SAFE_UINT32 pitch = CalculatePitch32Safely(bpp, width);
if (!pitch.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
return pitch.ValueOrDie();
}
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index b7bbfd0..8af7119 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -22,7 +22,7 @@
FX_SAFE_UINT32 result = dimension;
result += delta;
if (!result.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
return result.ValueOrDie();
}
@@ -32,7 +32,7 @@
FX_SAFE_INT32 result = offset;
result += dimension >> shift;
if (!result.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
return result.ValueOrDie();
}
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index df220bc..c561325 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -402,7 +402,7 @@
pdfium::span<const uint8_t> src_span) {
ImageInfo info;
if (!JpegLoadInfo(src_span, &info))
- return pdfium::nullopt;
+ return absl::nullopt;
return info;
}
diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
index f42da8d..44a5da8 100644
--- a/core/fxcodec/jpx/cjpx_decoder.cpp
+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -63,15 +63,15 @@
OpjImageRgbData data;
data.r.reset(static_cast<int*>(opj_image_data_alloc(size)));
if (!data.r)
- return pdfium::nullopt;
+ return absl::nullopt;
data.g.reset(static_cast<int*>(opj_image_data_alloc(size)));
if (!data.g)
- return pdfium::nullopt;
+ return absl::nullopt;
data.b.reset(static_cast<int*>(opj_image_data_alloc(size)));
if (!data.b)
- return pdfium::nullopt;
+ return absl::nullopt;
return data;
}
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index ebd766a..2b67694 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -532,41 +532,41 @@
Optional<size_t> ByteString::Find(char ch, size_t start) const {
if (!m_pData)
- return pdfium::nullopt;
+ return absl::nullopt;
if (!IsValidIndex(start))
- return pdfium::nullopt;
+ return absl::nullopt;
const char* pStr = static_cast<const char*>(
memchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start));
return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::nullopt;
+ : absl::nullopt;
}
Optional<size_t> ByteString::Find(ByteStringView subStr, size_t start) const {
if (!m_pData)
- return pdfium::nullopt;
+ return absl::nullopt;
if (!IsValidIndex(start))
- return pdfium::nullopt;
+ return absl::nullopt;
const char* pStr =
FX_strstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
subStr.unterminated_c_str(), subStr.GetLength());
return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::nullopt;
+ : absl::nullopt;
}
Optional<size_t> ByteString::ReverseFind(char ch) const {
if (!m_pData)
- return pdfium::nullopt;
+ return absl::nullopt;
size_t nLength = m_pData->m_nDataLength;
while (nLength--) {
if (m_pData->m_String[nLength] == ch)
return nLength;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
void ByteString::MakeLower() {
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.cpp b/core/fxcrt/css/cfx_csscomputedstyle.cpp
index 87cf08a..637331c 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.cpp
+++ b/core/fxcrt/css/cfx_csscomputedstyle.cpp
@@ -28,7 +28,7 @@
Optional<WideString> CFX_CSSComputedStyle::GetLastFontFamily() const {
if (!m_InheritedData.m_pFontFamily ||
m_InheritedData.m_pFontFamily->values().empty()) {
- return pdfium::nullopt;
+ return absl::nullopt;
}
return m_InheritedData.m_pFontFamily->values()
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index b38503f..79989b4 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -83,7 +83,7 @@
++pStr;
}
if (nWidth < 0 || nWidth > 128 * 1024)
- return pdfium::nullopt;
+ return absl::nullopt;
int nPrecision = 0;
if (*pStr == '.') {
pStr++;
@@ -97,7 +97,7 @@
}
}
if (nPrecision < 0 || nPrecision > 128 * 1024)
- return pdfium::nullopt;
+ return absl::nullopt;
int nModifier = 0;
if (*pStr == L'I' && *(pStr + 1) == L'6' && *(pStr + 2) == L'4') {
pStr += 3;
@@ -254,7 +254,7 @@
const wchar_t* pFormat,
va_list argList) {
if (!size)
- return pdfium::nullopt;
+ return absl::nullopt;
WideString str;
{
@@ -272,7 +272,7 @@
bool bSufficientBuffer = ret >= 0 || buffer[size - 1] == 0;
if (!bSufficientBuffer)
- return pdfium::nullopt;
+ return absl::nullopt;
}
str.ReleaseBuffer(str.GetStringLength());
return str;
@@ -761,41 +761,41 @@
Optional<size_t> WideString::Find(wchar_t ch, size_t start) const {
if (!m_pData)
- return pdfium::nullopt;
+ return absl::nullopt;
if (!IsValidIndex(start))
- return pdfium::nullopt;
+ return absl::nullopt;
const wchar_t* pStr =
wmemchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start);
return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::nullopt;
+ : absl::nullopt;
}
Optional<size_t> WideString::Find(WideStringView subStr, size_t start) const {
if (!m_pData)
- return pdfium::nullopt;
+ return absl::nullopt;
if (!IsValidIndex(start))
- return pdfium::nullopt;
+ return absl::nullopt;
const wchar_t* pStr =
FX_wcsstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
subStr.unterminated_c_str(), subStr.GetLength());
return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::nullopt;
+ : absl::nullopt;
}
Optional<size_t> WideString::ReverseFind(wchar_t ch) const {
if (!m_pData)
- return pdfium::nullopt;
+ return absl::nullopt;
size_t nLength = m_pData->m_nDataLength;
while (nLength--) {
if (m_pData->m_String[nLength] == ch)
return nLength;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
void WideString::MakeLower() {
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 147e26e..4004d43 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -424,23 +424,23 @@
Optional<FX_RECT> CFX_Font::GetGlyphBBox(uint32_t glyph_index) {
if (!m_Face)
- return pdfium::nullopt;
+ return absl::nullopt;
FX_RECT result;
if (FXFT_Is_Face_Tricky(m_Face->GetRec())) {
int error = FT_Set_Char_Size(m_Face->GetRec(), 0, 1000 * 64, 72, 72);
if (error)
- return pdfium::nullopt;
+ return absl::nullopt;
error = FT_Load_Glyph(m_Face->GetRec(), glyph_index,
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (error)
- return pdfium::nullopt;
+ return absl::nullopt;
FT_Glyph glyph;
error = FT_Get_Glyph(m_Face->GetRec()->glyph, &glyph);
if (error)
- return pdfium::nullopt;
+ return absl::nullopt;
FT_BBox cbox;
FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_PIXELS, &cbox);
@@ -465,12 +465,12 @@
static_cast<int32_t>(FXFT_Get_Face_Descender(m_Face->GetRec())));
FT_Done_Glyph(glyph);
if (FT_Set_Pixel_Sizes(m_Face->GetRec(), 0, 64) != 0)
- return pdfium::nullopt;
+ return absl::nullopt;
return result;
}
constexpr int kFlag = FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
if (FT_Load_Glyph(m_Face->GetRec(), glyph_index, kFlag) != 0)
- return pdfium::nullopt;
+ return absl::nullopt;
int em = FXFT_Get_Face_UnitsPerEM(m_Face->GetRec());
if (em == 0) {
result.left = FXFT_Get_Glyph_HoriBearingX(m_Face->GetRec());
@@ -572,7 +572,7 @@
Optional<FX_RECT> CFX_Font::GetRawBBox() const {
if (!m_Face)
- return pdfium::nullopt;
+ return absl::nullopt;
return FX_RECT(FXFT_Get_Face_xMin(m_Face->GetRec()),
FXFT_Get_Face_yMin(m_Face->GetRec()),
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 24ca860..401e598 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -716,7 +716,7 @@
if (thisname.First(name.GetLength()) == name)
return thisname;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<ByteString> CFX_FontMapper::LocalizedFontNameStartingWith(
@@ -725,7 +725,7 @@
if (thispair.first.First(name.GetLength()) == name)
return thispair.second;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
#endif // defined(OS_WIN)
@@ -832,7 +832,7 @@
return FXSYS_stricmp(element.m_pName, name) < 0;
});
if (found == end || FXSYS_stricmp(found->m_pName, name->c_str()))
- return pdfium::nullopt;
+ return absl::nullopt;
*name = kBase14FontNames[static_cast<size_t>(found->m_Index)];
return found->m_Index;
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index 5e01413..705f202 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -171,7 +171,7 @@
return pdfium::make_span(kMMFonts[mm_index].m_pFontData,
kMMFonts[mm_index].m_dwSize);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
bool CFX_FontMgr::FreeTypeVersionSupportsHinting() const {
diff --git a/core/fxge/cfx_path.cpp b/core/fxge/cfx_path.cpp
index ee5ce2d..8bfbc9a 100644
--- a/core/fxge/cfx_path.cpp
+++ b/core/fxge/cfx_path.cpp
@@ -399,13 +399,13 @@
if (!matrix) {
if (!IsRectImpl(path_points))
- return pdfium::nullopt;
+ return absl::nullopt;
return CreateRectFromPoints(path_points[0].m_Point, path_points[2].m_Point);
}
if (!IsRectPreTransform(path_points))
- return pdfium::nullopt;
+ return absl::nullopt;
CFX_PointF points[5];
for (size_t i = 0; i < path_points.size(); ++i) {
@@ -414,11 +414,11 @@
if (i == 0)
continue;
if (XYBothNotEqual(points[i], points[i - 1]))
- return pdfium::nullopt;
+ return absl::nullopt;
}
if (XYBothNotEqual(points[0], points[3]))
- return pdfium::nullopt;
+ return absl::nullopt;
return CreateRectFromPoints(points[0], points[2]);
}
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 8ef8b82..a9e0742 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -689,11 +689,11 @@
FXDIB_Format format,
uint32_t pitch) {
if (width <= 0 || height <= 0)
- return pdfium::nullopt;
+ return absl::nullopt;
int bpp = GetBppFromFormat(format);
if (!bpp)
- return pdfium::nullopt;
+ return absl::nullopt;
uint32_t actual_pitch = pitch;
if (actual_pitch == 0) {
@@ -704,7 +704,7 @@
safe_pitch /= 32;
safe_pitch *= 4;
if (!safe_pitch.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
actual_pitch = safe_pitch.ValueOrDie();
}
@@ -712,7 +712,7 @@
FX_SAFE_UINT32 safe_size = actual_pitch;
safe_size *= height;
if (!safe_size.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
return PitchAndSize{actual_pitch, safe_size.ValueOrDie()};
}
diff --git a/core/fxge/text_glyph_pos.cpp b/core/fxge/text_glyph_pos.cpp
index 0f3b95e..d5bb26b 100644
--- a/core/fxge/text_glyph_pos.cpp
+++ b/core/fxge/text_glyph_pos.cpp
@@ -20,13 +20,13 @@
left += m_pGlyph->left();
left -= offset.x;
if (!left.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
FX_SAFE_INT32 top = m_Origin.y;
top -= m_pGlyph->top();
top -= offset.y;
if (!top.IsValid())
- return pdfium::nullopt;
+ return absl::nullopt;
return CFX_Point(left.ValueOrDie(), top.ValueOrDie());
}
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 7e2da08..f9cabfc 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -48,13 +48,13 @@
const ByteString& psname,
pdfium::span<const uint8_t> font_data) {
if (font_data.empty())
- return pdfium::nullopt;
+ return absl::nullopt;
// Per Type 42 font spec.
constexpr size_t kMaxSfntStringSize = 65535;
if (font_data.size() > kMaxSfntStringSize) {
// TODO(thestig): Fonts that are too big need to be written out in sections.
- return pdfium::nullopt;
+ return absl::nullopt;
}
// Each byte is written as 2 ASCIIHex characters, so really 64 chars per line.
diff --git a/core/fxge/win32/cgdi_plus_ext.cpp b/core/fxge/win32/cgdi_plus_ext.cpp
index e4f5c9c..3b1e9e6 100644
--- a/core/fxge/win32/cgdi_plus_ext.cpp
+++ b/core/fxge/win32/cgdi_plus_ext.cpp
@@ -392,7 +392,7 @@
if (distance_square < 2.25f)
return std::make_pair(i, pair1);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
class GpStream final : public IStream {
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp
index c3fd4fb..c2a2887 100644
--- a/fpdfsdk/cpdfsdk_appstream.cpp
+++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -1116,7 +1116,7 @@
Optional<CheckStyle> CheckStyleFromCaption(const WideString& caption) {
if (caption.IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
// Character values are ZapfDingbats encodings of named glyphs.
switch (caption[0]) {
@@ -1133,7 +1133,7 @@
case L'u':
return CheckStyle::kDiamond;
default:
- return pdfium::nullopt;
+ return absl::nullopt;
}
}
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index 6f901bd..938cb6a 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -288,7 +288,7 @@
Optional<WideString> CPDFSDK_InteractiveForm::OnFormat(
CPDF_FormField* pFormField) {
if (!m_pFormFillEnv->IsJSPlatformPresent())
- return pdfium::nullopt;
+ return absl::nullopt;
WideString sValue = pFormField->GetValue();
IJS_Runtime* pRuntime = m_pFormFillEnv->GetIJSRuntime();
@@ -313,7 +313,7 @@
}
}
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
void CPDFSDK_InteractiveForm::ResetFieldAppearance(
@@ -555,7 +555,7 @@
return;
OnCalculate(pField);
- ResetFieldAppearance(pField, pdfium::nullopt);
+ ResetFieldAppearance(pField, absl::nullopt);
UpdateField(pField);
}
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 54fb453..64ba361 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -434,7 +434,7 @@
GetFormControl()->GetColorARGB(pdfium::appearance::kBG);
if (type_argb_pair.color_type == CFX_Color::Type::kTransparent)
- return pdfium::nullopt;
+ return absl::nullopt;
return ArgbToColorRef(type_argb_pair.argb);
}
@@ -443,7 +443,7 @@
CFX_Color::TypeAndARGB type_argb_pair =
GetFormControl()->GetColorARGB(pdfium::appearance::kBC);
if (type_argb_pair.color_type == CFX_Color::Type::kTransparent)
- return pdfium::nullopt;
+ return absl::nullopt;
return ArgbToColorRef(type_argb_pair.argb);
}
@@ -453,10 +453,10 @@
Optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair = da.GetColorARGB();
if (!maybe_type_argb_pair.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
if (maybe_type_argb_pair.value().color_type == CFX_Color::Type::kTransparent)
- return pdfium::nullopt;
+ return absl::nullopt;
return ArgbToColorRef(maybe_type_argb_pair.value().argb);
}
@@ -612,7 +612,7 @@
break;
}
default:
- ResetAppearance(pdfium::nullopt, kValueUnchanged);
+ ResetAppearance(absl::nullopt, kValueUnchanged);
break;
}
}
@@ -662,7 +662,7 @@
void CPDFSDK_Widget::ResetFieldAppearance() {
CPDF_FormField* pFormField = GetFormField();
DCHECK(pFormField);
- m_pInteractiveForm->ResetFieldAppearance(pFormField, pdfium::nullopt);
+ m_pInteractiveForm->ResetFieldAppearance(pFormField, absl::nullopt);
}
void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 039e4bc..1be3709 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -64,7 +64,7 @@
auto pWidget = std::make_unique<CPDFSDK_Widget>(pAnnot, pPageView, pForm);
pForm->AddMap(pCtrl, pWidget.get());
if (pPDFForm->NeedConstructAP())
- pWidget->ResetAppearance(pdfium::nullopt, CPDFSDK_Widget::kValueUnchanged);
+ pWidget->ResetAppearance(absl::nullopt, CPDFSDK_Widget::kValueUnchanged);
return pWidget;
}
@@ -211,7 +211,7 @@
return;
if (!pWidget->IsAppearanceValid())
- pWidget->ResetAppearance(pdfium::nullopt, CPDFSDK_Widget::kValueUnchanged);
+ pWidget->ResetAppearance(absl::nullopt, CPDFSDK_Widget::kValueUnchanged);
FormFieldType fieldType = pWidget->GetFieldType();
if (fieldType == FormFieldType::kTextField ||
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index ce9c040..d0b0f50 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -385,7 +385,7 @@
options.bConsecutive = !!(flags & FPDF_CONSECUTIVE);
auto find = CPDF_TextPageFind::Create(
textpage, WideStringFromFPDFWideString(findwhat), options,
- start_index >= 0 ? Optional<size_t>(start_index) : pdfium::nullopt);
+ start_index >= 0 ? Optional<size_t>(start_index) : absl::nullopt);
// Caller takes ownership.
return FPDFSchHandleFromCPDFTextPageFind(find.release());
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 076232a..b329fcf 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -180,7 +180,7 @@
const CFX_PointF& device_point) const {
CXFA_FFPageView* pPageView = GetXFAPageView();
if (!m_pPDFPage && !pPageView)
- return pdfium::nullopt;
+ return absl::nullopt;
CFX_Matrix page2device = GetDisplayMatrix(rect, rotate);
return page2device.GetInverse().Transform(device_point);
@@ -192,7 +192,7 @@
const CFX_PointF& page_point) const {
CXFA_FFPageView* pPageView = GetXFAPageView();
if (!m_pPDFPage && !pPageView)
- return pdfium::nullopt;
+ return absl::nullopt;
CFX_Matrix page2device = GetDisplayMatrix(rect, rotate);
return page2device.Transform(page_point);
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index 49a7fc3..5395913 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -75,7 +75,7 @@
Optional<int32_t> CBC_ReedSolomonGF256::Inverse(int32_t a) {
if (a == 0)
- return pdfium::nullopt;
+ return absl::nullopt;
return m_expTable[255 - m_logTable[a]];
}
diff --git a/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
index 1bc8cd1..58f3cd0 100644
--- a/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
@@ -35,7 +35,7 @@
if (!FXSYS_IsDecimalDigit(digit1) || !FXSYS_IsDecimalDigit(digit2)) {
// This could potentially return 0 as a sentinel value. Then this function
// can just return wchar_t instead of Optional<wchar_t>.
- return pdfium::nullopt;
+ return absl::nullopt;
}
return static_cast<wchar_t>((digit1 - 48) * 10 + (digit2 - 48) + 130);
}
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
index d97a86c..987dccb 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
@@ -138,7 +138,7 @@
int32_t errorCorrectionLevel) {
int32_t k = GetErrorCorrectionCodewordCount(errorCorrectionLevel);
if (k < 0)
- return pdfium::nullopt;
+ return absl::nullopt;
std::vector<wchar_t, FxAllocAllocator<wchar_t>> ech(k);
size_t sld = dataCodewords.GetLength();
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index 12bcbf1..856cbb1 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -85,7 +85,7 @@
for (size_t i = 0; i < len; i++) {
wchar_t ch = bytes[i] & 0xff;
if (ch == '?' && bytes[i] != '?')
- return pdfium::nullopt;
+ return absl::nullopt;
result += ch;
}
@@ -117,7 +117,7 @@
Optional<size_t> b =
DetermineConsecutiveBinaryCount(result, bytes.raw_span(), p);
if (!b.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
size_t b_value = b.value();
if (b_value == 0)
@@ -382,7 +382,7 @@
return idx - startpos;
ch = msg[idx];
if (bytes[idx] == 63 && ch != '?')
- return pdfium::nullopt;
+ return absl::nullopt;
idx++;
}
return idx - startpos;
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 9428b5e..07241f3 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -263,7 +263,7 @@
maskPattern++) {
if (!CBC_QRCoderMatrixUtil::BuildMatrix(bits, ecLevel, version, maskPattern,
matrix)) {
- return pdfium::nullopt;
+ return absl::nullopt;
}
int32_t penalty = CalculateMaskPenalty(matrix);
if (penalty < minPenalty) {
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index 47efec9..af68a2e 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -587,7 +587,7 @@
std::tie(line, column) = GetLineAndColumnFromError(msg, context);
return IJS_Runtime::JS_Error(line, column, WideString::FromUTF8(*error));
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
v8::Local<v8::Object> CFXJS_Engine::NewFXJSBoundObject(uint32_t nObjDefnID,
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 70027fe..a2974e4 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -75,7 +75,7 @@
for (auto& pObserved : widgets) {
if (pObserved) {
auto* pWidget = ToCPDFSDKWidget(pObserved.Get());
- pWidget->ResetAppearance(pdfium::nullopt,
+ pWidget->ResetAppearance(absl::nullopt,
CPDFSDK_Widget::kValueUnchanged);
}
}
@@ -126,7 +126,7 @@
return;
pWidget->ResetAppearance(sValue, CPDFSDK_Widget::kValueUnchanged);
} else {
- pWidget->ResetAppearance(pdfium::nullopt,
+ pWidget->ResetAppearance(absl::nullopt,
CPDFSDK_Widget::kValueUnchanged);
}
if (!observed_widget)
@@ -159,14 +159,14 @@
++reverse_it;
}
if (reverse_it == field_name.rend()) {
- return pdfium::nullopt;
+ return absl::nullopt;
}
WideString suffixal = field_name.Last(reverse_it - field_name.rbegin());
int control_index = FXSYS_wtoi(suffixal.c_str());
if (control_index == 0) {
suffixal.TrimRight(L' ');
if (suffixal != L"0") {
- return pdfium::nullopt;
+ return absl::nullopt;
}
}
return FieldNameData(field_name.First(field_name.rend() - reverse_it - 1),
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 7a63656..dc481c4 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -222,7 +222,7 @@
return std::min(dValue1, dValue2);
if (FXSYS_wcsicmp(sFunction, L"MAX") == 0)
return std::max(dValue1, dValue2);
- return pdfium::nullopt;
+ return absl::nullopt;
}
} // namespace
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp
index fe5b1f6..39600fa 100644
--- a/fxjs/cjs_runtimestub.cpp
+++ b/fxjs/cjs_runtimestub.cpp
@@ -31,5 +31,5 @@
Optional<IJS_Runtime::JS_Error> CJS_RuntimeStub::ExecuteScript(
const WideString& script) {
- return pdfium::nullopt;
+ return absl::nullopt;
}
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 17ff87a..42c95da 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -670,7 +670,7 @@
Mask<XFA_ResolveFlag> dwStyles,
CXFA_Node* bindNode) {
if (wsExpression.IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
const bool bParentOrSiblings =
!!(dwStyles & Mask<XFA_ResolveFlag>{XFA_ResolveFlag::kParent,
@@ -831,12 +831,12 @@
result.type = ResolveResult::Type::kExistNodes;
if (result.objects.empty())
- return pdfium::nullopt;
+ return absl::nullopt;
return result;
}
if (nNodes == 0)
- return pdfium::nullopt;
+ return absl::nullopt;
return result;
}
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 30e3e82..e51d699 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -1458,7 +1458,7 @@
v8::Local<v8::Array> arr = src.As<v8::Array>();
uint32_t iLength = fxv8::GetArrayLengthHelper(arr);
if (iLength < 3)
- return pdfium::nullopt;
+ return absl::nullopt;
v8::Local<v8::Value> propertyValue =
fxv8::ReentrantGetArrayElementHelper(pIsolate, arr, 1);
@@ -1583,7 +1583,7 @@
bool bHasNoResolveName) {
CXFA_Document* pDoc = ToFormCalcContext(pHostObject)->GetDocument();
if (!pDoc)
- return pdfium::nullopt;
+ return absl::nullopt;
v8::Isolate* pIsolate = ToFormCalcContext(pHostObject)->GetIsolate();
WideString wsSomExpression = WideString::FromUTF8(bsSomExp);
@@ -1597,7 +1597,7 @@
} else {
pNode = CFXJSE_Engine::ToObject(pIsolate, pRefValue);
if (!pNode)
- return pdfium::nullopt;
+ return absl::nullopt;
if (bHasNoResolveName) {
WideString wsName;
@@ -5301,15 +5301,15 @@
CXFA_FMParser parser(pHeap, &lexer);
CXFA_FMAST* ast = parser.Parse();
if (!ast || parser.HasError())
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_FMToJavaScriptDepth::Reset();
Optional<CFX_WideTextBuf> wsJavaScript = ast->ToJavaScript();
if (!wsJavaScript.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
if (CXFA_IsTooBig(wsJavaScript.value()))
- return pdfium::nullopt;
+ return absl::nullopt;
return wsJavaScript;
}
diff --git a/fxjs/xfa/cfxjse_mapmodule.cpp b/fxjs/xfa/cfxjse_mapmodule.cpp
index 2f60054..e2344082 100644
--- a/fxjs/xfa/cfxjse_mapmodule.cpp
+++ b/fxjs/xfa/cfxjse_mapmodule.cpp
@@ -35,14 +35,14 @@
Optional<int32_t> CFXJSE_MapModule::GetValue(uint32_t key) const {
auto it = m_ValueMap.find(key);
if (it == m_ValueMap.end())
- return pdfium::nullopt;
+ return absl::nullopt;
return it->second;
}
Optional<WideString> CFXJSE_MapModule::GetString(uint32_t key) const {
auto it = m_StringMap.find(key);
if (it == m_StringMap.end())
- return pdfium::nullopt;
+ return absl::nullopt;
return it->second;
}
@@ -50,7 +50,7 @@
uint32_t key) const {
auto it = m_MeasurementMap.find(key);
if (it == m_MeasurementMap.end())
- return pdfium::nullopt;
+ return absl::nullopt;
return it->second;
}
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 0f99bc5..0c8e5fe 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -268,7 +268,7 @@
case XFA_AttributeType::Enum: {
Optional<XFA_AttributeValue> value = TryEnum(eAttr, bUseDefault);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return WideString::FromASCII(XFA_AttributeValueToName(value.value()));
}
case XFA_AttributeType::CData:
@@ -277,25 +277,25 @@
case XFA_AttributeType::Boolean: {
Optional<bool> value = TryBoolean(eAttr, bUseDefault);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return WideString(value.value() ? L"1" : L"0");
}
case XFA_AttributeType::Integer: {
Optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
if (!iValue.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return WideString::Format(L"%d", iValue.value());
}
case XFA_AttributeType::Measure: {
Optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return value->ToString();
}
default:
break;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
void CJX_Object::RemoveAttribute(WideStringView wsAttr) {
@@ -309,7 +309,7 @@
if (value.has_value())
return !!value.value();
if (!bUseDefault)
- return pdfium::nullopt;
+ return absl::nullopt;
return GetXFANode()->GetDefaultBoolean(eAttr);
}
@@ -344,7 +344,7 @@
if (value.has_value())
return value.value();
if (!bUseDefault)
- return pdfium::nullopt;
+ return absl::nullopt;
return GetXFANode()->GetDefaultInteger(eAttr);
}
@@ -355,7 +355,7 @@
if (value.has_value())
return static_cast<XFA_AttributeValue>(value.value());
if (!bUseDefault)
- return pdfium::nullopt;
+ return absl::nullopt;
return GetXFANode()->GetDefaultEnum(eAttr);
}
@@ -394,14 +394,14 @@
if (result.has_value())
return result.value();
if (!bUseDefault)
- return pdfium::nullopt;
+ return absl::nullopt;
return GetXFANode()->GetDefaultMeasurement(eAttr);
}
Optional<float> CJX_Object::TryMeasureAsFloat(XFA_Attribute attr) const {
Optional<CXFA_Measurement> measure = TryMeasure(attr, false);
if (!measure.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return measure->ToUnit(XFA_Unit::Pt);
}
@@ -495,7 +495,7 @@
return value;
if (!bUseDefault)
- return pdfium::nullopt;
+ return absl::nullopt;
return GetXFANode()->GetDefaultCData(eAttr);
}
@@ -692,7 +692,7 @@
CXFA_Value* pValue =
GetXFANode()->GetChild<CXFA_Value>(0, XFA_Element::Value, false);
if (!pValue)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Node* pChildValue = pValue->GetFirstChild();
if (pChildValue && XFA_FieldIsMultiListBox(GetXFANode())) {
@@ -700,7 +700,7 @@
XFA_Attribute::ContentType, L"text/xml", false);
}
if (!pChildValue)
- return pdfium::nullopt;
+ return absl::nullopt;
return pChildValue->JSObject()->TryContent(bScriptModify, bProto);
}
break;
@@ -740,7 +740,7 @@
}
return TryCData(XFA_Attribute::Value, false);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<WideString> CJX_Object::TryNamespace() const {
@@ -749,7 +749,7 @@
CFX_XMLNode* pXMLNode = GetXFANode()->GetXMLMappingNode();
CFX_XMLElement* element = ToXMLElement(pXMLNode);
if (!element)
- return pdfium::nullopt;
+ return absl::nullopt;
return element->GetNamespaceURI();
}
@@ -760,14 +760,14 @@
CFX_XMLNode* pXMLNode = GetXFANode()->GetXMLMappingNode();
CFX_XMLElement* element = ToXMLElement(pXMLNode);
if (!element)
- return pdfium::nullopt;
+ return absl::nullopt;
if (GetXFANode()->GetElementType() == XFA_Element::DataValue &&
GetEnum(XFA_Attribute::Contains) == XFA_AttributeValue::MetaData) {
WideString wsNamespace;
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
element, GetCData(XFA_Attribute::QualifiedName), &wsNamespace)) {
- return pdfium::nullopt;
+ return absl::nullopt;
}
return wsNamespace;
}
@@ -811,14 +811,14 @@
Optional<int32_t> CJX_Object::GetMapModuleValue(uint32_t key) const {
CFXJSE_MapModule* pModule = GetMapModule();
if (!pModule)
- return pdfium::nullopt;
+ return absl::nullopt;
return pModule->GetValue(key);
}
Optional<WideString> CJX_Object::GetMapModuleString(uint32_t key) const {
CFXJSE_MapModule* pModule = GetMapModule();
if (!pModule)
- return pdfium::nullopt;
+ return absl::nullopt;
return pModule->GetString(key);
}
@@ -826,7 +826,7 @@
uint32_t key) const {
CFXJSE_MapModule* pModule = GetMapModule();
if (!pModule)
- return pdfium::nullopt;
+ return absl::nullopt;
return pModule->GetMeasurement(key);
}
@@ -845,7 +845,7 @@
if (pNode->GetPacketType() == XFA_PacketType::Datasets)
break;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<WideString> CJX_Object::GetMapModuleStringFollowingChain(
@@ -863,7 +863,7 @@
if (pNode->GetPacketType() == XFA_PacketType::Datasets)
break;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<CXFA_Measurement> CJX_Object::GetMapModuleMeasurementFollowingChain(
@@ -882,7 +882,7 @@
if (pNode->GetPacketType() == XFA_PacketType::Datasets)
break;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
bool CJX_Object::HasMapModuleKey(uint32_t key) const {
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 4414a80..36db5ff 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -203,7 +203,7 @@
// No custom font path. Use default.
if (options.font_directory.empty())
- return pdfium::nullopt;
+ return absl::nullopt;
// Set custom font path to |options.font_directory|.
return options.font_directory.c_str();
diff --git a/third_party/base/optional.h b/third_party/base/optional.h
index f308335..6b16db5 100644
--- a/third_party/base/optional.h
+++ b/third_party/base/optional.h
@@ -7,14 +7,6 @@
#include "third_party/abseil-cpp/absl/types/optional.h"
-namespace pdfium {
-
-using absl::make_optional;
-using absl::nullopt;
-using absl::nullopt_t;
-
-} // namespace pdfium
-
template <class T>
using Optional = absl::optional<T>;
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index c54a61e..bdbc5e8 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -161,16 +161,16 @@
int32_t glyph;
std::tie(glyph, pFont) = GetGlyphIndexAndFont(wUnicode, true);
if (!pFont || glyph == 0xffff) {
- m_CharWidthMap[wUnicode] = pdfium::nullopt;
- return pdfium::nullopt;
+ m_CharWidthMap[wUnicode] = absl::nullopt;
+ return absl::nullopt;
}
if (pFont != this)
return pFont->GetCharWidth(wUnicode);
int32_t width_from_cfx_font = m_pFont->GetGlyphWidth(glyph);
if (width_from_cfx_font < 0) {
- m_CharWidthMap[wUnicode] = pdfium::nullopt;
- return pdfium::nullopt;
+ m_CharWidthMap[wUnicode] = absl::nullopt;
+ return absl::nullopt;
}
uint16_t width = static_cast<uint16_t>(width_from_cfx_font);
m_CharWidthMap[wUnicode] = width;
@@ -186,7 +186,7 @@
int32_t iGlyph;
std::tie(iGlyph, pFont) = GetGlyphIndexAndFont(wUnicode, true);
if (!pFont || iGlyph == 0xFFFF)
- return pdfium::nullopt;
+ return absl::nullopt;
if (pFont.Get() != this)
return pFont->GetCharBBox(wUnicode);
diff --git a/xfa/fgas/layout/fgas_arabic.cpp b/xfa/fgas/layout/fgas_arabic.cpp
index 0242e39..1f71759 100644
--- a/xfa/fgas/layout/fgas_arabic.cpp
+++ b/xfa/fgas/layout/fgas_arabic.cpp
@@ -214,7 +214,7 @@
Optional<wchar_t> GetArabicFromShaddaTable(wchar_t shadda) {
if (shadda < kFirstShaddaTableEntry || shadda > kLastShaddaTableEntry)
- return pdfium::nullopt;
+ return absl::nullopt;
return kShaddaTable[shadda - kFirstShaddaTableEntry];
}
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index f9bae92..d13fc55 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -206,14 +206,14 @@
Optional<WideString> CFWL_Edit::Copy() {
if (!m_pEditEngine->HasSelection())
- return pdfium::nullopt;
+ return absl::nullopt;
return m_pEditEngine->GetSelectedText();
}
Optional<WideString> CFWL_Edit::Cut() {
if (!m_pEditEngine->HasSelection())
- return pdfium::nullopt;
+ return absl::nullopt;
WideString cut_text = m_pEditEngine->DeleteSelectedText();
UpdateCaret();
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 456441d..ba9e741 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -98,7 +98,7 @@
return BC_CHAR_ENCODING::kUnicode;
if (value.CompareNoCase(L"UTF-8"))
return BC_CHAR_ENCODING::kUTF8;
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<BC_TEXT_LOC> TextLocFromAttribute(XFA_AttributeValue value) {
@@ -114,7 +114,7 @@
case XFA_AttributeValue::BelowEmbedded:
return BC_TEXT_LOC::kBelowEmbed;
default:
- return pdfium::nullopt;
+ return absl::nullopt;
}
}
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index 0ba8742..bda6163 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -260,7 +260,7 @@
Optional<WideString> CXFA_FFComboBox::Cut() {
if (!m_pNode->IsChoiceListAllowTextEntry())
- return pdfium::nullopt;
+ return absl::nullopt;
return ToComboBox(GetNormalWidget())->EditCut();
}
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 2928913..01008bf 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -509,11 +509,11 @@
}
Optional<WideString> CXFA_FFWidget::Copy() {
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<WideString> CXFA_FFWidget::Cut() {
- return pdfium::nullopt;
+ return absl::nullopt;
}
bool CXFA_FFWidget::Paste(const WideString& wsPaste) {
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 227c044..e98f7be 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -504,15 +504,15 @@
const CXFA_TextProvider* pTextProvider,
const CFX_XMLNode* pXMLNode) {
if (!pXMLNode)
- return pdfium::nullopt;
+ return absl::nullopt;
const CFX_XMLElement* pElement = ToXMLElement(pXMLNode);
if (!pElement)
- return pdfium::nullopt;
+ return absl::nullopt;
WideString wsAttr = pElement->GetAttribute(L"xfa:embed");
if (wsAttr.IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
if (wsAttr[0] == L'#')
wsAttr.Delete(0);
@@ -520,12 +520,12 @@
WideString ws =
GetLowerCaseElementAttributeOrDefault(pElement, L"xfa:embedType", L"som");
if (!ws.EqualsASCII("uri"))
- return pdfium::nullopt;
+ return absl::nullopt;
ws = GetLowerCaseElementAttributeOrDefault(pElement, L"xfa:embedMode",
L"formatted");
if (!(ws.EqualsASCII("raw") || ws.EqualsASCII("formatted")))
- return pdfium::nullopt;
+ return absl::nullopt;
return pTextProvider->GetEmbeddedObj(wsAttr);
}
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 58f8494..f93b788 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -133,7 +133,7 @@
Optional<WideString> CXFA_TextProvider::GetEmbeddedObj(
const WideString& wsAttr) const {
if (m_eType != Type::kText)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Node* pParent = m_pNode->GetParent();
CXFA_Document* pDocument = m_pNode->GetDocument();
@@ -147,7 +147,7 @@
wsAttr.AsStringView());
}
if (!pIDNode || !pIDNode->IsWidgetReady())
- return pdfium::nullopt;
+ return absl::nullopt;
return pIDNode->GetValue(XFA_ValuePicture::kDisplay);
}
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index cdec1ab..da7cd40 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -796,13 +796,13 @@
? CXFA_FMAssignExpression::ReturnType::kImplied
: CXFA_FMAssignExpression::ReturnType::kInferred;
if (!expr->ToJavaScript(&js, ret_type))
- return pdfium::nullopt;
+ return absl::nullopt;
}
js << "return pfm_rt.get_val(pfm_ret);\n";
js << "}).call(this);";
if (CXFA_IsTooBig(js))
- return pdfium::nullopt;
+ return absl::nullopt;
return js;
}
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index 33ec838..1625d2b 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -803,7 +803,7 @@
Optional<std::vector<cppgc::Member<CXFA_FMSimpleExpression>>>
CXFA_FMParser::ParseArgumentList() {
if (m_token.m_type != TOKlparen || !NextToken())
- return pdfium::nullopt;
+ return absl::nullopt;
std::vector<cppgc::Member<CXFA_FMSimpleExpression>> expressions;
bool first_arg = true;
@@ -812,16 +812,16 @@
first_arg = false;
} else {
if (m_token.m_type != TOKcomma || !NextToken())
- return pdfium::nullopt;
+ return absl::nullopt;
}
CXFA_FMSimpleExpression* exp = ParseSimpleExpression();
if (!exp)
- return pdfium::nullopt;
+ return absl::nullopt;
expressions.push_back(exp);
if (expressions.size() > kMaxPostExpressions)
- return pdfium::nullopt;
+ return absl::nullopt;
}
return expressions;
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
index 878821d..ebe30d5 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
@@ -429,7 +429,7 @@
break;
}
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
@@ -944,21 +944,21 @@
m_pKeepHeadNode = *pNextContainer;
m_bIsProcessKeep = true;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
if (!m_bIsProcessKeep || !m_pKeepHeadNode) {
if (m_bKeepBreakFinish)
*pLastKeepNode = true;
m_bKeepBreakFinish = false;
- return pdfium::nullopt;
+ return absl::nullopt;
}
m_pKeepTailNode = *pNextContainer;
if (m_bKeepBreakFinish) {
*pNextContainer = m_pKeepHeadNode;
ProcessKeepNodesEnd();
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<Stage> ret =
@@ -966,7 +966,7 @@
if (!ret.has_value()) {
*pNextContainer = m_pKeepHeadNode;
ProcessKeepNodesEnd();
- return pdfium::nullopt;
+ return absl::nullopt;
}
return ret;
@@ -2672,7 +2672,7 @@
CXFA_ContentLayoutProcessor::HandleKeep(CXFA_Node* pBreakAfterNode,
CXFA_Node** pCurActionNode) {
if (m_bKeepBreakFinish)
- return pdfium::nullopt;
+ return absl::nullopt;
return FindBreakNode(pBreakAfterNode, false, pCurActionNode);
}
@@ -2692,14 +2692,14 @@
break;
}
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<CXFA_ContentLayoutProcessor::Stage>
CXFA_ContentLayoutProcessor::HandleBreakBefore(CXFA_Node* pChildContainer,
CXFA_Node** pCurActionNode) {
if (!*pCurActionNode)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Node* pBreakBeforeNode = (*pCurActionNode)->GetNextSibling();
if (!m_bKeepBreakFinish) {
@@ -2741,7 +2741,7 @@
DeleteLayoutGeneratedNode(pSaveNode);
}
if (!pNextChildContainer)
- return pdfium::nullopt;
+ return absl::nullopt;
bool bLastKeep = false;
Optional<Stage> ret = ProcessKeepNodesForCheckNext(
@@ -2775,7 +2775,7 @@
break;
}
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
void CXFA_ContentLayoutProcessor::ProcessKeepNodesEnd() {
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index 674771d..b6e864c 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -232,7 +232,7 @@
pNode->ClearFlag(XFA_NodeFlag::kUnusedNode);
}
-// Note: Returning nullptr is not the same as returning pdfium::nullopt.
+// Note: Returning nullptr is not the same as returning absl::nullopt.
Optional<CXFA_ViewLayoutItem*> CheckContentAreaNotUsed(
CXFA_ViewLayoutItem* pPageAreaLayoutItem,
CXFA_Node* pContentArea) {
@@ -242,7 +242,7 @@
if (pLayoutItem && pLayoutItem->GetFormNode() == pContentArea) {
if (!pLayoutItem->GetFirstChild())
return pLayoutItem;
- return pdfium::nullopt;
+ return absl::nullopt;
}
}
return nullptr;
@@ -894,7 +894,7 @@
bool bBefore) {
CXFA_Node* pFormNode = pBreakNode->GetContainerParent();
if (!pFormNode->PresenceRequiresSpace())
- return pdfium::nullopt;
+ return absl::nullopt;
BreakData break_data = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore);
CXFA_Document* pDocument = pBreakNode->GetDocument();
@@ -902,20 +902,20 @@
pFormNode = pFormNode->GetContainerParent();
if (break_data.pLeader) {
if (!break_data.pLeader->IsContainerNode())
- return pdfium::nullopt;
+ return absl::nullopt;
pDataScope = XFA_DataMerge_FindDataScope(pFormNode);
break_data.pLeader = pDocument->DataMerge_CopyContainer(
break_data.pLeader, pFormNode, pDataScope, true, true, true);
if (!break_data.pLeader)
- return pdfium::nullopt;
+ return absl::nullopt;
pDocument->DataMerge_UpdateBindingRelations(break_data.pLeader);
SetLayoutGeneratedNodeFlag(break_data.pLeader);
}
if (break_data.pTrailer) {
if (!break_data.pTrailer->IsContainerNode())
- return pdfium::nullopt;
+ return absl::nullopt;
if (!pDataScope)
pDataScope = XFA_DataMerge_FindDataScope(pFormNode);
@@ -923,7 +923,7 @@
break_data.pTrailer = pDocument->DataMerge_CopyContainer(
break_data.pTrailer, pFormNode, pDataScope, true, true, true);
if (!break_data.pTrailer)
- return pdfium::nullopt;
+ return absl::nullopt;
pDocument->DataMerge_UpdateBindingRelations(break_data.pTrailer);
SetLayoutGeneratedNodeFlag(break_data.pTrailer);
@@ -1047,7 +1047,7 @@
CXFA_ViewLayoutProcessor::ProcessOverflow(CXFA_Node* pFormNode,
bool bCreatePage) {
if (!pFormNode)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Node* pLeaderTemplate = nullptr;
CXFA_Node* pTrailerTemplate = nullptr;
@@ -1070,7 +1070,7 @@
overflow_data.pLeader = pDocument->DataMerge_CopyContainer(
pLeaderTemplate, pFormNode, pDataScope, true, true, true);
if (!overflow_data.pLeader)
- return pdfium::nullopt;
+ return absl::nullopt;
pDocument->DataMerge_UpdateBindingRelations(overflow_data.pLeader);
SetLayoutGeneratedNodeFlag(overflow_data.pLeader);
@@ -1082,7 +1082,7 @@
overflow_data.pTrailer = pDocument->DataMerge_CopyContainer(
pTrailerTemplate, pFormNode, pDataScope, true, true, true);
if (!overflow_data.pTrailer)
- return pdfium::nullopt;
+ return absl::nullopt;
pDocument->DataMerge_UpdateBindingRelations(overflow_data.pTrailer);
SetLayoutGeneratedNodeFlag(overflow_data.pTrailer);
@@ -1092,7 +1092,7 @@
if (bIsOverflowNode)
break;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
CXFA_Node* CXFA_ViewLayoutProcessor::ResolveBookendLeaderOrTrailer(
diff --git a/xfa/fxfa/parser/cxfa_barcode.cpp b/xfa/fxfa/parser/cxfa_barcode.cpp
index 1139c30..dd1efba 100644
--- a/xfa/fxfa/parser/cxfa_barcode.cpp
+++ b/xfa/fxfa/parser/cxfa_barcode.cpp
@@ -72,7 +72,7 @@
Optional<XFA_AttributeValue> checksum =
JSObject()->TryEnum(XFA_Attribute::Checksum, true);
if (!checksum.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
switch (checksum.value()) {
case XFA_AttributeValue::None:
@@ -85,14 +85,14 @@
default:
break;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
Optional<int32_t> CXFA_Barcode::GetDataLength() {
Optional<WideString> wsDataLength =
JSObject()->TryCData(XFA_Attribute::DataLength, true);
if (!wsDataLength.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return FXSYS_wtoi(wsDataLength->c_str());
}
@@ -101,7 +101,7 @@
Optional<WideString> wsStartEndChar =
JSObject()->TryCData(XFA_Attribute::StartChar, true);
if (!wsStartEndChar.has_value() || wsStartEndChar->IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
return static_cast<char>(wsStartEndChar.value()[0]);
}
@@ -110,7 +110,7 @@
Optional<WideString> wsStartEndChar =
JSObject()->TryCData(XFA_Attribute::EndChar, true);
if (!wsStartEndChar.has_value() || wsStartEndChar->IsEmpty())
- return pdfium::nullopt;
+ return absl::nullopt;
return static_cast<char>(wsStartEndChar.value()[0]);
}
@@ -119,7 +119,7 @@
Optional<WideString> wsECLevel =
JSObject()->TryCData(XFA_Attribute::ErrorCorrectionLevel, true);
if (!wsECLevel.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return FXSYS_wtoi(wsECLevel->c_str());
}
@@ -127,7 +127,7 @@
Optional<CXFA_Measurement> moduleWidthHeight =
JSObject()->TryMeasure(XFA_Attribute::ModuleWidth, true);
if (!moduleWidthHeight.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt));
}
@@ -136,7 +136,7 @@
Optional<CXFA_Measurement> moduleWidthHeight =
JSObject()->TryMeasure(XFA_Attribute::ModuleHeight, true);
if (!moduleWidthHeight.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt));
}
@@ -157,7 +157,7 @@
Optional<WideString> wsWideNarrowRatio =
JSObject()->TryCData(XFA_Attribute::WideNarrowRatio, true);
if (!wsWideNarrowRatio.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
Optional<size_t> ptPos = wsWideNarrowRatio->Find(':');
if (!ptPos.has_value())
diff --git a/xfa/fxfa/parser/cxfa_document_builder.cpp b/xfa/fxfa/parser/cxfa_document_builder.cpp
index 36bafa2..db4bdbc 100644
--- a/xfa/fxfa/parser/cxfa_document_builder.cpp
+++ b/xfa/fxfa/parser/cxfa_document_builder.cpp
@@ -122,7 +122,7 @@
}
return it.second;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
CFX_XMLNode* GetDataSetsFromXDP(CFX_XMLNode* pXMLDocumentNode) {
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index c285580..64cb174 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1162,7 +1162,7 @@
if (prop.flags & flag)
return prop.property;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
const CXFA_Node::AttributeData* CXFA_Node::GetAttributeData(
@@ -1416,12 +1416,12 @@
Optional<WideString> CXFA_Node::GetLocaleName() {
CXFA_Node* pForm = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form));
if (!pForm)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Subform* pTopSubform =
pForm->GetFirstChildByClass<CXFA_Subform>(XFA_Element::Subform);
if (!pTopSubform)
- return pdfium::nullopt;
+ return absl::nullopt;
Optional<WideString> localeName;
CXFA_Node* pLocaleNode = this;
@@ -1448,7 +1448,7 @@
LocaleIface* pLocale = GetDocument()->GetLocaleMgr()->GetDefLocale();
if (!pLocale)
- return pdfium::nullopt;
+ return absl::nullopt;
return pLocale->GetName();
}
@@ -2035,14 +2035,14 @@
Optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {
Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Boolean);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return !!value.value();
}
Optional<int32_t> CXFA_Node::GetDefaultInteger(XFA_Attribute attr) const {
Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Integer);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return static_cast<int32_t>(reinterpret_cast<uintptr_t>(value.value()));
}
@@ -2050,7 +2050,7 @@
XFA_Attribute attr) const {
Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Measure);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
WideString str = WideString(static_cast<const wchar_t*>(value.value()));
return CXFA_Measurement(str.AsStringView());
@@ -2059,7 +2059,7 @@
Optional<WideString> CXFA_Node::GetDefaultCData(XFA_Attribute attr) const {
Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::CData);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return WideString(static_cast<const wchar_t*>(value.value()));
}
@@ -2068,7 +2068,7 @@
XFA_Attribute attr) const {
Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Enum);
if (!value.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
return static_cast<XFA_AttributeValue>(
reinterpret_cast<uintptr_t>(value.value()));
}
@@ -2077,7 +2077,7 @@
XFA_AttributeType eType) const {
const AttributeData* data = GetAttributeData(attr);
if (!data || data->type != eType)
- return pdfium::nullopt;
+ return absl::nullopt;
return data->default_value;
}
@@ -2340,7 +2340,7 @@
Optional<XFA_AttributeValue> intact =
pKeep->JSObject()->TryEnum(XFA_Attribute::Intact, false);
if (!intact.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
if (intact.value() != XFA_AttributeValue::None ||
eLayoutType != XFA_AttributeValue::Row ||
@@ -3582,7 +3582,7 @@
size_t szBlockIndex,
float fCalcHeight) {
if (GetFFWidgetType() == XFA_FFWidgetType::kSubform)
- return pdfium::nullopt;
+ return absl::nullopt;
switch (GetFFWidgetType()) {
case XFA_FFWidgetType::kText:
@@ -3621,7 +3621,7 @@
if (szBlockIndex == 0)
fCalcHeight += fTopInset;
if (fabs(fHeight - fCalcHeight) < kXFAWidgetPrecision)
- return pdfium::nullopt;
+ return absl::nullopt;
}
return fCalcHeight;
}
@@ -3662,14 +3662,14 @@
std::vector<float>* pFieldArray = &pFieldData->m_FieldSplitArray;
size_t szFieldSplitCount = pFieldArray->size();
if (szFieldSplitCount < szBlockIndex * 3)
- return pdfium::nullopt;
+ return absl::nullopt;
for (size_t i = 0; i < szBlockIndex * 3; i += 3) {
iLinesCount -= static_cast<int32_t>((*pFieldArray)[i + 1]);
fHeight -= (*pFieldArray)[i + 2];
}
if (iLinesCount == 0)
- return pdfium::nullopt;
+ return absl::nullopt;
float fLineHeight = GetLineHeight();
float fFontSize = GetFontSize();
@@ -3746,7 +3746,7 @@
pFieldArray->push_back(0);
pFieldArray->push_back(fCalcHeight);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
if (fCalcHeight - fStartOffset < fLineHeight) {
@@ -3774,7 +3774,7 @@
pFieldArray->push_back(iLinesCount);
pFieldArray->push_back(fCalcHeight);
}
- return pdfium::nullopt;
+ return absl::nullopt;
}
if (fHeight - fStartOffset - fTextHeight < fFontSize) {
iLineNum -= 1;
@@ -3796,7 +3796,7 @@
pFieldArray->push_back(fSplitHeight);
}
if (fabs(fSplitHeight - fCalcHeight) < kXFAWidgetPrecision)
- return pdfium::nullopt;
+ return absl::nullopt;
return fSplitHeight;
}
@@ -4223,7 +4223,7 @@
break;
}
if (iCount == 0)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Node* pItems = pItemsArray[0];
if (iCount > 1) {
@@ -4235,12 +4235,12 @@
pItems = pItemsArray[1];
}
if (!pItems)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Node* pItem =
pItems->GetChild<CXFA_Node>(nIndex, XFA_Element::Unknown, false);
if (!pItem)
- return pdfium::nullopt;
+ return absl::nullopt;
return pItem->JSObject()->GetContent(false);
}
@@ -4601,11 +4601,11 @@
Optional<int32_t> CXFA_Node::GetNumberOfCells() {
CXFA_Node* pUIChild = GetUIChildNode();
if (!pUIChild)
- return pdfium::nullopt;
+ return absl::nullopt;
CXFA_Comb* pNode = pUIChild->GetChild<CXFA_Comb>(0, XFA_Element::Comb, false);
if (!pNode)
- return pdfium::nullopt;
+ return absl::nullopt;
return pNode->JSObject()->GetInteger(XFA_Attribute::NumberOfCells);
}
diff --git a/xfa/fxfa/parser/xfa_basic_data.cpp b/xfa/fxfa/parser/xfa_basic_data.cpp
index 8434831..4be2101 100644
--- a/xfa/fxfa/parser/xfa_basic_data.cpp
+++ b/xfa/fxfa/parser/xfa_basic_data.cpp
@@ -172,7 +172,7 @@
[](const PacketTableRecord& a, uint32_t hash) { return a.hash < hash; });
if (elem != std::end(kPacketTable) && wsName.EqualsASCII(elem->info.name))
return elem->info;
- return pdfium::nullopt;
+ return absl::nullopt;
}
ByteStringView XFA_ElementToName(XFA_Element elem) {
@@ -202,11 +202,11 @@
std::begin(kAttributeRecords), std::end(kAttributeRecords), hash,
[](const AttributeRecord& a, uint32_t hash) { return a.hash < hash; });
if (elem == std::end(kAttributeRecords))
- return pdfium::nullopt;
+ return absl::nullopt;
size_t index = std::distance(std::begin(kAttributeRecords), elem);
if (!name.EqualsASCII(kAttributeNames[index]))
- return pdfium::nullopt;
+ return absl::nullopt;
XFA_ATTRIBUTEINFO result;
result.attribute = elem->attribute;
@@ -226,11 +226,11 @@
return arg.uHash < hash;
});
if (it == std::end(kAttributeValueRecords))
- return pdfium::nullopt;
+ return absl::nullopt;
size_t index = std::distance(std::begin(kAttributeValueRecords), it);
if (!name.EqualsASCII(kAttributeValueNames[index]))
- return pdfium::nullopt;
+ return absl::nullopt;
return it->eName;
}
@@ -240,7 +240,7 @@
WideStringView attribute_name) {
Optional<XFA_ATTRIBUTEINFO> attr = XFA_GetAttributeByName(attribute_name);
if (!attr.has_value())
- return pdfium::nullopt;
+ return absl::nullopt;
while (element != XFA_Element::Unknown) {
auto compound_key = std::make_pair(element, attr.value().attribute);
@@ -262,5 +262,5 @@
}
element = kElementRecords[static_cast<size_t>(element)].parent;
}
- return pdfium::nullopt;
+ return absl::nullopt;
}