Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2383)

Unified Diff: core/fpdfapi/fpdf_page/pageint.h

Issue 1990843004: Fix Undefined-shift in CPDF_SampledFunc::v_Init(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: compile Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_func.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/pageint.h
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h
index 6534186dc8cb45d524546d0d394facf1c8e77953..577cf597a0ee6fe37a7cc6064491a5159e0b72e6 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;
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_func.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698