Use NOTREACHED() in more switch statements inside cpdf_dib.cpp

Change some switch statements with exhaustive cases to explicitly mark
the unreachable portion as NOTREACHED(), as suggested in
https://abseil.io/tips/147. Also sort the cases to better match the
order they are declared in.

Change-Id: I9962da84315efd95954640886f101f6202975ec1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/134211
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index 6d10782..ed153fe 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -40,6 +40,7 @@
 #include "core/fxcrt/data_vector.h"
 #include "core/fxcrt/fx_memcpy_wrappers.h"
 #include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/notreached.h"
 #include "core/fxcrt/span_util.h"
 #include "core/fxcrt/stl_util.h"
 #include "core/fxcrt/zip.h"
@@ -181,10 +182,10 @@
 JpxDecodeAction GetJpxDecodeActionFromImageColorSpace(
     const CJPX_Decoder::JpxImageInfo& jpx_info) {
   switch (jpx_info.colorspace) {
-    case OPJ_CLRSPC_SYCC:
-    case OPJ_CLRSPC_EYCC:
     case OPJ_CLRSPC_UNKNOWN:
     case OPJ_CLRSPC_UNSPECIFIED:
+    case OPJ_CLRSPC_SYCC:
+    case OPJ_CLRSPC_EYCC:
       return JpxDecodeAction::kDoNothing;
 
     case OPJ_CLRSPC_SRGB:
@@ -197,6 +198,7 @@
     case OPJ_CLRSPC_CMYK:
       return JpxDecodeAction::kUseCmyk;
   }
+  NOTREACHED();
 }
 
 std::optional<JpxDecodeAction> GetJpxDecodeAction(
@@ -212,6 +214,10 @@
 
 int GetComponentCountFromOpjColorSpace(OPJ_COLOR_SPACE colorspace) {
   switch (colorspace) {
+    case OPJ_CLRSPC_UNKNOWN:
+    case OPJ_CLRSPC_UNSPECIFIED:
+      return 0;
+
     case OPJ_CLRSPC_GRAY:
       return 1;
 
@@ -222,10 +228,8 @@
 
     case OPJ_CLRSPC_CMYK:
       return 4;
-
-    default:
-      return 0;
   }
+  NOTREACHED();
 }
 
 }  // namespace