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

Unified Diff: xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp

Issue 1734823002: Get rid of CBC_AutoPtr and use std::unique_ptr instead. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@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
Index: xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
index 75ad07752120dc47681792645f2328b9cf8ff849..185e16c5b7827de73e61047dd424843d91509f90 100644
--- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
+++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp
@@ -20,10 +20,13 @@
* limitations under the License.
*/
+#include "xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h"
+
+#include <memory>
+
#include "xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h"
#include "xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h"
#include "xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h"
-#include "xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h"
#include "xfa/src/fxbarcode/utils.h"
CBC_QRDataBlock::CBC_QRDataBlock(int32_t numDataCodewords,
@@ -54,9 +57,8 @@ CFX_PtrArray* CBC_QRDataBlock::GetDataBlocks(
for (i = 0; i < ecBlockArray->GetSize(); i++) {
totalBlocks += ((CBC_QRCoderECB*)(*ecBlockArray)[i])->GetCount();
}
- CFX_PtrArray* datablock = new CFX_PtrArray();
- datablock->SetSize(totalBlocks);
- CBC_AutoPtr<CFX_PtrArray> result(datablock);
+ std::unique_ptr<CFX_PtrArray> result(new CFX_PtrArray());
+ result->SetSize(totalBlocks);
int32_t numResultBlocks = 0;
for (int32_t j = 0; j < ecBlockArray->GetSize(); j++) {
CBC_QRCoderECB* ecBlock = (CBC_QRCoderECB*)(*ecBlockArray)[j];

Powered by Google App Engine
This is Rietveld 408576698