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

Side by Side Diff: xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.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 2008 ZXing authors 8 * Copyright 2008 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 } 52 }
53 int32_t RowOffsetLen = (rowOffset - rowOffsetLeft) / 4; 53 int32_t RowOffsetLen = (rowOffset - rowOffsetLeft) / 4;
54 CFX_Int32Array result; 54 CFX_Int32Array result;
55 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[0]); 55 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[0]);
56 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[1]); 56 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[1]);
57 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[2]); 57 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[2]);
58 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[3]); 58 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[3]);
59 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[4]); 59 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[4]);
60 CFX_Int32Array* middleRange = 60 CFX_Int32Array* middleRange =
61 FindGuardPattern(row, rowOffset, TRUE, &result, e); 61 FindGuardPattern(row, rowOffset, TRUE, &result, e);
dsinclair 2016/02/24 03:03:36 nit: at some point, should we change FindGuardPatt
Lei Zhang 2016/02/24 23:26:45 Some other day.
62 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 62 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
63 int32_t rowOffsetMid = rowOffset; 63 int32_t rowOffsetMid = rowOffset;
64 rowOffset = (*middleRange)[1]; 64 rowOffset = (*middleRange)[1];
65 if ((rowOffset - rowOffsetMid) > RowOffsetLen) { 65 if ((rowOffset - rowOffsetMid) > RowOffsetLen) {
66 e = BCExceptionNotFound; 66 e = BCExceptionNotFound;
67 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 67 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
68 } 68 }
69 if (middleRange != NULL) { 69 delete middleRange;
70 delete middleRange;
71 middleRange = NULL;
72 }
73 for (int32_t y = 0; y < 4 && rowOffset < end; y++) { 70 for (int32_t y = 0; y < 4 && rowOffset < end; y++) {
74 int32_t bestMatch = 71 int32_t bestMatch =
75 DecodeDigit(row, &counters, rowOffset, 72 DecodeDigit(row, &counters, rowOffset,
76 &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e); 73 &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
77 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 74 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
78 resultResult += (FX_CHAR)('0' + bestMatch); 75 resultResult += (FX_CHAR)('0' + bestMatch);
79 for (int32_t i = 0; i < counters.GetSize(); i++) { 76 for (int32_t i = 0; i < counters.GetSize(); i++) {
80 rowOffset += counters[i]; 77 rowOffset += counters[i];
81 } 78 }
82 } 79 }
83 return rowOffset; 80 return rowOffset;
84 } 81 }
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp ('k') | xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698