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

Unified Diff: xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp

Issue 2221023003: Use smart pointers for class owned pointers in xfa/fxbarcode (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 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/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
index b8a032ae68704c53eaa4268c7b5082652ab73895..e91e6374ee97af9a82ba8b4b2d199261996a8bd8 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
@@ -20,22 +20,24 @@
* limitations under the License.
*/
-#include "xfa/fxbarcode/common/BC_CommonByteArray.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h"
+#include <utility>
+
+#include "xfa/fxbarcode/common/BC_CommonByteArray.h"
+
CBC_QRCoderBlockPair::CBC_QRCoderBlockPair(
- CBC_CommonByteArray* data,
- CBC_CommonByteArray* errorCorrection) {
- m_dataBytes = data;
- m_errorCorrectionBytes = errorCorrection;
-}
-CBC_QRCoderBlockPair::~CBC_QRCoderBlockPair() {
- delete m_dataBytes;
- delete m_errorCorrectionBytes;
-}
-CBC_CommonByteArray* CBC_QRCoderBlockPair::GetDataBytes() {
- return m_dataBytes;
+ std::unique_ptr<CBC_CommonByteArray> data,
+ std::unique_ptr<CBC_CommonByteArray> errorCorrection)
+ : m_dataBytes(std::move(data)),
+ m_errorCorrectionBytes(std::move(errorCorrection)) {}
+
+CBC_QRCoderBlockPair::~CBC_QRCoderBlockPair() {}
+
+CBC_CommonByteArray* CBC_QRCoderBlockPair::GetDataBytes() const {
+ return m_dataBytes.get();
}
-CBC_CommonByteArray* CBC_QRCoderBlockPair::GetErrorCorrectionBytes() {
- return m_errorCorrectionBytes;
+
+CBC_CommonByteArray* CBC_QRCoderBlockPair::GetErrorCorrectionBytes() const {
+ return m_errorCorrectionBytes.get();
}

Powered by Google App Engine
This is Rietveld 408576698