45 MHERROR(
"Unexpected end of file");
58 MHERROR(
"Indefinite length strings are not implemented");
61 int nLength = endStr -
m_p;
62 auto *stringValue = (
unsigned char *)malloc(nLength + 1);
63 if (stringValue ==
nullptr)
68 unsigned char *
p = stringValue;
83 bool firstByte =
true;
87 MHERROR(
"Indefinite length integers are not implemented");
96 if (firstByte && ch >= 128)
103 intVal = (intVal << 8) | ch;
114 enum : std::uint8_t { Universal, Context } tagClass = Universal;
117 unsigned int tagNumber = 0;
128 tagClass = Universal;
134 MHERROR(QString(
"Invalid tag class = %1").arg(ch, 0, 16));
139 tagNumber = ch & 0x1f;
141 if (tagNumber == 0x1f)
148 tagNumber = (tagNumber << 7) | (ch & 0x7f);
150 while ((ch & 0x80) != 0);
160 int lengthOfLength = ch & 0x7f;
162 if (lengthOfLength == 0)
170 while (lengthOfLength--)
173 endOfItem = (endOfItem << 8) | ch;
181 endOfItem = ch +
m_p;
184 if (tagClass == Context)
208 if (
m_p != endOfItem)
211 pNode->AddArg(
new MHPBool(intVal != 0));
229 if (
m_p != endOfItem)
232 pNode->AddArg(
new MHPEnum(intVal));
265 if (
m_p != endOfItem)
268 pNode->AddArg(
new MHPInt(intVal));
296 MHERROR(
"Indefinite length arguments are not implemented");
299 while (
m_p < endOfItem)
324 return new MHPBool(intVal != 0);
329 return new MHPInt(intVal);
352 MHERROR(
"Indefinite length sequences are not implemented");
357 while (
m_p < endOfItem)
372 MHERROR(QString(
"Unknown universal %1").arg(tagNumber));