Exemplo n.º 1
0
bool Layout::write_block_meta(BlockMeta* meta, BlockWriter& writer)
{
    if (!writer.writeUInt64(meta->offset)) return false;
    if (!writer.writeUInt32(meta->skeleton_size)) return false;
    if (!writer.writeUInt32(meta->total_size)) return false;
    if (!writer.writeUInt16(meta->crc)) return false;
    if (!writer.writeUInt16(meta->skeleton_crc)) return false;
    return true;
}
Exemplo n.º 2
0
bool Layout::write_superblock(BlockWriter& writer)
{
    if (!writer.writeUInt64(superblock_->magic_number)) return false;
    if (!writer.writeUInt8(superblock_->major_version)) return false;
    if (!writer.writeUInt8(superblock_->minor_version)) return false;

    if (superblock_->index_block_meta) {
        if (!writer.writeBool(true)) return false;
        if (!write_block_meta(superblock_->index_block_meta, writer)) return false;
    } else {
        if (!writer.writeBool(false)) return false;
    }

    if (!writer.writeUInt16(superblock_->crc)) return false;
    return true;
}