OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
7 /* | 7 /* |
8 * Copyright 2007 ZXing authors | 8 * Copyright 2007 ZXing authors |
9 * | 9 * |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h" | 28 #include "xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h" |
29 #include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h" | 29 #include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h" |
30 #include "xfa/fxbarcode/utils.h" | 30 #include "xfa/fxbarcode/utils.h" |
31 | 31 |
32 const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = { | 32 const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = { |
33 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, | 33 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, |
34 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, | 34 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, |
35 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, | 35 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, |
36 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, | 36 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, |
37 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69}; | 37 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69}; |
38 CFX_PtrArray* CBC_QRCoderVersion::VERSION = NULL; | 38 |
| 39 CFX_ArrayTemplate<CBC_QRCoderVersion*>* CBC_QRCoderVersion::VERSION = nullptr; |
39 | 40 |
40 void CBC_QRCoderVersion::Initialize() { | 41 void CBC_QRCoderVersion::Initialize() { |
41 VERSION = new CFX_PtrArray(); | 42 VERSION = new CFX_ArrayTemplate<CBC_QRCoderVersion*>(); |
42 } | 43 } |
43 void CBC_QRCoderVersion::Finalize() { | 44 void CBC_QRCoderVersion::Finalize() { |
44 for (int32_t i = 0; i < VERSION->GetSize(); i++) { | 45 for (int32_t i = 0; i < VERSION->GetSize(); i++) |
45 CBC_QRCoderVersion* v = (CBC_QRCoderVersion*)(VERSION->GetAt(i)); | 46 delete VERSION->GetAt(i); |
46 delete v; | 47 |
47 } | |
48 delete VERSION; | 48 delete VERSION; |
| 49 VERSION = nullptr; |
49 } | 50 } |
50 CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber, | 51 CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber, |
51 CBC_QRCoderECBlocks* ecBlocks1, | 52 CBC_QRCoderECBlocks* ecBlocks1, |
52 CBC_QRCoderECBlocks* ecBlocks2, | 53 CBC_QRCoderECBlocks* ecBlocks2, |
53 CBC_QRCoderECBlocks* ecBlocks3, | 54 CBC_QRCoderECBlocks* ecBlocks3, |
54 CBC_QRCoderECBlocks* ecBlocks4) { | 55 CBC_QRCoderECBlocks* ecBlocks4) { |
55 m_versionNumber = versionNumber; | 56 m_versionNumber = versionNumber; |
56 m_ecBlocksArray.Add(ecBlocks1); | 57 m_ecBlocksArray.Add(ecBlocks1); |
57 m_ecBlocksArray.Add(ecBlocks2); | 58 m_ecBlocksArray.Add(ecBlocks2); |
58 m_ecBlocksArray.Add(ecBlocks3); | 59 m_ecBlocksArray.Add(ecBlocks3); |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 new CBC_QRCoderECB(31, 48)), | 749 new CBC_QRCoderECB(31, 48)), |
749 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(34, 24), | 750 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(34, 24), |
750 new CBC_QRCoderECB(34, 25)), | 751 new CBC_QRCoderECB(34, 25)), |
751 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 15), | 752 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 15), |
752 new CBC_QRCoderECB(61, 16)))); | 753 new CBC_QRCoderECB(61, 16)))); |
753 } | 754 } |
754 if (versionNumber < 1 || versionNumber > 40) { | 755 if (versionNumber < 1 || versionNumber > 40) { |
755 e = BCExceptionIllegalArgument; | 756 e = BCExceptionIllegalArgument; |
756 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 757 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
757 } | 758 } |
758 return (CBC_QRCoderVersion*)(*VERSION)[versionNumber - 1]; | 759 return (*VERSION)[versionNumber - 1]; |
759 } | 760 } |
| 761 |
760 void CBC_QRCoderVersion::Destroy() { | 762 void CBC_QRCoderVersion::Destroy() { |
761 int32_t i; | 763 for (int32_t i = 0; i < VERSION->GetSize(); i++) |
762 for (i = 0; i < VERSION->GetSize(); i++) { | 764 delete (*VERSION)[i]; |
763 delete ((CBC_QRCoderVersion*)(*VERSION)[i]); | 765 VERSION->RemoveAll(); |
764 } | |
765 } | 766 } |
OLD | NEW |