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

Unified Diff: xfa/src/fxbarcode/oned/BC_OneDReader.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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp ('k') | xfa/src/fxbarcode/oned/BC_OneDimReader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fxbarcode/oned/BC_OneDReader.cpp
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
index 0b699c96247c0c6db1c72413da4148b9e4105f7d..7cb8ba51fafcdb1dc6ddda2bae329b3d331ec2d5 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
@@ -21,6 +21,7 @@
*/
#include <algorithm>
+#include <memory>
#include "xfa/src/fxbarcode/BC_BinaryBitmap.h"
#include "xfa/src/fxbarcode/BC_Reader.h"
@@ -49,7 +50,6 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image,
int32_t hints,
int32_t& e) {
int32_t height = image->GetHeight();
- CBC_CommonBitArray* row = NULL;
int32_t middle = height >> 1;
FX_BOOL tryHarder = FALSE;
int32_t rowStep = std::max(1, height >> (tryHarder ? 8 : 5));
@@ -68,34 +68,23 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image,
if (rowNumber < 0 || rowNumber >= height) {
break;
}
- row = image->GetBlackRow(rowNumber, NULL, e);
+ std::unique_ptr<CBC_CommonBitArray> row(
+ image->GetBlackRow(rowNumber, nullptr, e));
if (e != BCExceptionNO) {
e = BCExceptionNO;
- if (row != NULL) {
- delete row;
- row = NULL;
- }
continue;
}
for (int32_t attempt = 0; attempt < 2; attempt++) {
if (attempt == 1) {
row->Reverse();
}
- CFX_ByteString result = DecodeRow(rowNumber, row, hints, e);
+ CFX_ByteString result = DecodeRow(rowNumber, row.get(), hints, e);
if (e != BCExceptionNO) {
e = BCExceptionNO;
continue;
}
- if (row != NULL) {
- delete row;
- row = NULL;
- }
return result;
}
- if (row != NULL) {
- delete row;
- row = NULL;
- }
}
e = BCExceptionNotFound;
return "";
« no previous file with comments | « xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp ('k') | xfa/src/fxbarcode/oned/BC_OneDimReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698