diff options
author | thestig <thestig@chromium.org> | 2016-05-19 15:47:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-19 15:47:01 -0700 |
commit | 9b1a0ee2a8f24411609a2f7554119597950dbd04 (patch) | |
tree | 3a2254a800f581bff51442184cdb9056ee8e2542 /core/fpdfapi/fpdf_page/pageint.h | |
parent | db9e49889d4129bbe96abdbce7dc3662e97a9df8 (diff) | |
download | pdfium-9b1a0ee2a8f24411609a2f7554119597950dbd04.tar.xz |
Fix Undefined-shift in CPDF_SampledFunc::v_Init().
Also fix a divide by zero in CPDF_SampledFunc.
Do some cleanups too.
BUG=596530,613032
Review-Url: https://codereview.chromium.org/1990843004
Diffstat (limited to 'core/fpdfapi/fpdf_page/pageint.h')
-rw-r--r-- | core/fpdfapi/fpdf_page/pageint.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h index d1364d0dd1..8d507a181d 100644 --- a/core/fpdfapi/fpdf_page/pageint.h +++ b/core/fpdfapi/fpdf_page/pageint.h @@ -367,13 +367,16 @@ class CPDF_DocPageData { class CPDF_Function { public: enum class Type { - kType0Sampled, - kType2ExpotentialInterpolation, - kType3Stitching, - kType4PostScript, + kTypeInvalid = -1, + kType0Sampled = 0, + kType2ExpotentialInterpolation = 2, + kType3Stitching = 3, + kType4PostScript = 4, }; static CPDF_Function* Load(CPDF_Object* pFuncObj); + static Type IntegerToFunctionType(int iType); + virtual ~CPDF_Function(); FX_BOOL Call(FX_FLOAT* inputs, uint32_t ninputs, @@ -381,12 +384,10 @@ class CPDF_Function { int& nresults) const; uint32_t CountInputs() const { return m_nInputs; } uint32_t CountOutputs() const { return m_nOutputs; } - FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } - FX_FLOAT GetRange(int i) const { return m_pRanges[i]; } - Type GetType() const { return m_Type; } protected: - CPDF_Function(Type type); + CPDF_Function(); + FX_BOOL Init(CPDF_Object* pObj); virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; @@ -395,7 +396,6 @@ class CPDF_Function { uint32_t m_nOutputs; FX_FLOAT* m_pDomains; FX_FLOAT* m_pRanges; - Type m_Type; }; class CPDF_ExpIntFunc : public CPDF_Function { @@ -433,11 +433,12 @@ class CPDF_SampledFunc : public CPDF_Function { FX_BOOL v_Init(CPDF_Object* pObj) override; FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; - SampleEncodeInfo* m_pEncodeInfo; - SampleDecodeInfo* m_pDecodeInfo; + private: + std::vector<SampleEncodeInfo> m_pEncodeInfo; + std::vector<SampleDecodeInfo> m_pDecodeInfo; uint32_t m_nBitsPerSample; uint32_t m_SampleMax; - CPDF_StreamAcc* m_pSampleStream; + std::unique_ptr<CPDF_StreamAcc> m_pSampleStream; }; class CPDF_StitchFunc : public CPDF_Function { @@ -449,7 +450,7 @@ class CPDF_StitchFunc : public CPDF_Function { FX_BOOL v_Init(CPDF_Object* pObj) override; FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; - std::vector<CPDF_Function*> m_pSubFunctions; + std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; FX_FLOAT* m_pBounds; FX_FLOAT* m_pEncode; |