本文整理汇总了C++中MemChunk::getUint64LE方法的典型用法代码示例。如果您正苦于以下问题:C++ MemChunk::getUint64LE方法的具体用法?C++ MemChunk::getUint64LE怎么用?C++ MemChunk::getUint64LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemChunk
的用法示例。
在下文中一共展示了MemChunk::getUint64LE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseBlock
void Xz::parseBlock(const MemChunk& chunk, unsigned int& processed, unsigned int size, unsigned char checkMethod, uint64_t& unpaddedSize, uint64_t& uncompressedSize)
{
std::vector<Filter> filters;
uint64_t compressedSize;
bool hasCompressedSize;
uint64_t decompressedSize;
bool hasDecompressedSize;
unsigned int blockHeaderStart = processed;
this->parseBlockHeader(chunk, processed, size, filters, compressedSize, hasCompressedSize, decompressedSize, hasDecompressedSize);
unsigned int blockStart = processed;
MemChunk tmpChunk;
for (auto& filter : filters)
{
switch (filter.mId)
{
case 0x21:
{
unsigned int compSize = this->decodeLzma2(chunk, tmpChunk, processed, size, filter);
if (hasCompressedSize && compressedSize != compSize)
Except::reportError(blockStart, "xz, block", "compressed size field does not match actual size");
break;
}
default:
Except::reportError(filter.mPos, "xz, filter", "unsupported filter");
}
}
if (hasDecompressedSize && decompressedSize != tmpChunk.size())
Except::reportError(blockStart, "xz, block", "decompressed size field does not match actual size");
uncompressedSize = tmpChunk.size();
mSrcColorizer.addHighlight(blockStart, processed - blockStart, QColor(192, 192, 192, 64));
mDecompChunk.append(tmpChunk);
mSrcColorizer.addSeparation(processed, 2);
unsigned int padding = this->checkPadding(chunk, processed, size, "xz, block padding");
switch (checkMethod)
{
case 0x00: // none
break;
case 0x01: // CRC32
if (!Util::checkRange(processed, 4, size))
Except::reportError(size, "xz, block check", "unexpected end of data");
if (chunk.getUint32LE(processed) != Hasher::getCRC32(tmpChunk))
Except::reportError(processed, "xz, block check", "invalid check");
mSrcColorizer.addHighlight(processed, 4, QColor(0, 255, 0, 64));
processed += 4;
mSrcColorizer.addSeparation(processed, 2);
break;
case 0x04: // CRC64
if (!Util::checkRange(processed, 8, size))
Except::reportError(size, "xz, block check", "unexpected end of data");
if (chunk.getUint64LE(processed) != Hasher::getCRC64(tmpChunk))
Except::reportError(processed, "xz, block check", "invalid check");
mSrcColorizer.addHighlight(processed, 8, QColor(0, 255, 0, 64));
processed += 8;
mSrcColorizer.addSeparation(processed, 2);
break;
case 0x0A: // SHA-256
if (!Util::checkRange(processed, 32, size))
Except::reportError(size, "xz, block check", "unexpected end of data");
if (chunk.subChunk(processed, 32) != Hasher::getSha256(tmpChunk).chunk())
Except::reportError(processed, "xz, block check", "invalid check");
mSrcColorizer.addHighlight(processed, 32, QColor(0, 255, 0, 64));
processed += 32;
mSrcColorizer.addSeparation(processed, 2);
break;
default:
Except::reportError(processed, "xz, block check", "unknown check method");
}
unpaddedSize = processed - blockHeaderStart - padding;
}