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

Side by Side Diff: xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.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 2010 ZXing authors 8 * Copyright 2010 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 atLeastOneBlackPointFoundOnBorder = TRUE; 120 atLeastOneBlackPointFoundOnBorder = TRUE;
121 } 121 }
122 } 122 }
123 if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) { 123 if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {
124 int32_t maxSize = right - left; 124 int32_t maxSize = right - left;
125 CBC_AutoPtr<CBC_ResultPoint> z(NULL); 125 CBC_AutoPtr<CBC_ResultPoint> z(NULL);
126 for (int32_t i = 1; i < maxSize; i++) { 126 for (int32_t i = 1; i < maxSize; i++) {
127 z = CBC_AutoPtr<CBC_ResultPoint>( 127 z = CBC_AutoPtr<CBC_ResultPoint>(
128 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i), 128 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i),
129 (FX_FLOAT)(left + i), (FX_FLOAT)(down))); 129 (FX_FLOAT)(left + i), (FX_FLOAT)(down)));
130 if (z.get() != NULL) { 130 if (z.get()) {
131 break; 131 break;
132 } 132 }
133 } 133 }
134 if (z.get() == NULL) { 134 if (z.get() == NULL) {
135 e = BCExceptionNotFound; 135 e = BCExceptionNotFound;
136 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 136 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
137 } 137 }
138 CBC_AutoPtr<CBC_ResultPoint> t(NULL); 138 CBC_AutoPtr<CBC_ResultPoint> t(NULL);
139 for (int32_t j = 1; j < maxSize; j++) { 139 for (int32_t j = 1; j < maxSize; j++) {
140 t = CBC_AutoPtr<CBC_ResultPoint>( 140 t = CBC_AutoPtr<CBC_ResultPoint>(
141 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j), 141 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j),
142 (FX_FLOAT)(left + j), (FX_FLOAT)up)); 142 (FX_FLOAT)(left + j), (FX_FLOAT)up));
143 if (t.get() != NULL) { 143 if (t.get()) {
144 break; 144 break;
145 } 145 }
146 } 146 }
147 if (t.get() == NULL) { 147 if (t.get() == NULL) {
148 e = BCExceptionNotFound; 148 e = BCExceptionNotFound;
149 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 149 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
150 } 150 }
151 CBC_AutoPtr<CBC_ResultPoint> x(NULL); 151 CBC_AutoPtr<CBC_ResultPoint> x(NULL);
152 for (int32_t k = 1; k < maxSize; k++) { 152 for (int32_t k = 1; k < maxSize; k++) {
153 x = CBC_AutoPtr<CBC_ResultPoint>( 153 x = CBC_AutoPtr<CBC_ResultPoint>(
154 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k), 154 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k),
155 (FX_FLOAT)(right - k), (FX_FLOAT)up)); 155 (FX_FLOAT)(right - k), (FX_FLOAT)up));
156 if (x.get() != NULL) { 156 if (x.get()) {
157 break; 157 break;
158 } 158 }
159 } 159 }
160 if (x.get() == NULL) { 160 if (x.get() == NULL) {
161 e = BCExceptionNotFound; 161 e = BCExceptionNotFound;
162 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 162 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
163 } 163 }
164 CBC_AutoPtr<CBC_ResultPoint> y(NULL); 164 CBC_AutoPtr<CBC_ResultPoint> y(NULL);
165 for (int32_t m = 1; m < maxSize; m++) { 165 for (int32_t m = 1; m < maxSize; m++) {
166 y = CBC_AutoPtr<CBC_ResultPoint>( 166 y = CBC_AutoPtr<CBC_ResultPoint>(
167 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m), 167 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m),
168 (FX_FLOAT)(right - m), (FX_FLOAT)down)); 168 (FX_FLOAT)(right - m), (FX_FLOAT)down));
169 if (y.get() != NULL) { 169 if (y.get()) {
170 break; 170 break;
171 } 171 }
172 } 172 }
173 if (y.get() == NULL) { 173 if (y.get() == NULL) {
174 e = BCExceptionNotFound; 174 e = BCExceptionNotFound;
175 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 175 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
176 } 176 }
177 return CenterEdges(y.get(), z.get(), x.get(), t.get()); 177 return CenterEdges(y.get(), z.get(), x.get(), t.get());
178 } else { 178 } else {
179 e = BCExceptionNotFound; 179 e = BCExceptionNotFound;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 } else { 252 } else {
253 for (int32_t y = a; y <= b; y++) { 253 for (int32_t y = a; y <= b; y++) {
254 if (m_image->Get(fixed, y)) { 254 if (m_image->Get(fixed, y)) {
255 return TRUE; 255 return TRUE;
256 } 256 }
257 } 257 }
258 } 258 }
259 return FALSE; 259 return FALSE;
260 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698