| 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 2008 ZXing authors | 8 * Copyright 2008 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 void CBC_QRCoderEncoder::AppendECI(CBC_QRCoderBitVector* bits) {} | 89 void CBC_QRCoderEncoder::AppendECI(CBC_QRCoderBitVector* bits) {} |
| 90 void CBC_QRCoderEncoder::AppendDataModeLenghInfo( | 90 void CBC_QRCoderEncoder::AppendDataModeLenghInfo( |
| 91 const CFX_ArrayTemplate<Make_Pair*>& splitResult, | 91 const CFX_ArrayTemplate<Make_Pair*>& splitResult, |
| 92 CBC_QRCoderBitVector& headerAndDataBits, | 92 CBC_QRCoderBitVector& headerAndDataBits, |
| 93 CBC_QRCoderMode* tempMode, | 93 CBC_QRCoderMode* tempMode, |
| 94 CBC_QRCoder* qrCode, | 94 CBC_QRCoder* qrCode, |
| 95 CFX_ByteString& encoding, | 95 CFX_ByteString& encoding, |
| 96 int32_t& e) { | 96 int32_t& e) { |
| 97 for (int32_t i = 0; i < splitResult.GetSize(); i++) { | 97 for (int32_t i = 0; i < splitResult.GetSize(); i++) { |
| 98 tempMode = ((Make_Pair*)splitResult[i])->m_mode; | 98 tempMode = splitResult[i]->m_mode; |
| 99 if (tempMode == CBC_QRCoderMode::sGBK) { | 99 if (tempMode == CBC_QRCoderMode::sGBK) { |
| 100 AppendModeInfo(tempMode, &headerAndDataBits, e); | 100 AppendModeInfo(tempMode, &headerAndDataBits, e); |
| 101 BC_EXCEPTION_CHECK_ReturnVoid(e); | 101 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 102 AppendLengthInfo(((Make_Pair*)splitResult[i])->m_string.GetLength(), | 102 AppendLengthInfo(splitResult[i]->m_string.GetLength(), |
| 103 qrCode->GetVersion(), tempMode, &headerAndDataBits, e); | 103 qrCode->GetVersion(), tempMode, &headerAndDataBits, e); |
| 104 BC_EXCEPTION_CHECK_ReturnVoid(e); | 104 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 105 AppendBytes(((Make_Pair*)splitResult[i])->m_string, tempMode, | 105 AppendBytes(splitResult[i]->m_string, tempMode, &headerAndDataBits, |
| 106 &headerAndDataBits, encoding, e); | 106 encoding, e); |
| 107 BC_EXCEPTION_CHECK_ReturnVoid(e); | 107 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 108 } else if (tempMode == CBC_QRCoderMode::sBYTE) { | 108 } else if (tempMode == CBC_QRCoderMode::sBYTE) { |
| 109 CFX_ByteArray bytes; | 109 CFX_ByteArray bytes; |
| 110 CBC_UtilCodingConvert::LocaleToUtf8( | 110 CBC_UtilCodingConvert::LocaleToUtf8(splitResult[i]->m_string, bytes); |
| 111 ((Make_Pair*)splitResult[i])->m_string, bytes); | |
| 112 AppendModeInfo(tempMode, &headerAndDataBits, e); | 111 AppendModeInfo(tempMode, &headerAndDataBits, e); |
| 113 BC_EXCEPTION_CHECK_ReturnVoid(e); | 112 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 114 AppendLengthInfo(bytes.GetSize(), qrCode->GetVersion(), tempMode, | 113 AppendLengthInfo(bytes.GetSize(), qrCode->GetVersion(), tempMode, |
| 115 &headerAndDataBits, e); | 114 &headerAndDataBits, e); |
| 116 BC_EXCEPTION_CHECK_ReturnVoid(e); | 115 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 117 Append8BitBytes(bytes, &headerAndDataBits, e); | 116 Append8BitBytes(bytes, &headerAndDataBits, e); |
| 118 BC_EXCEPTION_CHECK_ReturnVoid(e); | 117 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 119 } else if (tempMode == CBC_QRCoderMode::sALPHANUMERIC) { | 118 } else if (tempMode == CBC_QRCoderMode::sALPHANUMERIC) { |
| 120 AppendModeInfo(tempMode, &headerAndDataBits, e); | 119 AppendModeInfo(tempMode, &headerAndDataBits, e); |
| 121 BC_EXCEPTION_CHECK_ReturnVoid(e); | 120 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 122 AppendLengthInfo(((Make_Pair*)splitResult[i])->m_string.GetLength(), | 121 AppendLengthInfo(splitResult[i]->m_string.GetLength(), |
| 123 qrCode->GetVersion(), tempMode, &headerAndDataBits, e); | 122 qrCode->GetVersion(), tempMode, &headerAndDataBits, e); |
| 124 BC_EXCEPTION_CHECK_ReturnVoid(e); | 123 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 125 AppendBytes(((Make_Pair*)splitResult[i])->m_string, tempMode, | 124 AppendBytes(splitResult[i]->m_string, tempMode, &headerAndDataBits, |
| 126 &headerAndDataBits, encoding, e); | 125 encoding, e); |
| 127 BC_EXCEPTION_CHECK_ReturnVoid(e); | 126 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 128 } else if (tempMode == CBC_QRCoderMode::sNUMERIC) { | 127 } else if (tempMode == CBC_QRCoderMode::sNUMERIC) { |
| 129 AppendModeInfo(tempMode, &headerAndDataBits, e); | 128 AppendModeInfo(tempMode, &headerAndDataBits, e); |
| 130 BC_EXCEPTION_CHECK_ReturnVoid(e); | 129 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 131 AppendLengthInfo(((Make_Pair*)splitResult[i])->m_string.GetLength(), | 130 AppendLengthInfo(splitResult[i]->m_string.GetLength(), |
| 132 qrCode->GetVersion(), tempMode, &headerAndDataBits, e); | 131 qrCode->GetVersion(), tempMode, &headerAndDataBits, e); |
| 133 BC_EXCEPTION_CHECK_ReturnVoid(e); | 132 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 134 AppendBytes(((Make_Pair*)splitResult[i])->m_string, tempMode, | 133 AppendBytes(splitResult[i]->m_string, tempMode, &headerAndDataBits, |
| 135 &headerAndDataBits, encoding, e); | 134 encoding, e); |
| 136 BC_EXCEPTION_CHECK_ReturnVoid(e); | 135 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 137 } else { | 136 } else { |
| 138 e = BCExceptionUnknown; | 137 e = BCExceptionUnknown; |
| 139 BC_EXCEPTION_CHECK_ReturnVoid(e); | 138 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 140 } | 139 } |
| 141 } | 140 } |
| 142 } | 141 } |
| 143 void CBC_QRCoderEncoder::SplitString(const CFX_ByteString& content, | 142 void CBC_QRCoderEncoder::SplitString(const CFX_ByteString& content, |
| 144 CFX_ArrayTemplate<Make_Pair*>* result) { | 143 CFX_ArrayTemplate<Make_Pair*>* result) { |
| 145 int32_t index = 0, flag = 0; | 144 int32_t index = 0, flag = 0; |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeFild); | 933 CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeFild); |
| 935 encode.Init(); | 934 encode.Init(); |
| 936 encode.Encode(&toEncode, numEcBytesInBlock, e); | 935 encode.Encode(&toEncode, numEcBytesInBlock, e); |
| 937 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); | 936 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
| 938 CBC_CommonByteArray* ecBytes = new CBC_CommonByteArray(numEcBytesInBlock); | 937 CBC_CommonByteArray* ecBytes = new CBC_CommonByteArray(numEcBytesInBlock); |
| 939 for (int32_t j = 0; j < numEcBytesInBlock; j++) { | 938 for (int32_t j = 0; j < numEcBytesInBlock; j++) { |
| 940 ecBytes->Set(j, toEncode[numDataBytes + j]); | 939 ecBytes->Set(j, toEncode[numDataBytes + j]); |
| 941 } | 940 } |
| 942 return ecBytes; | 941 return ecBytes; |
| 943 } | 942 } |
| OLD | NEW |