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

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

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « xfa/fxbarcode/BC_TwoDimWriter.cpp ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 #include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h" 24 #include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
25 25
26 CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = NULL; 26 CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = NULL;
27 CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = NULL; 27 CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = NULL;
28 void CBC_ReedSolomonGF256::Initialize() { 28 void CBC_ReedSolomonGF256::Initialize() {
29 QRCodeFild = new CBC_ReedSolomonGF256(0x011D); 29 QRCodeFild = new CBC_ReedSolomonGF256(0x011D);
30 QRCodeFild->Init(); 30 QRCodeFild->Init();
31 DataMatrixField = new CBC_ReedSolomonGF256(0x012D); 31 DataMatrixField = new CBC_ReedSolomonGF256(0x012D);
32 DataMatrixField->Init(); 32 DataMatrixField->Init();
33 } 33 }
34
34 void CBC_ReedSolomonGF256::Finalize() { 35 void CBC_ReedSolomonGF256::Finalize() {
35 if (QRCodeFild) { 36 delete QRCodeFild;
36 delete QRCodeFild; 37 QRCodeFild = nullptr;
37 } 38 delete DataMatrixField;
38 QRCodeFild = NULL; 39 DataMatrixField = nullptr;
39 if (DataMatrixField) {
40 delete DataMatrixField;
41 }
42 DataMatrixField = NULL;
43 } 40 }
41
44 CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) { 42 CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
45 int32_t x = 1; 43 int32_t x = 1;
46 for (int32_t j = 0; j < 256; j++) { 44 for (int32_t j = 0; j < 256; j++) {
47 m_expTable[j] = x; 45 m_expTable[j] = x;
48 x <<= 1; 46 x <<= 1;
49 if (x >= 0x100) { 47 if (x >= 0x100) {
50 x ^= primitive; 48 x ^= primitive;
51 } 49 }
52 } 50 }
53 for (int32_t i = 0; i < 255; i++) { 51 for (int32_t i = 0; i < 255; i++) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return 0; 113 return 0;
116 } 114 }
117 if (a == 1) { 115 if (a == 1) {
118 return b; 116 return b;
119 } 117 }
120 if (b == 1) { 118 if (b == 1) {
121 return a; 119 return a;
122 } 120 }
123 return m_expTable[(m_logTable[a] + m_logTable[b]) % 255]; 121 return m_expTable[(m_logTable[a] + m_logTable[b]) % 255];
124 } 122 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/BC_TwoDimWriter.cpp ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698