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

Side by Side Diff: xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp

Issue 1726373002: Remove foo != NULL checks in xfa/src/fxbarcode. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 10 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int32_t currentState = 0; 68 int32_t currentState = 0;
69 while (j < maxJ) { 69 while (j < maxJ) {
70 if (m_image->Get(j, i)) { 70 if (m_image->Get(j, i)) {
71 if (currentState == 1) { 71 if (currentState == 1) {
72 stateCount[currentState]++; 72 stateCount[currentState]++;
73 } else { 73 } else {
74 if (currentState == 2) { 74 if (currentState == 2) {
75 if (FoundPatternCross(stateCount)) { 75 if (FoundPatternCross(stateCount)) {
76 CBC_QRAlignmentPattern* confirmed = 76 CBC_QRAlignmentPattern* confirmed =
77 HandlePossibleCenter(stateCount, i, j); 77 HandlePossibleCenter(stateCount, i, j);
78 if (confirmed != NULL) { 78 if (confirmed) {
79 return confirmed; 79 return confirmed;
80 } 80 }
81 } 81 }
82 stateCount[0] = stateCount[2]; 82 stateCount[0] = stateCount[2];
83 stateCount[1] = 1; 83 stateCount[1] = 1;
84 stateCount[2] = 0; 84 stateCount[2] = 0;
85 currentState = 1; 85 currentState = 1;
86 } else { 86 } else {
87 stateCount[++currentState]++; 87 stateCount[++currentState]++;
88 } 88 }
89 } 89 }
90 } else { 90 } else {
91 if (currentState == 1) { 91 if (currentState == 1) {
92 currentState++; 92 currentState++;
93 } 93 }
94 stateCount[currentState]++; 94 stateCount[currentState]++;
95 } 95 }
96 j++; 96 j++;
97 } 97 }
98 if (FoundPatternCross(stateCount)) { 98 if (FoundPatternCross(stateCount)) {
99 CBC_QRAlignmentPattern* confirmed = 99 CBC_QRAlignmentPattern* confirmed =
100 HandlePossibleCenter(stateCount, i, maxJ); 100 HandlePossibleCenter(stateCount, i, maxJ);
101 if (confirmed != NULL) { 101 if (confirmed) {
102 return confirmed; 102 return confirmed;
103 } 103 }
104 } 104 }
105 } 105 }
106 if (m_possibleCenters.GetSize() != 0) { 106 if (m_possibleCenters.GetSize() != 0) {
107 return ((CBC_QRAlignmentPattern*)(m_possibleCenters[0]))->Clone(); 107 return ((CBC_QRAlignmentPattern*)(m_possibleCenters[0]))->Clone();
108 } 108 }
109 e = BCExceptionRead; 109 e = BCExceptionRead;
110 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 110 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
111 return NULL; 111 return NULL;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) { 193 if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) {
194 return new CBC_QRAlignmentPattern(centerJ, centerI, 194 return new CBC_QRAlignmentPattern(centerJ, centerI,
195 estimatedModuleSize); 195 estimatedModuleSize);
196 } 196 }
197 } 197 }
198 m_possibleCenters.Add( 198 m_possibleCenters.Add(
199 new CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize)); 199 new CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize));
200 } 200 }
201 return NULL; 201 return NULL;
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698