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

Side by Side Diff: xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp

Issue 2048983002: Get rid of NULLs in xfa/fxbarcode/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 int32_t& e) { 37 int32_t& e) {
38 if (degree >= m_cachedGenerators.GetSize()) { 38 if (degree >= m_cachedGenerators.GetSize()) {
39 CBC_ReedSolomonGF256Poly* lastGenerator = 39 CBC_ReedSolomonGF256Poly* lastGenerator =
40 m_cachedGenerators[m_cachedGenerators.GetSize() - 1]; 40 m_cachedGenerators[m_cachedGenerators.GetSize() - 1];
41 for (int32_t d = m_cachedGenerators.GetSize(); d <= degree; d++) { 41 for (int32_t d = m_cachedGenerators.GetSize(); d <= degree; d++) {
42 CFX_Int32Array temp; 42 CFX_Int32Array temp;
43 temp.Add(1); 43 temp.Add(1);
44 temp.Add(m_field->Exp(d - 1)); 44 temp.Add(m_field->Exp(d - 1));
45 CBC_ReedSolomonGF256Poly temp_poly; 45 CBC_ReedSolomonGF256Poly temp_poly;
46 temp_poly.Init(m_field, &temp, e); 46 temp_poly.Init(m_field, &temp, e);
47 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 47 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
48 CBC_ReedSolomonGF256Poly* nextGenerator = 48 CBC_ReedSolomonGF256Poly* nextGenerator =
49 lastGenerator->Multiply(&temp_poly, e); 49 lastGenerator->Multiply(&temp_poly, e);
50 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 50 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
51 m_cachedGenerators.Add(nextGenerator); 51 m_cachedGenerators.Add(nextGenerator);
52 lastGenerator = nextGenerator; 52 lastGenerator = nextGenerator;
53 } 53 }
54 } 54 }
55 return m_cachedGenerators[degree]; 55 return m_cachedGenerators[degree];
56 } 56 }
57 void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array* toEncode, 57 void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array* toEncode,
58 int32_t ecBytes, 58 int32_t ecBytes,
59 int32_t& e) { 59 int32_t& e) {
60 if (ecBytes == 0) { 60 if (ecBytes == 0) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (*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 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp ('k') | xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698