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

Side by Side Diff: xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp

Issue 1726373002: Remove foo != NULL checks in xfa/src/fxbarcode. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 9 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 2013 ZXing authors 8 * Copyright 2013 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 23 matching lines...) Expand all
34 } 34 }
35 CBC_DetectionResultColumn::~CBC_DetectionResultColumn() { 35 CBC_DetectionResultColumn::~CBC_DetectionResultColumn() {
36 for (int32_t i = 0; i < m_codewords->GetSize(); i++) { 36 for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
37 delete (CBC_Codeword*)m_codewords->GetAt(i); 37 delete (CBC_Codeword*)m_codewords->GetAt(i);
38 } 38 }
39 m_codewords->RemoveAll(); 39 m_codewords->RemoveAll();
40 delete m_codewords; 40 delete m_codewords;
41 } 41 }
42 CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) { 42 CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) {
43 CBC_Codeword* codeword = getCodeword(imageRow); 43 CBC_Codeword* codeword = getCodeword(imageRow);
44 if (codeword != NULL) { 44 if (codeword) {
45 return codeword; 45 return codeword;
46 } 46 }
47 for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) { 47 for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) {
48 int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i; 48 int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i;
49 if (nearImageRow >= 0) { 49 if (nearImageRow >= 0) {
50 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); 50 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
51 if (codeword != NULL) { 51 if (codeword) {
52 return codeword; 52 return codeword;
53 } 53 }
54 } 54 }
55 nearImageRow = imageRowToCodewordIndex(imageRow) + i; 55 nearImageRow = imageRowToCodewordIndex(imageRow) + i;
56 if (nearImageRow < m_codewords->GetSize()) { 56 if (nearImageRow < m_codewords->GetSize()) {
57 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); 57 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
58 if (codeword != NULL) { 58 if (codeword) {
59 return codeword; 59 return codeword;
60 } 60 }
61 } 61 }
62 } 62 }
63 return NULL; 63 return NULL;
64 } 64 }
65 int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) { 65 int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) {
66 return imageRow - m_boundingBox->getMinY(); 66 return imageRow - m_boundingBox->getMinY();
67 } 67 }
68 int32_t CBC_DetectionResultColumn::codewordIndexToImageRow( 68 int32_t CBC_DetectionResultColumn::codewordIndexToImageRow(
(...skipping 23 matching lines...) Expand all
92 row++; 92 row++;
93 continue; 93 continue;
94 } 94 }
95 result += (FX_CHAR)row; 95 result += (FX_CHAR)row;
96 result += codeword->getRowNumber(); 96 result += codeword->getRowNumber();
97 result += codeword->getValue(); 97 result += codeword->getValue();
98 row++; 98 row++;
99 } 99 }
100 return result; 100 return result;
101 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698