Use NOTREACHED_NORETURN() in core/fpdfapi/page
Bug: pdfium:2008
Change-Id: Iff12165dd780b5abdd85f0793d4bbc721b27b543
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/105490
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 0b550f5..9d94acd 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -550,8 +550,7 @@
case Family::kDeviceCMYK:
return 4;
default:
- NOTREACHED();
- return 4;
+ NOTREACHED_NORETURN();
}
}
@@ -1070,8 +1069,7 @@
return GetStockCS(Family::kDeviceRGB);
if (nComponents == 4)
return GetStockCS(Family::kDeviceCMYK);
- NOTREACHED();
- return nullptr;
+ NOTREACHED_NORETURN();
}
// static
diff --git a/core/fpdfapi/page/cpdf_devicecs.cpp b/core/fpdfapi/page/cpdf_devicecs.cpp
index 0fad1b1..5590c5b 100644
--- a/core/fpdfapi/page/cpdf_devicecs.cpp
+++ b/core/fpdfapi/page/cpdf_devicecs.cpp
@@ -40,8 +40,7 @@
std::set<const CPDF_Object*>* pVisited) {
// Unlike other classes that inherit from CPDF_ColorSpace, CPDF_DeviceCS is
// never loaded by CPDF_ColorSpace.
- NOTREACHED();
- return 0;
+ NOTREACHED_NORETURN();
}
bool CPDF_DeviceCS::GetRGB(pdfium::span<const float> pBuf,
@@ -72,8 +71,7 @@
}
return true;
default:
- NOTREACHED();
- return false;
+ NOTREACHED_NORETURN();
}
}
@@ -141,7 +139,6 @@
}
break;
default:
- NOTREACHED();
- break;
+ NOTREACHED_NORETURN();
}
}
diff --git a/core/fpdfapi/page/cpdf_patterncs.cpp b/core/fpdfapi/page/cpdf_patterncs.cpp
index cae8f49..7abc0b2 100644
--- a/core/fpdfapi/page/cpdf_patterncs.cpp
+++ b/core/fpdfapi/page/cpdf_patterncs.cpp
@@ -45,8 +45,7 @@
float* R,
float* G,
float* B) const {
- NOTREACHED();
- return false;
+ NOTREACHED_NORETURN();
}
const CPDF_PatternCS* CPDF_PatternCS::AsPatternCS() const {
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index 95f3ea3..da7b00d 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -110,8 +110,7 @@
if (m_op == PSOP_CONST)
return m_value;
- NOTREACHED();
- return 0;
+ NOTREACHED_NORETURN();
}
bool CPDF_PSEngine::Execute() {
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index 00f5a03..9d26ba9 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -120,8 +120,7 @@
break;
}
default: {
- NOTREACHED();
- return false;
+ NOTREACHED_NORETURN();
}
}
@@ -148,10 +147,8 @@
ValidateFunctions(nNumColorSpaceComponents, 1, 1);
}
default:
- break;
+ NOTREACHED_NORETURN();
}
- NOTREACHED();
- return false;
}
bool CPDF_ShadingPattern::ValidateFunctions(
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index c7c2911..4226754 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -354,8 +354,7 @@
if (param.m_Type == ContentParam::Type::kObject)
return param.m_pObject;
- NOTREACHED();
- return nullptr;
+ NOTREACHED_NORETURN();
}
ByteString CPDF_StreamContentParser::GetString(uint32_t index) const {