diff options
author | tsepez <tsepez@chromium.org> | 2016-05-02 13:47:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-02 13:47:17 -0700 |
commit | 6020e45b406e7a130024de87101b4493543f9deb (patch) | |
tree | e533401947212d7615a2504922caaaa7f450703a /xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp | |
parent | fbe14b97f00b866e69e0970881550f6d6d9465cd (diff) | |
download | pdfium-6020e45b406e7a130024de87101b4493543f9deb.tar.xz |
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, part 11
Last part. Remove CFX_PtrArray typedef.
Review-Url: https://codereview.chromium.org/1941863002
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp')
-rw-r--r-- | xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp index e92267819c..9c3a1cc138 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp @@ -35,17 +35,18 @@ const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = { 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69}; -CFX_PtrArray* CBC_QRCoderVersion::VERSION = NULL; + +CFX_ArrayTemplate<CBC_QRCoderVersion*>* CBC_QRCoderVersion::VERSION = nullptr; void CBC_QRCoderVersion::Initialize() { - VERSION = new CFX_PtrArray(); + VERSION = new CFX_ArrayTemplate<CBC_QRCoderVersion*>(); } void CBC_QRCoderVersion::Finalize() { - for (int32_t i = 0; i < VERSION->GetSize(); i++) { - CBC_QRCoderVersion* v = (CBC_QRCoderVersion*)(VERSION->GetAt(i)); - delete v; - } + for (int32_t i = 0; i < VERSION->GetSize(); i++) + delete VERSION->GetAt(i); + delete VERSION; + VERSION = nullptr; } CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber, CBC_QRCoderECBlocks* ecBlocks1, @@ -755,11 +756,11 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber( e = BCExceptionIllegalArgument; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } - return (CBC_QRCoderVersion*)(*VERSION)[versionNumber - 1]; + return (*VERSION)[versionNumber - 1]; } + void CBC_QRCoderVersion::Destroy() { - int32_t i; - for (i = 0; i < VERSION->GetSize(); i++) { - delete ((CBC_QRCoderVersion*)(*VERSION)[i]); - } + for (int32_t i = 0; i < VERSION->GetSize(); i++) + delete (*VERSION)[i]; + VERSION->RemoveAll(); } |