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

Side by Side Diff: xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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 24 matching lines...) Expand all
35 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 35 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
36 ' ', '$', '%', '*', '+', '-', '.', '/', ':' 36 ' ', '$', '%', '*', '+', '-', '.', '/', ':'
37 }; 37 };
38 CBC_QRDecodedBitStreamParser::CBC_QRDecodedBitStreamParser() 38 CBC_QRDecodedBitStreamParser::CBC_QRDecodedBitStreamParser()
39 { 39 {
40 } 40 }
41 CBC_QRDecodedBitStreamParser::~CBC_QRDecodedBitStreamParser() 41 CBC_QRDecodedBitStreamParser::~CBC_QRDecodedBitStreamParser()
42 { 42 {
43 } 43 }
44 CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt es, CBC_QRCoderVersion *version, 44 CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt es, CBC_QRCoderVersion *version,
45 CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 byteModeDecode, FX_IN T32 &e) 45 CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t byteModeDecode, int32_ t &e)
46 { 46 {
47 CBC_CommonBitSource bits(bytes); 47 CBC_CommonBitSource bits(bytes);
48 CFX_ByteString result; 48 CFX_ByteString result;
49 CBC_CommonCharacterSetECI* currentCharacterSetECI = NULL; 49 CBC_CommonCharacterSetECI* currentCharacterSetECI = NULL;
50 FX_BOOL fc1Infact = FALSE; 50 FX_BOOL fc1Infact = FALSE;
51 CFX_Int32Array byteSegments; 51 CFX_Int32Array byteSegments;
52 CBC_QRCoderMode* mode = NULL; 52 CBC_QRCoderMode* mode = NULL;
53 do { 53 do {
54 if(bits.Available() < 4) { 54 if(bits.Available() < 4) {
55 mode = CBC_QRCoderMode::sTERMINATOR; 55 mode = CBC_QRCoderMode::sTERMINATOR;
56 } else { 56 } else {
57 FX_INT32 iTemp1 = bits.ReadBits(4, e); 57 int32_t iTemp1 = bits.ReadBits(4, e);
58 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 58 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
59 mode = CBC_QRCoderMode::ForBits(iTemp1, e); 59 mode = CBC_QRCoderMode::ForBits(iTemp1, e);
60 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 60 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
61 if(mode == NULL) { 61 if(mode == NULL) {
62 e = BCExceptionUnSupportMode; 62 e = BCExceptionUnSupportMode;
63 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 63 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
64 } 64 }
65 } 65 }
66 if(!(mode == CBC_QRCoderMode::sTERMINATOR)) { 66 if(!(mode == CBC_QRCoderMode::sTERMINATOR)) {
67 if(mode == CBC_QRCoderMode::sFNC1_FIRST_POSITION || mode == CBC_QRCo derMode::sFNC1_SECOND_POSITION) { 67 if(mode == CBC_QRCoderMode::sFNC1_FIRST_POSITION || mode == CBC_QRCo derMode::sFNC1_SECOND_POSITION) {
68 fc1Infact = TRUE; 68 fc1Infact = TRUE;
69 } else if(mode == CBC_QRCoderMode::sSTRUCTURED_APPEND) { 69 } else if(mode == CBC_QRCoderMode::sSTRUCTURED_APPEND) {
70 bits.ReadBits(16, e); 70 bits.ReadBits(16, e);
71 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 71 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
72 } else if(mode == CBC_QRCoderMode::sECI) { 72 } else if(mode == CBC_QRCoderMode::sECI) {
73 FX_INT32 value = ParseECIValue(&bits, e); 73 int32_t value = ParseECIValue(&bits, e);
74 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 74 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
75 currentCharacterSetECI = CBC_CommonCharacterSetECI::GetCharacter SetECIByValue(value); 75 currentCharacterSetECI = CBC_CommonCharacterSetECI::GetCharacter SetECIByValue(value);
76 } else { 76 } else {
77 if(mode == CBC_QRCoderMode::sGBK) { 77 if(mode == CBC_QRCoderMode::sGBK) {
78 bits.ReadBits(4, e); 78 bits.ReadBits(4, e);
79 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 79 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
80 } 80 }
81 FX_INT32 numBits = mode->GetCharacterCountBits(version, e); 81 int32_t numBits = mode->GetCharacterCountBits(version, e);
82 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 82 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
83 FX_INT32 count = bits.ReadBits(numBits, e); 83 int32_t count = bits.ReadBits(numBits, e);
84 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 84 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
85 if(mode == CBC_QRCoderMode::sNUMERIC) { 85 if(mode == CBC_QRCoderMode::sNUMERIC) {
86 DecodeNumericSegment(&bits, result, count, e); 86 DecodeNumericSegment(&bits, result, count, e);
87 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 87 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
88 } else if(mode == CBC_QRCoderMode::sALPHANUMERIC) { 88 } else if(mode == CBC_QRCoderMode::sALPHANUMERIC) {
89 DecodeAlphanumericSegment(&bits, result, count, fc1Infact, e ); 89 DecodeAlphanumericSegment(&bits, result, count, fc1Infact, e );
90 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 90 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
91 } else if(mode == CBC_QRCoderMode::sBYTE) { 91 } else if(mode == CBC_QRCoderMode::sBYTE) {
92 DecodeByteSegment(&bits, result, count, currentCharacterSetE CI, &byteSegments, byteModeDecode, e); 92 DecodeByteSegment(&bits, result, count, currentCharacterSetE CI, &byteSegments, byteModeDecode, e);
93 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 93 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
94 } else if(mode == CBC_QRCoderMode::sGBK) { 94 } else if(mode == CBC_QRCoderMode::sGBK) {
95 DecodeGBKSegment(&bits, result, count, e); 95 DecodeGBKSegment(&bits, result, count, e);
96 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 96 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
97 } else if(mode == CBC_QRCoderMode::sKANJI) { 97 } else if(mode == CBC_QRCoderMode::sKANJI) {
98 DecodeKanjiSegment(&bits, result, count, e); 98 DecodeKanjiSegment(&bits, result, count, e);
99 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 99 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
100 } else { 100 } else {
101 e = BCExceptionUnSupportMode; 101 e = BCExceptionUnSupportMode;
102 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 102 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
103 } 103 }
104 } 104 }
105 } 105 }
106 } while (!(mode == CBC_QRCoderMode::sTERMINATOR)); 106 } while (!(mode == CBC_QRCoderMode::sTERMINATOR));
107 CBC_CommonDecoderResult *tempCd = FX_NEW CBC_CommonDecoderResult(); 107 CBC_CommonDecoderResult *tempCd = FX_NEW CBC_CommonDecoderResult();
108 tempCd->Init(*bytes, result, byteSegments, ecLevel, e); 108 tempCd->Init(*bytes, result, byteSegments, ecLevel, e);
109 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); 109 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
110 return tempCd; 110 return tempCd;
111 } 111 }
112 void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, C FX_ByteString &result, FX_INT32 count, FX_INT32 &e) 112 void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, C FX_ByteString &result, int32_t count, int32_t &e)
113 { 113 {
114 CFX_ByteString buffer; 114 CFX_ByteString buffer;
115 FX_INT32 offset = 0; 115 int32_t offset = 0;
116 while (count > 0) { 116 while (count > 0) {
117 FX_INT32 twoBytes = bits->ReadBits(13, e); 117 int32_t twoBytes = bits->ReadBits(13, e);
118 BC_EXCEPTION_CHECK_ReturnVoid(e); 118 BC_EXCEPTION_CHECK_ReturnVoid(e);
119 FX_INT32 assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x0 60); 119 int32_t assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x06 0);
120 if (assembledTwoBytes <= 0x0095d) { 120 if (assembledTwoBytes <= 0x0095d) {
121 assembledTwoBytes += 0x0a1a1; 121 assembledTwoBytes += 0x0a1a1;
122 } else { 122 } else {
123 assembledTwoBytes += 0x0a6a1; 123 assembledTwoBytes += 0x0a6a1;
124 } 124 }
125 buffer += (FX_BYTE) (assembledTwoBytes >> 8); 125 buffer += (uint8_t) (assembledTwoBytes >> 8);
126 buffer += (FX_BYTE) assembledTwoBytes; 126 buffer += (uint8_t) assembledTwoBytes;
127 count--; 127 count--;
128 } 128 }
129 CBC_UtilCodingConvert::LocaleToUtf8(buffer, result); 129 CBC_UtilCodingConvert::LocaleToUtf8(buffer, result);
130 } 130 }
131 void CBC_QRDecodedBitStreamParser::DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e) 131 void CBC_QRDecodedBitStreamParser::DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e)
132 { 132 {
133 CFX_ByteString buffer; 133 CFX_ByteString buffer;
134 while (count > 0) { 134 while (count > 0) {
135 FX_INT32 twoBytes = bits->ReadBits(13, e); 135 int32_t twoBytes = bits->ReadBits(13, e);
136 BC_EXCEPTION_CHECK_ReturnVoid(e); 136 BC_EXCEPTION_CHECK_ReturnVoid(e);
137 FX_INT32 assembledTwoBytes = ((twoBytes / 0x0c0) << 8) | (twoBytes % 0x0 c0); 137 int32_t assembledTwoBytes = ((twoBytes / 0x0c0) << 8) | (twoBytes % 0x0c 0);
138 if (assembledTwoBytes <= 0x01f00) { 138 if (assembledTwoBytes <= 0x01f00) {
139 assembledTwoBytes += 0x08140; 139 assembledTwoBytes += 0x08140;
140 } else { 140 } else {
141 assembledTwoBytes += 0x0c140; 141 assembledTwoBytes += 0x0c140;
142 } 142 }
143 buffer += (FX_BYTE) (assembledTwoBytes >> 8); 143 buffer += (uint8_t) (assembledTwoBytes >> 8);
144 buffer += (FX_BYTE) assembledTwoBytes; 144 buffer += (uint8_t) assembledTwoBytes;
145 count--; 145 count--;
146 } 146 }
147 CBC_UtilCodingConvert::LocaleToUtf8(buffer, result); 147 CBC_UtilCodingConvert::LocaleToUtf8(buffer, result);
148 } 148 }
149 void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, 149 void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count,
150 CBC_CommonCharacterSetECI *currentCharacterSetECI, 150 CBC_CommonCharacterSetECI *currentCharacterSetECI,
151 CFX_Int32Array *byteSegments, FX_INT32 byteModeDecode, FX_INT32 &e) 151 CFX_Int32Array *byteSegments, int32_t byteModeDecode, int32_t &e)
152 { 152 {
153 if(count < 0) { 153 if(count < 0) {
154 e = BCExceptionNotFound; 154 e = BCExceptionNotFound;
155 BC_EXCEPTION_CHECK_ReturnVoid(e); 155 BC_EXCEPTION_CHECK_ReturnVoid(e);
156 } 156 }
157 if((count << 3) > bits->Available()) { 157 if((count << 3) > bits->Available()) {
158 e = BCExceptionRead; 158 e = BCExceptionRead;
159 BC_EXCEPTION_CHECK_ReturnVoid(e); 159 BC_EXCEPTION_CHECK_ReturnVoid(e);
160 } 160 }
161 FX_BYTE *readBytes = FX_Alloc(FX_BYTE, count); 161 uint8_t *readBytes = FX_Alloc(uint8_t, count);
162 FXSYS_memset32(readBytes, 0x00, count); 162 FXSYS_memset32(readBytes, 0x00, count);
163 for(FX_INT32 i = 0; i < count; i++) { 163 for(int32_t i = 0; i < count; i++) {
164 readBytes[i] = (FX_BYTE) bits->ReadBits(8, e); 164 readBytes[i] = (uint8_t) bits->ReadBits(8, e);
165 BC_EXCEPTION_CHECK_ReturnVoid(e); 165 BC_EXCEPTION_CHECK_ReturnVoid(e);
166 } 166 }
167 CFX_ByteString bs(readBytes, count); 167 CFX_ByteString bs(readBytes, count);
168 result += bs; 168 result += bs;
169 FX_Free(readBytes); 169 FX_Free(readBytes);
170 } 170 }
171 void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(CBC_CommonBitSource * bits, 171 void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(CBC_CommonBitSource * bits,
172 CFX_ByteString &result, FX_INT32 count, FX_BOOL fac1InEffect, FX_INT32 & e) 172 CFX_ByteString &result, int32_t count, FX_BOOL fac1InEffect, int32_t &e)
173 { 173 {
174 FX_INT32 start = result.GetLength(); 174 int32_t start = result.GetLength();
175 while(count > 1) { 175 while(count > 1) {
176 FX_INT32 nextTwoCharsBits = bits->ReadBits(11, e); 176 int32_t nextTwoCharsBits = bits->ReadBits(11, e);
177 BC_EXCEPTION_CHECK_ReturnVoid(e); 177 BC_EXCEPTION_CHECK_ReturnVoid(e);
178 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits / 45]); 178 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits / 45]);
179 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits % 45]); 179 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits % 45]);
180 count -= 2; 180 count -= 2;
181 } 181 }
182 if(count == 1) { 182 if(count == 1) {
183 FX_INT32 itemp = bits->ReadBits(6, e); 183 int32_t itemp = bits->ReadBits(6, e);
184 BC_EXCEPTION_CHECK_ReturnVoid(e); 184 BC_EXCEPTION_CHECK_ReturnVoid(e);
185 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[itemp]); 185 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[itemp]);
186 } 186 }
187 if(fac1InEffect) { 187 if(fac1InEffect) {
188 for(FX_INT32 i = start; i < result.GetLength(); i++) { 188 for(int32_t i = start; i < result.GetLength(); i++) {
189 if(result[i] == '%') { 189 if(result[i] == '%') {
190 if((i < result.GetLength() - 1) && result[i + 1] == '%') { 190 if((i < result.GetLength() - 1) && result[i + 1] == '%') {
191 result.Delete(i + 1, 1); 191 result.Delete(i + 1, 1);
192 } else { 192 } else {
193 result.SetAt(i, (FX_CHAR)0x1d); 193 result.SetAt(i, (FX_CHAR)0x1d);
194 } 194 }
195 } 195 }
196 } 196 }
197 } 197 }
198 } 198 }
199 void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bit s, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e) 199 void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bit s, CFX_ByteString &result, int32_t count, int32_t &e)
200 { 200 {
201 while(count >= 3) { 201 while(count >= 3) {
202 FX_INT32 threeDigitsBits = bits->ReadBits(10, e); 202 int32_t threeDigitsBits = bits->ReadBits(10, e);
203 BC_EXCEPTION_CHECK_ReturnVoid(e); 203 BC_EXCEPTION_CHECK_ReturnVoid(e);
204 if(threeDigitsBits >= 1000) { 204 if(threeDigitsBits >= 1000) {
205 e = BCExceptionRead; 205 e = BCExceptionRead;
206 BC_EXCEPTION_CHECK_ReturnVoid(e); 206 BC_EXCEPTION_CHECK_ReturnVoid(e);
207 } 207 }
208 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[threeDigitsBits / 100]); 208 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[threeDigitsBits / 100]);
209 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[(threeDigitsBits / 10) % 10]); 209 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[(threeDigitsBits / 10) % 10]);
210 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[threeDigitsBits % 10]); 210 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[threeDigitsBits % 10]);
211 count -= 3; 211 count -= 3;
212 } 212 }
213 if(count == 2) { 213 if(count == 2) {
214 FX_INT32 twoDigitBits = bits->ReadBits(7, e); 214 int32_t twoDigitBits = bits->ReadBits(7, e);
215 BC_EXCEPTION_CHECK_ReturnVoid(e); 215 BC_EXCEPTION_CHECK_ReturnVoid(e);
216 if(twoDigitBits >= 100) { 216 if(twoDigitBits >= 100) {
217 e = BCExceptionRead; 217 e = BCExceptionRead;
218 BC_EXCEPTION_CHECK_ReturnVoid(e); 218 BC_EXCEPTION_CHECK_ReturnVoid(e);
219 } 219 }
220 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits / 10] ); 220 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits / 10] );
221 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits % 10] ); 221 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits % 10] );
222 } else if(count == 1) { 222 } else if(count == 1) {
223 FX_INT32 digitBits = bits->ReadBits(4, e); 223 int32_t digitBits = bits->ReadBits(4, e);
224 BC_EXCEPTION_CHECK_ReturnVoid(e); 224 BC_EXCEPTION_CHECK_ReturnVoid(e);
225 if(digitBits >= 10) { 225 if(digitBits >= 10) {
226 e = BCExceptionRead; 226 e = BCExceptionRead;
227 BC_EXCEPTION_CHECK_ReturnVoid(e); 227 BC_EXCEPTION_CHECK_ReturnVoid(e);
228 } 228 }
229 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[digitBits]); 229 BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[digitBits]);
230 } 230 }
231 } 231 }
232 const CFX_ByteString CBC_QRDecodedBitStreamParser::GuessEncoding(CFX_ByteArray * bytes) 232 const CFX_ByteString CBC_QRDecodedBitStreamParser::GuessEncoding(CFX_ByteArray * bytes)
233 { 233 {
234 return *UTF_8; 234 return *UTF_8;
235 } 235 }
236 FX_INT32 CBC_QRDecodedBitStreamParser::ParseECIValue(CBC_CommonBitSource* bits, FX_INT32 &e) 236 int32_t CBC_QRDecodedBitStreamParser::ParseECIValue(CBC_CommonBitSource* bits, i nt32_t &e)
237 { 237 {
238 FX_INT32 firstByte = bits->ReadBits(8, e); 238 int32_t firstByte = bits->ReadBits(8, e);
239 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 239 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
240 if((firstByte & 0x80) == 0) { 240 if((firstByte & 0x80) == 0) {
241 return firstByte & 0x7f; 241 return firstByte & 0x7f;
242 } else if((firstByte & 0xc0) == 0x80) { 242 } else if((firstByte & 0xc0) == 0x80) {
243 FX_INT32 secondByte = bits->ReadBits(8, e); 243 int32_t secondByte = bits->ReadBits(8, e);
244 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 244 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
245 return ((firstByte & 0x3f) << 8) | secondByte; 245 return ((firstByte & 0x3f) << 8) | secondByte;
246 } else if((firstByte & 0xe0) == 0xc0) { 246 } else if((firstByte & 0xe0) == 0xc0) {
247 FX_INT32 secondThirdByte = bits->ReadBits(16, e); 247 int32_t secondThirdByte = bits->ReadBits(16, e);
248 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 248 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
249 return ((firstByte & 0x1f) << 16) | secondThirdByte; 249 return ((firstByte & 0x1f) << 16) | secondThirdByte;
250 } 250 }
251 e = BCExceptionBadECI; 251 e = BCExceptionBadECI;
252 BC_EXCEPTION_CHECK_ReturnValue(e, 0); 252 BC_EXCEPTION_CHECK_ReturnValue(e, 0);
253 return 0; 253 return 0;
254 } 254 }
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h ('k') | xfa/src/fxbarcode/qrcode/BC_QRDetector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698