OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "../../../include/fpdfapi/fpdf_module.h" | 9 #include "../../../include/fpdfapi/fpdf_module.h" |
10 #include "../../../include/fpdfapi/fpdf_page.h" | 10 #include "../../../include/fpdfapi/fpdf_page.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 FX_DWORD m_SampleMax; | 475 FX_DWORD m_SampleMax; |
476 CPDF_StreamAcc* m_pSampleStream; | 476 CPDF_StreamAcc* m_pSampleStream; |
477 }; | 477 }; |
478 CPDF_SampledFunc::CPDF_SampledFunc() { | 478 CPDF_SampledFunc::CPDF_SampledFunc() { |
479 m_pSampleStream = NULL; | 479 m_pSampleStream = NULL; |
480 m_pEncodeInfo = NULL; | 480 m_pEncodeInfo = NULL; |
481 m_pDecodeInfo = NULL; | 481 m_pDecodeInfo = NULL; |
482 } | 482 } |
483 CPDF_SampledFunc::~CPDF_SampledFunc() { | 483 CPDF_SampledFunc::~CPDF_SampledFunc() { |
484 delete m_pSampleStream; | 484 delete m_pSampleStream; |
485 if (m_pEncodeInfo) { | |
486 FX_Free(m_pEncodeInfo); | 485 FX_Free(m_pEncodeInfo); |
487 } | |
488 if (m_pDecodeInfo) { | |
489 FX_Free(m_pDecodeInfo); | 486 FX_Free(m_pDecodeInfo); |
490 } | |
491 } | 487 } |
492 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { | 488 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { |
493 if (pObj->GetType() != PDFOBJ_STREAM) { | 489 if (pObj->GetType() != PDFOBJ_STREAM) { |
494 return FALSE; | 490 return FALSE; |
495 } | 491 } |
496 CPDF_Stream* pStream = (CPDF_Stream*)pObj; | 492 CPDF_Stream* pStream = (CPDF_Stream*)pObj; |
497 CPDF_Dictionary* pDict = pStream->GetDict(); | 493 CPDF_Dictionary* pDict = pStream->GetDict(); |
498 CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size")); | 494 CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size")); |
499 CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); | 495 CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); |
500 CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); | 496 CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 FX_FLOAT m_Exponent; | 653 FX_FLOAT m_Exponent; |
658 FX_FLOAT* m_pBeginValues; | 654 FX_FLOAT* m_pBeginValues; |
659 FX_FLOAT* m_pEndValues; | 655 FX_FLOAT* m_pEndValues; |
660 int m_nOrigOutputs; | 656 int m_nOrigOutputs; |
661 }; | 657 }; |
662 CPDF_ExpIntFunc::CPDF_ExpIntFunc() { | 658 CPDF_ExpIntFunc::CPDF_ExpIntFunc() { |
663 m_pBeginValues = NULL; | 659 m_pBeginValues = NULL; |
664 m_pEndValues = NULL; | 660 m_pEndValues = NULL; |
665 } | 661 } |
666 CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { | 662 CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { |
667 if (m_pBeginValues) { | |
668 FX_Free(m_pBeginValues); | 663 FX_Free(m_pBeginValues); |
669 } | |
670 if (m_pEndValues) { | |
671 FX_Free(m_pEndValues); | 664 FX_Free(m_pEndValues); |
672 } | |
673 } | 665 } |
674 FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { | 666 FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { |
675 CPDF_Dictionary* pDict = pObj->GetDict(); | 667 CPDF_Dictionary* pDict = pObj->GetDict(); |
676 if (pDict == NULL) { | 668 if (pDict == NULL) { |
677 return FALSE; | 669 return FALSE; |
678 } | 670 } |
679 CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0")); | 671 CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0")); |
680 if (m_nOutputs == 0) { | 672 if (m_nOutputs == 0) { |
681 m_nOutputs = 1; | 673 m_nOutputs = 1; |
682 if (pArray0) { | 674 if (pArray0) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 }; | 713 }; |
722 CPDF_StitchFunc::CPDF_StitchFunc() { | 714 CPDF_StitchFunc::CPDF_StitchFunc() { |
723 m_nSubs = 0; | 715 m_nSubs = 0; |
724 m_pSubFunctions = NULL; | 716 m_pSubFunctions = NULL; |
725 m_pBounds = NULL; | 717 m_pBounds = NULL; |
726 m_pEncode = NULL; | 718 m_pEncode = NULL; |
727 } | 719 } |
728 CPDF_StitchFunc::~CPDF_StitchFunc() { | 720 CPDF_StitchFunc::~CPDF_StitchFunc() { |
729 for (int i = 0; i < m_nSubs; i++) | 721 for (int i = 0; i < m_nSubs; i++) |
730 delete m_pSubFunctions[i]; | 722 delete m_pSubFunctions[i]; |
731 if (m_pSubFunctions) { | 723 FX_Free(m_pSubFunctions); |
732 FX_Free(m_pSubFunctions); | |
733 } | |
734 if (m_pBounds) { | |
735 FX_Free(m_pBounds); | 724 FX_Free(m_pBounds); |
736 } | |
737 if (m_pEncode) { | |
738 FX_Free(m_pEncode); | 725 FX_Free(m_pEncode); |
739 } | |
740 } | 726 } |
741 FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { | 727 FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { |
742 CPDF_Dictionary* pDict = pObj->GetDict(); | 728 CPDF_Dictionary* pDict = pObj->GetDict(); |
743 if (pDict == NULL) { | 729 if (pDict == NULL) { |
744 return FALSE; | 730 return FALSE; |
745 } | 731 } |
746 CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions")); | 732 CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions")); |
747 if (pArray == NULL) { | 733 if (pArray == NULL) { |
748 return FALSE; | 734 return FALSE; |
749 } | 735 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 delete pFunc; | 819 delete pFunc; |
834 return NULL; | 820 return NULL; |
835 } | 821 } |
836 return pFunc; | 822 return pFunc; |
837 } | 823 } |
838 CPDF_Function::CPDF_Function() { | 824 CPDF_Function::CPDF_Function() { |
839 m_pDomains = NULL; | 825 m_pDomains = NULL; |
840 m_pRanges = NULL; | 826 m_pRanges = NULL; |
841 } | 827 } |
842 CPDF_Function::~CPDF_Function() { | 828 CPDF_Function::~CPDF_Function() { |
843 if (m_pDomains) { | |
844 FX_Free(m_pDomains); | 829 FX_Free(m_pDomains); |
845 m_pDomains = NULL; | 830 m_pDomains = NULL; |
Tom Sepez
2015/08/14 21:21:34
nit: Pointless NULL assignment(s).
Lei Zhang
2015/08/14 21:43:14
Done.
| |
846 } | |
847 if (m_pRanges) { | |
848 FX_Free(m_pRanges); | 831 FX_Free(m_pRanges); |
849 m_pRanges = NULL; | 832 m_pRanges = NULL; |
850 } | |
851 } | 833 } |
852 FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { | 834 FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { |
853 CPDF_Dictionary* pDict; | 835 CPDF_Dictionary* pDict; |
854 if (pObj->GetType() == PDFOBJ_STREAM) { | 836 if (pObj->GetType() == PDFOBJ_STREAM) { |
855 pDict = ((CPDF_Stream*)pObj)->GetDict(); | 837 pDict = ((CPDF_Stream*)pObj)->GetDict(); |
856 } else { | 838 } else { |
857 pDict = (CPDF_Dictionary*)pObj; | 839 pDict = (CPDF_Dictionary*)pObj; |
858 } | 840 } |
859 CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain")); | 841 CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain")); |
860 if (pDomains == NULL) { | 842 if (pDomains == NULL) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 for (int i = 0; i < m_nOutputs; i++) { | 892 for (int i = 0; i < m_nOutputs; i++) { |
911 if (results[i] < m_pRanges[i * 2]) { | 893 if (results[i] < m_pRanges[i * 2]) { |
912 results[i] = m_pRanges[i * 2]; | 894 results[i] = m_pRanges[i * 2]; |
913 } else if (results[i] > m_pRanges[i * 2 + 1]) { | 895 } else if (results[i] > m_pRanges[i * 2 + 1]) { |
914 results[i] = m_pRanges[i * 2 + 1]; | 896 results[i] = m_pRanges[i * 2 + 1]; |
915 } | 897 } |
916 } | 898 } |
917 } | 899 } |
918 return TRUE; | 900 return TRUE; |
919 } | 901 } |
OLD | NEW |