MCPcopy Create free account
hub / github.com/devilsen/CZXing / GetMessage

Function GetMessage

czxing/src/main/cpp/zxing/src/maxicode/MCDecoder.cpp:208–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208static void GetMessage(const ByteArray& bytes, int start, int len, Content& result, StructuredAppendInfo& sai)
209{
210 int shift = -1;
211 int set = 0;
212 int lastset = 0;
213
214 for (int i = start; i < start + len; i++) {
215 int c = CHARSETS[set].at(bytes[i]);
216 switch (c) {
217 case LCHA:
218 set = 0;
219 shift = -1;
220 break;
221 case LCHB:
222 set = 1;
223 shift = -1;
224 break;
225 case SHI0:
226 case SHI1:
227 case SHI2:
228 case SHI3:
229 case SHI4:
230 lastset = set;
231 set = c - SHI0;
232 shift = 1;
233 break;
234 case TWSA:
235 lastset = set;
236 set = 0;
237 shift = 2;
238 break;
239 case TRSA:
240 lastset = set;
241 set = 0;
242 shift = 3;
243 break;
244 case NS:
245 result.append(
246 ToString((bytes[i + 1] << 24) + (bytes[i + 2] << 18) + (bytes[i + 3] << 12) + (bytes[i + 4] << 6) + bytes[i + 5], 9));
247 i += 5;
248 break;
249 case LOCK: shift = -1; break;
250 case ECI: result.switchEncoding(ParseECIValue(bytes, i)); break;
251 case PAD:
252 if (i == start)
253 ParseStructuredAppend(bytes, i, sai);
254 shift = -1;
255 break;
256 default: result.push_back(c);
257 }
258
259 if (shift-- == 0)
260 set = lastset;
261 }
262}
263
264ZXING_EXPORT_TEST_ONLY
265DecoderResult Decode(ByteArray&& bytes, const int mode)

Callers 1

DecoderResult DecodeFunction · 0.85

Calls 7

ParseECIValueFunction · 0.70
ParseStructuredAppendFunction · 0.70
ToStringFunction · 0.50
atMethod · 0.45
appendMethod · 0.45
switchEncodingMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected