Mark end of exhaustive switch statements in CPDF_CMap as unreachable
In functions that end with an exhaustive switch statement, the part of
the function after the switch statement is intended to be dead code.
Explicitly mark them as such with NOTREACHED_NORETURN(), and remove any
code that is there.
Change-Id: I4b564c46b8bdfb4a11f2f7826d72666d1d59ec4e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/123493
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index df4d92c..7413b28 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfapi/parser/cpdf_simple_parser.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
+#include "core/fxcrt/notreached.h"
namespace {
@@ -357,7 +358,7 @@
}
}
}
- return 0;
+ NOTREACHED_NORETURN();
}
int CPDF_CMap::GetCharSize(uint32_t charcode) const {
@@ -379,7 +380,7 @@
return 3;
return 4;
}
- return 1;
+ NOTREACHED_NORETURN();
}
size_t CPDF_CMap::CountChar(ByteStringView pString) const {
@@ -407,7 +408,7 @@
return count;
}
}
- return pString.GetLength();
+ NOTREACHED_NORETURN();
}
void CPDF_CMap::AppendChar(ByteString* str, uint32_t charcode) const {
@@ -455,6 +456,7 @@
*str += static_cast<char>(charcode);
return;
}
+ NOTREACHED_NORETURN();
}
void CPDF_CMap::SetAdditionalMappings(std::vector<CIDRange> mappings) {