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

Side by Side Diff: xfa/fxbarcode/qrcode/BC_QRDataBlock.cpp

Issue 2048983002: Get rid of NULLs in xfa/fxbarcode/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 CFX_ByteArray* CBC_QRDataBlock::GetCodewords() { 41 CFX_ByteArray* CBC_QRDataBlock::GetCodewords() {
42 return m_codewords; 42 return m_codewords;
43 } 43 }
44 CFX_ArrayTemplate<CBC_QRDataBlock*>* CBC_QRDataBlock::GetDataBlocks( 44 CFX_ArrayTemplate<CBC_QRDataBlock*>* CBC_QRDataBlock::GetDataBlocks(
45 CFX_ByteArray* rawCodewords, 45 CFX_ByteArray* rawCodewords,
46 CBC_QRCoderVersion* version, 46 CBC_QRCoderVersion* version,
47 CBC_QRCoderErrorCorrectionLevel* ecLevel, 47 CBC_QRCoderErrorCorrectionLevel* ecLevel,
48 int32_t& e) { 48 int32_t& e) {
49 if (rawCodewords->GetSize() != version->GetTotalCodeWords()) { 49 if (rawCodewords->GetSize() != version->GetTotalCodeWords()) {
50 e = BCExceptionIllegalArgument; 50 e = BCExceptionIllegalArgument;
51 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 51 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
52 } 52 }
53 CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel); 53 CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel);
54 int32_t totalBlocks = 0; 54 int32_t totalBlocks = 0;
55 CFX_ArrayTemplate<CBC_QRCoderECB*>* ecBlockArray = ecBlocks->GetECBlocks(); 55 CFX_ArrayTemplate<CBC_QRCoderECB*>* ecBlockArray = ecBlocks->GetECBlocks();
56 int32_t i = 0; 56 int32_t i = 0;
57 for (i = 0; i < ecBlockArray->GetSize(); i++) { 57 for (i = 0; i < ecBlockArray->GetSize(); i++) {
58 totalBlocks += (*ecBlockArray)[i]->GetCount(); 58 totalBlocks += (*ecBlockArray)[i]->GetCount();
59 } 59 }
60 std::unique_ptr<CFX_ArrayTemplate<CBC_QRDataBlock*>> result( 60 std::unique_ptr<CFX_ArrayTemplate<CBC_QRDataBlock*>> result(
61 new CFX_ArrayTemplate<CBC_QRDataBlock*>()); 61 new CFX_ArrayTemplate<CBC_QRDataBlock*>());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 int32_t max = (*result)[0]->m_codewords->GetSize(); 100 int32_t max = (*result)[0]->m_codewords->GetSize();
101 for (i = shorterBlocksNumDataCodewords; i < max; i++) { 101 for (i = shorterBlocksNumDataCodewords; i < max; i++) {
102 for (int32_t y = 0; y < numResultBlocks; y++) { 102 for (int32_t y = 0; y < numResultBlocks; y++) {
103 int32_t iOffset = y < longerBlocksStartAt ? i : i + 1; 103 int32_t iOffset = y < longerBlocksStartAt ? i : i + 1;
104 (*((*result)[y]->m_codewords))[iOffset] = 104 (*((*result)[y]->m_codewords))[iOffset] =
105 (*rawCodewords)[rawCodewordsOffset++]; 105 (*rawCodewords)[rawCodewordsOffset++];
106 } 106 }
107 } 107 }
108 return result.release(); 108 return result.release();
109 } 109 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp ('k') | xfa/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698