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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t& e) { | 135 CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t& e) { |
136 CBC_QRCoderFormatInformation* formatInfo = ReadFormatInformation(e); | 136 CBC_QRCoderFormatInformation* formatInfo = ReadFormatInformation(e); |
137 BC_EXCEPTION_CHECK_ReturnValue(e, NULL) CBC_QRCoderVersion* version = | 137 BC_EXCEPTION_CHECK_ReturnValue(e, NULL) CBC_QRCoderVersion* version = |
138 ReadVersion(e); | 138 ReadVersion(e); |
139 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 139 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
140 CBC_QRDataMask* dataMask = | 140 CBC_QRDataMask* dataMask = |
141 CBC_QRDataMask::ForReference((int32_t)(formatInfo->GetDataMask()), e); | 141 CBC_QRDataMask::ForReference((int32_t)(formatInfo->GetDataMask()), e); |
142 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 142 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
143 int32_t dimension = m_bitMatrix->GetDimension(e); | 143 int32_t dimension = m_bitMatrix->GetDimension(e); |
144 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 144 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
145 dataMask->UnmaskBitMatirx(m_bitMatrix, dimension); | 145 dataMask->UnmaskBitMatrix(m_bitMatrix, dimension); |
146 std::unique_ptr<CBC_CommonBitMatrix> functionPattern( | 146 std::unique_ptr<CBC_CommonBitMatrix> functionPattern( |
147 version->BuildFunctionPattern(e)); | 147 version->BuildFunctionPattern(e)); |
148 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 148 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
149 FX_BOOL readingUp = TRUE; | 149 FX_BOOL readingUp = TRUE; |
150 std::unique_ptr<CFX_ByteArray> result(new CFX_ByteArray); | 150 std::unique_ptr<CFX_ByteArray> result(new CFX_ByteArray); |
151 result->SetSize(version->GetTotalCodeWords()); | 151 result->SetSize(version->GetTotalCodeWords()); |
152 int32_t resultOffset = 0; | 152 int32_t resultOffset = 0; |
153 int32_t currentByte = 0; | 153 int32_t currentByte = 0; |
154 int32_t bitsRead = 0; | 154 int32_t bitsRead = 0; |
155 for (int32_t j = dimension - 1; j > 0; j -= 2) { | 155 for (int32_t j = dimension - 1; j > 0; j -= 2) { |
(...skipping 18 matching lines...) Expand all Loading... |
174 } | 174 } |
175 } | 175 } |
176 readingUp ^= TRUE; | 176 readingUp ^= TRUE; |
177 } | 177 } |
178 if (resultOffset != version->GetTotalCodeWords()) { | 178 if (resultOffset != version->GetTotalCodeWords()) { |
179 e = BCExceptionRead; | 179 e = BCExceptionRead; |
180 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 180 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
181 } | 181 } |
182 return result.release(); | 182 return result.release(); |
183 } | 183 } |
OLD | NEW |