Fix typo in enum CPDF_Function::Type. "kType2ExponentialInterpolation" is the proper spelling. Also add a comment to reference the PDF spec and indicate these enum values are not arbitrary. Change-Id: Ifba299dca7205ddf54a9772126005763bc956b36 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67851 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_expintfunc.cpp b/core/fpdfapi/page/cpdf_expintfunc.cpp index 7194f97..5be0ac6 100644 --- a/core/fpdfapi/page/cpdf_expintfunc.cpp +++ b/core/fpdfapi/page/cpdf_expintfunc.cpp
@@ -13,7 +13,7 @@ #include "third_party/base/stl_util.h" CPDF_ExpIntFunc::CPDF_ExpIntFunc() - : CPDF_Function(Type::kType2ExpotentialInterpolation) {} + : CPDF_Function(Type::kType2ExponentialInterpolation) {} CPDF_ExpIntFunc::~CPDF_ExpIntFunc() = default;
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp index 055a979..75e7710 100644 --- a/core/fpdfapi/page/cpdf_function.cpp +++ b/core/fpdfapi/page/cpdf_function.cpp
@@ -64,7 +64,7 @@ Type type = IntegerToFunctionType(iType); if (type == Type::kType0Sampled) pFunc = pdfium::MakeUnique<CPDF_SampledFunc>(); - else if (type == Type::kType2ExpotentialInterpolation) + else if (type == Type::kType2ExponentialInterpolation) pFunc = pdfium::MakeUnique<CPDF_ExpIntFunc>(); else if (type == Type::kType3Stitching) pFunc = pdfium::MakeUnique<CPDF_StitchFunc>(); @@ -168,7 +168,7 @@ } const CPDF_ExpIntFunc* CPDF_Function::ToExpIntFunc() const { - return m_Type == Type::kType2ExpotentialInterpolation + return m_Type == Type::kType2ExponentialInterpolation ? static_cast<const CPDF_ExpIntFunc*>(this) : nullptr; }
diff --git a/core/fpdfapi/page/cpdf_function.h b/core/fpdfapi/page/cpdf_function.h index 91fa31e..fd68b6b 100644 --- a/core/fpdfapi/page/cpdf_function.h +++ b/core/fpdfapi/page/cpdf_function.h
@@ -18,10 +18,11 @@ class CPDF_Function { public: + // Valid values are from PDF 32000-1:2008 spec, table 38. DO NOT CHANGE. enum class Type { kTypeInvalid = -1, kType0Sampled = 0, - kType2ExpotentialInterpolation = 2, + kType2ExponentialInterpolation = 2, kType3Stitching = 3, kType4PostScript = 4, };