| 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 "pageint.h" | 7 #include "pageint.h" |
| 8 | 8 |
| 9 #include <limits.h> | 9 #include <limits.h> |
| 10 | 10 |
| 11 #include <memory> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "core/include/fpdfapi/fpdf_module.h" | 14 #include "core/include/fpdfapi/fpdf_module.h" |
| 14 #include "core/include/fpdfapi/fpdf_page.h" | 15 #include "core/include/fpdfapi/fpdf_page.h" |
| 15 #include "core/include/fxcrt/fx_safe_types.h" | 16 #include "core/include/fxcrt/fx_safe_types.h" |
| 16 #include "third_party/base/nonstd_unique_ptr.h" | |
| 17 #include "third_party/base/numerics/safe_conversions_impl.h" | 17 #include "third_party/base/numerics/safe_conversions_impl.h" |
| 18 | 18 |
| 19 class CPDF_PSEngine; | 19 class CPDF_PSEngine; |
| 20 typedef enum { | 20 typedef enum { |
| 21 PSOP_ADD, | 21 PSOP_ADD, |
| 22 PSOP_SUB, | 22 PSOP_SUB, |
| 23 PSOP_MUL, | 23 PSOP_MUL, |
| 24 PSOP_DIV, | 24 PSOP_DIV, |
| 25 PSOP_IDIV, | 25 PSOP_IDIV, |
| 26 PSOP_MOD, | 26 PSOP_MOD, |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 FX_DWORD nSubs = pArray->GetCount(); | 761 FX_DWORD nSubs = pArray->GetCount(); |
| 762 if (nSubs == 0) { | 762 if (nSubs == 0) { |
| 763 return FALSE; | 763 return FALSE; |
| 764 } | 764 } |
| 765 m_nOutputs = 0; | 765 m_nOutputs = 0; |
| 766 for (FX_DWORD i = 0; i < nSubs; i++) { | 766 for (FX_DWORD i = 0; i < nSubs; i++) { |
| 767 CPDF_Object* pSub = pArray->GetElementValue(i); | 767 CPDF_Object* pSub = pArray->GetElementValue(i); |
| 768 if (pSub == pObj) { | 768 if (pSub == pObj) { |
| 769 return FALSE; | 769 return FALSE; |
| 770 } | 770 } |
| 771 nonstd::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub)); | 771 std::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub)); |
| 772 if (!pFunc) { | 772 if (!pFunc) { |
| 773 return FALSE; | 773 return FALSE; |
| 774 } | 774 } |
| 775 // Check that the input dimensionality is 1, and that all output | 775 // Check that the input dimensionality is 1, and that all output |
| 776 // dimensionalities are the same. | 776 // dimensionalities are the same. |
| 777 if (pFunc->CountInputs() != kRequiredNumInputs) { | 777 if (pFunc->CountInputs() != kRequiredNumInputs) { |
| 778 return FALSE; | 778 return FALSE; |
| 779 } | 779 } |
| 780 if (pFunc->CountOutputs() != m_nOutputs) { | 780 if (pFunc->CountOutputs() != m_nOutputs) { |
| 781 if (m_nOutputs) | 781 if (m_nOutputs) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 for (int i = 0; i < m_nOutputs; i++) { | 918 for (int i = 0; i < m_nOutputs; i++) { |
| 919 if (results[i] < m_pRanges[i * 2]) { | 919 if (results[i] < m_pRanges[i * 2]) { |
| 920 results[i] = m_pRanges[i * 2]; | 920 results[i] = m_pRanges[i * 2]; |
| 921 } else if (results[i] > m_pRanges[i * 2 + 1]) { | 921 } else if (results[i] > m_pRanges[i * 2 + 1]) { |
| 922 results[i] = m_pRanges[i * 2 + 1]; | 922 results[i] = m_pRanges[i * 2 + 1]; |
| 923 } | 923 } |
| 924 } | 924 } |
| 925 } | 925 } |
| 926 return TRUE; | 926 return TRUE; |
| 927 } | 927 } |
| OLD | NEW |