summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
diff options
context:
space:
mode:
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 "";