Add NOTREACHED() in RenderDeviceDriverIface::GetDeviceCaps() impls.
GetDeviceCaps() should never receive an invalid |caps_id|, so annotate
the handlers for that case with NOTREACHED().
Change-Id: I4f2d9ee96153c1209cea4ba539907a94fcc169f8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56590
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index fde42bb..8569208 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1195,6 +1195,7 @@
return flags;
}
default:
+ NOTREACHED();
return 0;
}
}
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index c5b7ca0..faad434 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1707,6 +1707,7 @@
switch (caps_id) {
case FXDC_DEVICE_CLASS:
return FXDC_DISPLAY;
+
#ifdef _SKIA_SUPPORT_
case FXDC_PIXEL_WIDTH:
return m_pCanvas->imageInfo().width();
@@ -1751,8 +1752,11 @@
return flags;
}
#endif // _SKIA_SUPPORT_PATHS_
+
+ default:
+ NOTREACHED();
+ return 0;
}
- return 0;
}
void CFX_SkiaDeviceDriver::SaveState() {
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 6968e88..c373dad 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -403,8 +403,10 @@
return m_HorzSize;
case FXDC_VERT_SIZE:
return m_VertSize;
+ default:
+ NOTREACHED();
+ return 0;
}
- return 0;
}
bool CPSPrinterDriver::StartRendering() {
@@ -541,8 +543,10 @@
return m_HorzSize;
case FXDC_VERT_SIZE:
return m_VertSize;
+ default:
+ NOTREACHED();
+ return 0;
}
- return 0;
}
bool CTextOnlyPrinterDriver::SetClip_PathFill(const CFX_PathData* pPathData,