| 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 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
| 7 /* | 7 /* |
| 8 * Copyright 2007 ZXing authors | 8 * Copyright 2007 ZXing authors |
| 9 * | 9 * |
| 10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 infoCoefficients.SetSize(dataBytes); | 72 infoCoefficients.SetSize(dataBytes); |
| 73 for (int32_t x = 0; x < dataBytes; x++) { | 73 for (int32_t x = 0; x < dataBytes; x++) { |
| 74 infoCoefficients[x] = toEncode->operator[](x); | 74 infoCoefficients[x] = toEncode->operator[](x); |
| 75 } | 75 } |
| 76 CBC_ReedSolomonGF256Poly info; | 76 CBC_ReedSolomonGF256Poly info; |
| 77 info.Init(m_field, &infoCoefficients, e); | 77 info.Init(m_field, &infoCoefficients, e); |
| 78 BC_EXCEPTION_CHECK_ReturnVoid(e); | 78 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 79 std::unique_ptr<CBC_ReedSolomonGF256Poly> infoTemp( | 79 std::unique_ptr<CBC_ReedSolomonGF256Poly> infoTemp( |
| 80 info.MultiplyByMonomial(ecBytes, 1, e)); | 80 info.MultiplyByMonomial(ecBytes, 1, e)); |
| 81 BC_EXCEPTION_CHECK_ReturnVoid(e); | 81 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 82 std::unique_ptr<CFX_PtrArray> temp(infoTemp->Divide(generator, e)); | 82 std::unique_ptr<CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>> temp( |
| 83 infoTemp->Divide(generator, e)); |
| 83 BC_EXCEPTION_CHECK_ReturnVoid(e); | 84 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 84 CBC_ReedSolomonGF256Poly* remainder = | 85 CBC_ReedSolomonGF256Poly* remainder = (*temp)[1]; |
| 85 (CBC_ReedSolomonGF256Poly*)(temp->operator[](1)); | |
| 86 CFX_Int32Array* coefficients = remainder->GetCoefficients(); | 86 CFX_Int32Array* coefficients = remainder->GetCoefficients(); |
| 87 int32_t numZeroCoefficients = ecBytes - coefficients->GetSize(); | 87 int32_t numZeroCoefficients = ecBytes - coefficients->GetSize(); |
| 88 for (int32_t i = 0; i < numZeroCoefficients; i++) { | 88 for (int32_t i = 0; i < numZeroCoefficients; i++) { |
| 89 (*toEncode)[dataBytes + i] = 0; | 89 (*toEncode)[dataBytes + i] = 0; |
| 90 } | 90 } |
| 91 for (int32_t y = 0; y < coefficients->GetSize(); y++) { | 91 for (int32_t y = 0; y < coefficients->GetSize(); y++) { |
| 92 (*toEncode)[dataBytes + numZeroCoefficients + y] = | 92 (*toEncode)[dataBytes + numZeroCoefficients + y] = |
| 93 coefficients->operator[](y); | 93 coefficients->operator[](y); |
| 94 } | 94 } |
| 95 for (int32_t k = 0; k < temp->GetSize(); k++) { | 95 for (int32_t k = 0; k < temp->GetSize(); k++) { |
| 96 delete (CBC_ReedSolomonGF256Poly*)(*temp)[k]; | 96 delete (*temp)[k]; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder() { | 99 CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder() { |
| 100 for (int32_t i = 0; i < m_cachedGenerators.GetSize(); i++) | 100 for (int32_t i = 0; i < m_cachedGenerators.GetSize(); i++) |
| 101 delete m_cachedGenerators[i]; | 101 delete m_cachedGenerators[i]; |
| 102 } | 102 } |
| OLD | NEW |