summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-02-24 15:26:50 -0800
committerLei Zhang <thestig@chromium.org>2016-02-24 15:26:50 -0800
commit38eaaf36b09b816b963015e33dc4eb02580e0462 (patch)
tree9a2721eb404a2de4ddce91b50cac25b2cac0edb1 /xfa/src/fxbarcode/oned/BC_OneDReader.cpp
parente1fb98394a6885cf03bdc6391e5a3878aad5b375 (diff)
downloadpdfium-38eaaf36b09b816b963015e33dc4eb02580e0462.tar.xz
Remove foo != NULL checks in xfa/src/fxbarcode.
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1726373002 .
Diffstat (limited to 'xfa/src/fxbarcode/oned/BC_OneDReader.cpp')
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDReader.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
index 0b699c9624..7cb8ba51fa 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 "";